xsl-list
[Top] [All Lists]

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

2006-11-06 02:49:35
HI

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>

layout1.xsl
--------------
<?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="/">
   <html>
     <body>
       <xsl:apply-templates/>
     </body>
   </html>
 </xsl:template>

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

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

</xsl:stylesheet>

verify-output1.xml
------------------------
<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>
</form></body></html>

test1.sh
----------
#!/bin/sh
xsltproc layout1.xsl source1.xml > output1.xml
diff verify-output1.xml output1.xml

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] libxslt 1.1.18 bug in copy-of with &amp; escaping, Davor Emard <=