Re: [xsl] Supressing entity expansion during XSLT transform

Subject: Re: [xsl] Supressing entity expansion during XSLT transform
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 11 Jan 2008 12:26:45 GMT
> The improved or "better" identity transformation recreates anything to
> the last detail except normalization of attribute values, non
> significant whitespace like <x  >, and the order of attributes in some
> situations.

It's a lot more robust (and a lot longer:-) than the eralier one, but
still to do a full job you need a full XML parser,

The classic way to trap a system that is using regular expressions to do
parsing is just to nest things sufficiently deeply...

<!DOCTYPE x [
<!ENTITY x "x<![CDATA[g]]>">
<!-- ]]> -->
]>
<x/>


is well formed, here is the output of an identity pass through an xml
parser:

$ rxp  id.xml
<!DOCTYPE x [
<!ENTITY x "x<![CDATA[g]]>">
<!-- ]]> -->
]>
<x/>


but:


$ saxon9 -o id-out.xml id.xml identity-template.xsl

produces

$ cat id-out.xml 
<!DOCTYPE x [
<!ENTITY x "x<![CDATA[ g]]>">
<!-- urqpwoehreregfyuio> -->
]?>
<x/>

which isn't well formed

$ rxp  id-out.xml    
Error: Expected > at end of dtd, but got ?
 in unnamed entity at line 4 char 2 of file:///c:/tmp/id-out.xml

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread