Semantically, there is no difference between text within a CData Section 
and other text (possibly with characters escaped as Numeric Character 
References). It's only a matter of how you happened to express that 
particular value in the file.

In particular, the XML Data Model doesn't distinguish between these, the 
XPath Data Model doesn't distinguish between these, and hence XSLT doesn't 
distinguish between these.

So: Don't worry about it. Let the parser and serializer deal with this, 
rather than trying to preserve the specific CData Section markup. The 
output may not look the same as the input, but will be semantically 
identical for any properly-written XML application.

If you know that specific elements do want their content expressed as 
CData Sections, XSLT does provide a way to express that hint. But if you 
don't know that in advance, you probably don't need to know it at all.


______________________________________
"You build world of steel and stone
I build worlds of words alone
Skilled tradespeople, long years taught:
You shape matter; I shape thought."
(http://www.songworm.com/lyrics/songworm-parody/ShapesofShadow.html)



From:
ajay bhadauria <abhadau...@yahoo.com>
To:
xalan-j-users@xml.apache.org, 
Date:
11/17/2011 12:00 AM
Subject:
Need to copy all the cdata elements to output xml using xslt




Hi,

I need to copy all the elements including cdata element of a parent 
element. I do not know that which child element is going to have cdata 
element however I need to copy all the children to output xml file using 
xslt.

Is there any we can do that ? Any help will be great.

My XML file is
<SwInt:RequestPayload xmlns:SwInt="abc.txt">
    <SwInt:firstName>Robert</SwInt:firstName>
    <SwInt:lastName>Dowson</SwInt:lastName>
    <SwInt:address>Nokesville</SwInt:address>
    <SwInt:Data><![CDATA[aaaaa<>]]></SwInt:Data>
    <SwInt:Data1>aaaaa&lt;&gt;</SwInt:Data1>
</SwInt:RequestPayload>

Regards
Ajay 

Reply via email to