[xsl] libxslt 1.1.18 bug in copy-of with & escaping

Subject: [xsl] libxslt 1.1.18 bug in copy-of with & escaping
From: "Davor Emard" <vordah@xxxxxxxxx>
Date: Mon, 6 Nov 2006 10:49:13 +0100

I just synced debian's libxslt 1.1.18 and it appears to have buggy
copy-of function.
I've attached small test1.sh script that should do the transformation
and verify it's output with attached correct result verify-output.xml

Basically making <a><value-of .../><(a> should be identical
to the <copy-of select="."/> but it isn't and it seems escape &amp;
is treated differently in value-of and copy-of case!!!!

It works correct  on 1.1.17 but on 1.1.18 it sends an error
error : unterminated entity reference           var=5

and of course output is different (truncated part after &amp;)

< <a href="index.php?table=2&amp;var=5">item 5</a><a
href="index.php?table=2&amp;var=5">item 5</a>
<a href="index.php?table=2&amp;var=5">item 5</a><a href="index.php?table=2">item 5</a>

source1.xml: ----------------- <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="layout1.xsl"?> <formular url="http://server/application?table=1&amp;var=3";> <a href="index.php?table=2&amp;var=5">item 5</a> </formular>

<?xml version="1.0" encoding="iso-8859-2"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
 <xsl:output method="html" indent="yes" encoding="utf-8"/>
 <xsl:template match="/">

 <xsl:template match="formular">
   <form action="{@url}">
     <xsl:apply-templates select="a"/>

 <xsl:template match="a">
   <a href="{@href}"><xsl:value-of select="."/></a>
   <xsl:copy-of select="."/>


<html><body><form action="http://server/application?table=1&amp;var=3";>
<a href="index.php?table=2&amp;var=5">item 5</a><a
href="index.php?table=2&amp;var=5">item 5</a>

xsltproc layout1.xsl source1.xml > output1.xml
diff verify-output1.xml output1.xml

Current Thread