GNOME Bugzilla – Bug 107165
numerous cdatas using cdata-section-elements
Last modified: 2009-08-15 18:40:50 UTC
given the .xml and .xslt below, libxslt produces numerous cdata rather than enclosing the specified element in a cdata. <grammar><![CDATA[<f]]><![CDATA[ "1234]]><![CDATA["> ]]></grammar> Both sablotron and msxml produce a single enclosing cdata. <grammar><![CDATA[<f "1234"> ]]></grammar> <!-- .xml --> <grammar> <key name="f" value="1234"/> </grammar> <!-- .xslt --> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:output cdata-section-elements="grammar"/> <xsl:template match="/"> <xsl:apply-templates select="/grammar" /> </xsl:template> <xsl:template match="grammar"> <grammar> <xsl:apply-templates select="key" /> </grammar> </xsl:template> <xsl:template match="key"> <xsl:text disable-output-escaping="yes"><</xsl:text><xsl:value-of select="@name"/> "<xsl:value-of select="@value"/><xsl:text disable-output- escaping="yes">"> </xsl:text> </xsl:template> </xsl:stylesheet>
You're asking to output 3 differnt items which cannot be merged logically: - a text segment which must not be escaped - a text segment generated by two value-of results and a text string embedded in thge stylesheets, all of them subject to escaping and who can them be groupped - a text segment which must not be escaped whether you can expect them to be glued together when generated within a CDATA section is unclear from the spec. I would say again to drop your disable-output-escaping tricks if you want portable code. I'm not sure this can really be considered a bug which should be fixed. What does Saxon and Xalan generate on the same input ? Daniel
No answer, gug gets closed now, Daniel