xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joseph Kesselman <kesh...@us.ibm.com>
Subject Re: CDATA sections weird stuff
Date Wed, 02 Oct 2002 17:17:58 GMT
To control CDATASections in your stylesheet's output, you can use the 
cdata-section-elements attribute of the <xsl:output> element.

You didn't show us your document and stylesheet, but there are some 
subtleties you may want to be aware of... Xalan's internal rule is that a 
block of text should probably be treated as a CDATASection if it is 
*ENTIRELY* made up of CDATASections. If it's a mix, we convert the whole 
thing to text with character references where required. Note that 
whitespace (newlines, indentation) around the <![CDATA]]> are part of the 
element's text content and may cause us to switch to non-CDATASection 
mode.

Note too that no properly-written XML application should care about the 
difference between escaping individual characters and using <![CDATA]]> to 
mark the whole thing as a literal. Unfortunately there are some badly 
written apps out there which do care, and of course it may affect humans 
who want to read the generated file without using a tool.

Also note that the contents of <![CDATA]]>s are expressed in the current 
encoding. If a character isn't supported by that encoding, we may be 
forced to exit the CDATASection and us a character reference instead.

______________________________________
Joe Kesselman  / IBM Research

Mime
View raw message