GNOME Bugzilla – Bug 352907
xsl:copy-of of an attribute value with escaped ampersand causes error: unterminated entity reference
Last modified: 2006-11-17 02:00:35 UTC
Using xsltproc, an xsl:copy-of of a node set that contains an attribute value with an escaped ampersand (whether & or &) causes the following error: error : unterminated entity reference The command xsltproc stylesheet.xsl source.xml using the attached files should reproduce the problem. result.xml is the output I get from xsltproc along with the error message. expected.xml is what I *expected* to get. Note that only copy-of triggers the problem. Using source.xml, both <xsl:value-of select="@name"/> and <xsl:apply-templates select="@name"/> don't cause any errors. xmllint has no complaints about source.xml. This looks simlilar to the problem reported to the mailing list by Brad Botkin (brad_botkin@wgbh.org) on Jul 22, 2006. Since I didn't see any more details from him, I assume nobody was able to investigate this further. I'm running the Win32 binaries from http://www.zlatkovic.com/. Output of xsltproc --version: Using libxml 20626CVS2823, libxslt 10117CVS1069 and libexslt 813CVS1069 xsltproc was compiled against libxml 20626, libxslt 10117 and libexslt 813 libxslt 10117 was compiled against libxml 20626 libexslt 813 was compiled against libxml 20626
Created attachment 71626 [details] testcase stylesheet
Created attachment 71627 [details] testcase source XML document
Created attachment 71628 [details] testcase actual results
Created attachment 71629 [details] testcase expected results
I have the same problem here under Linux (Debian) with: Using libxml 20627, libxslt 10118 and libexslt 813 xsltproc was compiled against libxml 20627, libxslt 10118 and libexslt 813 libxslt 10118 was compiled against libxml 20627 libexslt 813 was compiled against libxml 20627 (I upgraded two days ago). This is a particularly annoying error since it is a regression (meaning that some existing XSLT files no longer work) and I don't see any workaround. For this reason, this is a major bug, IMHO.
i'm being bitten by this bug as well... i upgraded last friday (libxslt 1.1.18 and libxml 2.6.27), and recompiled php-5.2.0(and CVS) against these libs (actually trying to get rid of another bug, which seems to have worked). now i'm quite stuck with this one, which is not very easy to work around...
Created attachment 76692 [details] xslt__copy-of.xsl
This bug hits me too :( - Copying nodes with querystring-URL attributes. It comes with the 1.1.18. my test stylesheet attached: xslt__copy-of.xsl transcript: $ echo '<root href="/query?x=3&y=4"/>' | xsltproc xslt__copy-of.xsl - error : unterminated entity reference y=4 <?xml version="1.0"?> <root href="/query?x=3"/> $ xsltproc -V Using libxml 20627, libxslt 10118 and libexslt 813 xsltproc was compiled against libxml 20627, libxslt 10118 and libexslt 813 libxslt 10118 was compiled against libxml 20627 libexslt 813 was compiled against libxml 20627
This problem was introduced during the recent libxslt "refactoring". I made a small enhancement to the applicable routine which (I believe) should fix it, and added the testcase to the regression tests. Please try the modified code (current CVS) on your original data and re-open the bug if unsatisfactory.