[xml/sgml-pkgs] Bug#397395: Bug reproduction

Ron Rademaker ron at ttvavanti.nl
Thu Nov 16 08:23:29 UTC 2006


I can also reproduce this bug in debian with these test files:

ron at barcelona:~/phpxslbugtest$ cat test.xml
<?xml version='1.0'?>
<test>
        <tag attribute='somethingwith&amp;anamp'>content&amp;</tag>
</test>
ron at barcelona:~/phpxslbugtest$ cat test.xsl
<?xml version='1.0'?>
<!DOCTYPE xsl:stylesheet [<!ENTITY nbsp "&#160;">]>

<xsl:stylesheet version='1.0' 
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

        <xsl:template match='/test'>
                <xsl:copy-of select='.'/>
        </xsl:template>

</xsl:stylesheet>
ron at barcelona:~/phpxslbugtest$ xsltproc test.xsl test.xml
error : unterminated entity reference           anamp
<?xml version="1.0"?>
<test>
        <tag attribute="somethingwith">content&amp;</tag>
</test>


I looked at the libxml code and found that the error occurs because 
somewhere in the process the entity is interpreted and the interpreted 
value is passed to libxml2's xmlStringGetNodeList function (which 
actually throws the error). A very dirty workaround is to use 
constructions like &amp;amp;

Ron




More information about the debian-xml-sgml-pkgs mailing list