xsl-list
[Top] [All Lists]

RE: CDATA - Can I have XML ?

2003-03-07 07:55:43


What about the situation where an XHTML fragment needs to be 
put into an otherwise "vanilla" XML document, where character
entities (“ etc.) are embedded in the XHTML document
fragment?

Is it poor design to use these character entities?

Thanks.


-----Original Message-----
From: Michael Kay [mailto:mhk(_at_)mhk(_dot_)me(_dot_)uk] 
Sent: Friday, March 07, 2003 9:25 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] CDATA - Can I have XML ?


  Is it possible possible to parse the XML data which is 
under CDATA tag in a XSL?

Yes, you can extract it as a string and pass it to an XML parser like
any other string. But you can't do this within standard XSLT 
1.0 (Saxon
has an extension function saxon:parse to do this).

The usual advice is that when you nest one XML document 
inside another,
you should nest it directly, without using CDATA. XML is specifically
designed to allow such nesting. CDATA is saying "the angle brackets in
here may look like markup, but they aren't". So if they are 
markup, why
put them in CDATA?

But of course, dealing with badly-designed XML is what we all 
have to do
every day.

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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