[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: CDATA elements in XSLT

Subject: RE: CDATA elements in XSLT
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 25 May 2004 19:12:49 +0100
xslt cdata
> 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 &amp; 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 &amp; 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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.