This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: CDATA back to its original shape
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] CDATA back to its original shape
- From: David Carlisle <davidc at nag dot co dot uk>
- Date: Thu, 15 Feb 2001 12:40:07 GMT
- References: <3A8BC97E.90E25FD9@alu.ua.es>
- Reply-To: xsl-list at lists dot mulberrytech dot com
I have a problem using CDATA in my XML document.
I know that this code used in XSL...
<object>
<![CDATA[
<more_tags>anything</more_tags>
]]>
</object>
...will give me the output that I want:
<object>
<more_tags>anything</more_tags>
</object>
No it won't!! It will produce something like
<object>
<more_tags>anything</more_tags>
</object>
.. but I would like to have the code with CDATA in my XML document
instead, retrieve it from XSL and transform it to its original shape
again producing HTML with the tags I had in XML. Can I do it?
Thank you.
An XSL engine does not see your CDATA marked sections any more than it
sees whether you use " or ' around attribute values. All those things
are resovled by the parser before the input tree is constructed for XSL.
input of <![CDATA[ this <x>xxx</x>]]> produces _exactly_ the same
input to XSL as this <x>xxx</x> so there is no way for an
XSLT engine to distinguish them.
If you said _why_ you wanted to use CDATA marked sections someone may
suggest what approach you should take, but note that CDATA sections are
just a authoring shortcut to avoid writing lots of < unline elements
or attributes they have no effect on the actual result of the parse in
the XPath tree model of an XML document.
David
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list