Re: [xslt] XHTML serialization - implicit creation of CDATA sections for specific elements

On 2006-06-22 14:42:25 +0200, Buchcik, Kasimier wrote:
> I see the following reasons to disable this mechanism:
> 1) The addition is not performed by the Saxon, Xalan, Sablotron and .NET
>   XSLT processors (maybe others as well).
> 2) It constitutes a problem for some people, since comes unexpectedly.
> 3) The XHTML spec does not give a hint that CDATA sections
>   should be generated automatically by the serialization
>   mechanism; it only makes XHTML authors aware that one can use CDATA
>   sections to make the text more readable in the XML document.
>   (

Or it was written for authors who want to switch from HTML4 to
XHTML (possibly converting old HTML4 files into XHTML ones):
instead of replacing some characters by entities, they can use
a CDATA section.

Also, more importantly...

> Due to a bug in the serialization of non-output-escaped text in
> conjunction with CDATA sections, the current state can
> lead to incorrect results.
> The following example demonstrates that the generated content
> of the "style" element differs; the current behaviour generates
> the text "<hr/>", while the correct result would be the element
> "hr".

And with an example I've written:

$ xsltproc xhtml-serial.xsl xhtml-serial.xsl | xsltproc getstyle.xsl -
body { }

$ sabcmd xhtml-serial.xsl xhtml-serial.xsl | xsltproc getstyle.xsl -
body { }

$ xalan -xsl xhtml-serial.xsl -in xhtml-serial.xsl | xsltproc getstyle.xsl -
body { }

where xhtml-serial.xsl is the testcase given in my bug report[*] and
getstyle.xsl just does <xsl:value-of select="concat(//h:style,'&#10;')"/>
with text output.


> So actually there are 2 issues here:
> 1) Removing the unexpected generation of CDATA sections
> 2) Fixing the serialization bug


Vincent Lefèvre <vincent vinc17 org> - Web: <>
100% accessible validated (X)HTML - Blog: <>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

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