[xslt] bug in escaping cdata inside cdata inside cdata-section-element?



I have some input XML which contains CDATA elements escaped inside of 
other CDATA elements:


<?xml version="1.0" encoding="UTF-8"?>
<collection>
  <test><![CDATA[
    <![CDATA[abc]]]>]&gt;<![CDATA[
  ]]></test>
</collection>


not the most attractive XML, I'll admin. but when I apply this simple XSL
to just copy the input (and add 'test' to the list of 
cdata-section-elements):


<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
  version="1.0"
>
  <xsl:output method="xml" encoding="UTF-8" 
    cdata-section-elements="test" 
  />

  <xsl:template match="/">
    <xsl:copy-of select="*" />
  </xsl:template>
</xsl:stylesheet>


I get this output:


<?xml version="1.0" encoding="UTF-8"?>
<collection>
  <test><![CDATA[
    <![CDATA[abc]]>
  ]]></test>
</collection>


since the ']]>' has not been re-escaped, this is now broken XML.

my version:

[pawlowski]$ libxslt/xsltproc -V
Using libxml 20509, libxslt 10033 and libexslt 722
xsltproc was compiled against libxml 20509, libxslt 10033 and 
libexslt 722
libxslt 10033 was compiled against libxml 20509
libexslt 722 was compiled against libxml 20509



thanks for your help!

Peter Pawlowski



-- 

Peter Pawlowski
pawlowski@vivisimo.com
Software Engineer, Lead Linguist
Vivisimo, Inc

"Organized information
from anywhere, any time,
in any language."






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]