xsl-list
[Top] [All Lists]

RE: CDATA elements in XSLT

2004-05-25 11:12:49
The question is; How can I escape the & sign from the xml 
file to the xml
output so I can write to the xml output: "America & Brownie" 
instead of
having: "America & Brownie".

If the output contained the string "America & Brownie" then it wouldn't be
valid XML. If you want to write non-XML output, that's another question.

I also need to count on the number of characters for "America 
& Brownie" and
not from "America & Brownie".

No problem, string-length() counts the number of characters in the text
node, not the number of characters in the external serialization. In the
text node there is a single "&" character.

I have read about CDATA but doesn't seems to be the better 
solution. 

Doesn't help. Ampersand characters in the data model have to be escaped,
either using entities, character references, or CDATA, when they appear in
lexical XML. Otherwise it's not XML.

Michael Kay



<Prev in Thread] Current Thread [Next in Thread>