ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xsl-list
xsl-list
[xsl] libxslt 1.1.18 bug in copy-of with & escaping
by Davor Emard other posts by this author
Nov 6 2006 1:49AM messages near this date
Re: [xsl] i18n and l10n question | Re: [xsl] CDATA or escape in the result tree problems
& XSLT 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="{@url}"> 
      <xsl:apply-templates select="a"/> 
    </form> 
  </xsl:template> 

  <xsl:template match="a"> 
    <a href="{@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@[...].com> 
--~--

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved