GNOME Bugzilla – Bug 321505
Multiple contiguous CDATA in output
Last modified: 2006-07-14 16:29:22 UTC
Please describe the problem: Hi, My XSLT stylesheet produces strange results when it comes to CDATA. Instead of encapsulating all the data into one CDATA, I see many contiguous CDATA Steps to reproduce: 1. File data.xml: <doc> <text>blabla</text> <text>turlututu</text> <text>chapeau pointu</text> </doc> 2. the cdata.xsl: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" cdata-section-elements="doc" indent="yes"/> <xsl:template match="doc"> <doc> <xsl:apply-templates/> </doc> </xsl:template> <xsl:template match="text"> <xsl:value-of select="."/> </xsl:template> </xsl:stylesheet> Actual results: "xsltproc.exe cdata.xsl data.xml" produces: <?xml version="1.0"?> <doc><![CDATA[ blabla]]><![CDATA[ turlututu]]><![CDATA[ chapeau pointu]]><![CDATA[ ]]></doc> Expected results: <?xml version="1.0"?> <doc><![CDATA[ blabla turlututu chapeau pointu ]]></doc> Does this happen every time? yes Other information: I'm under gygwin > xsltproc --version Using libxml 20616, libxslt 10112-CVS964 and libexslt 810-CVS964 xsltproc was compiled against libxml 20615, libxslt 10112 and libexslt 810 libxslt 10112 was compiled against libxml 20616 libexslt 810 was compiled against libxml 20616
The responsible code for this is in xsltCopyText(), where CDATA-section nodes are created, without merging of adjacent CDATA-section nodes.
Fixed in CVS HEAD now. Probably this fix could produce some sideeffects when serializing "disable-output-escaping" text nodes into CDATA sections.