After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 352907 - xsl:copy-of of an attribute value with escaped ampersand causes error: unterminated entity reference
xsl:copy-of of an attribute value with escaped ampersand causes error: unterm...
Status: RESOLVED FIXED
Product: libxslt
Classification: Platform
Component: general
1.1.x
Other Windows
: Normal minor
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2006-08-25 22:15 UTC by csekellick
Modified: 2006-11-17 02:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
testcase stylesheet (252 bytes, application/xml)
2006-08-25 22:16 UTC, csekellick
Details
testcase source XML document (65 bytes, application/xml)
2006-08-25 22:19 UTC, csekellick
Details
testcase actual results (65 bytes, application/xml)
2006-08-25 22:19 UTC, csekellick
Details
testcase expected results (76 bytes, application/xml)
2006-08-25 22:20 UTC, csekellick
Details
xslt__copy-of.xsl (190 bytes, application/xml)
2006-11-16 00:29 UTC, Richard Leopold
Details

Description csekellick 2006-08-25 22:15:23 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
Comment 1 csekellick 2006-08-25 22:16:48 UTC
Created attachment 71626 [details]
testcase stylesheet
Comment 2 csekellick 2006-08-25 22:19:24 UTC
Created attachment 71627 [details]
testcase source XML document
Comment 3 csekellick 2006-08-25 22:19:57 UTC
Created attachment 71628 [details]
testcase actual results
Comment 4 csekellick 2006-08-25 22:20:46 UTC
Created attachment 71629 [details]
testcase expected results
Comment 5 Vincent Lefevre 2006-11-07 01:23:10 UTC
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.
Comment 6 Peter Blokland 2006-11-13 16:01:16 UTC
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... 
Comment 7 Richard Leopold 2006-11-16 00:29:58 UTC
Created attachment 76692 [details]
xslt__copy-of.xsl
Comment 8 Richard Leopold 2006-11-16 00:34:25 UTC
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&amp;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
Comment 9 William M. Brack 2006-11-17 02:00:35 UTC
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.