Hi All,
Could someone please help me figure out how I can extract from my xml the CData part, which is also an xml. Once I have the CData xml, I will then apply some xslt script on it and then embed the processed xml back in the CData area.

For example:


<?xml version="1.0" encoding="UTF-8"?>
<fareRequest da="true">
<vcrs>
<vcr>U2</vcr>
</vcrs>
<fareTypes/>
<tourOps/>
<flights>
<flight depApt="SXF" depDate="2012-04-19" dstApt="BUD"/>
<flight depApt="BUD" depDate="2012-04-25" dstApt="SXF"/>
</flights>
<![CDATA[<CreditCardNumber>123456123</CreditCardNumber>]]>
<limit>20</limit>
<offset>0</offset>
<waitOnList>
<waitOn>ALL</waitOn>
</waitOnList>
<coses/>
</fareRequest>
I would like to extract the
<CreditCardNumber>123456123</CreditCardNumber>
, process it with my xslt script and then embed it back in the original xml, e.g. my desired out:


<?xml version="1.0" encoding="UTF-8"?>
<fareRequest da="true">
<vcrs>
<vcr>U2</vcr>
</vcrs>
<fareTypes/>
<tourOps/>
<flights>
<flight depApt="SXF" depDate="2012-04-19" dstApt="BUD"/>
<flight depApt="BUD" depDate="2012-04-25" dstApt="SXF"/>
</flights>
<![CDATA[<CreditCardNumber>*******23</CreditCardNumber>]]>
<limit>20</limit>
<offset>0</offset>
<waitOnList>
<waitOn>ALL</waitOn>
</waitOnList>
<coses/>
</fareRequest>
The masking
<CreditCardNumber>*******23</CreditCardNumber>
above is done by my xslt script.

What I need to know is how I can extract the CData part and embedd it back.

Second important thing is that the structure of my input xml is not fix. The input xml could vary in structure, i.e. it might or might not have CData, incase if the CData is not there, the xslt script should simply be applied and masking is performed if required. The masking logic is handled entirely in the xslt script. But in-case, if the CData is present, then the extraction->xslt script->embed logic is applied.

So in short, I am looking for a kind osolution as to how I can check if CData is present, and if yes, extract its contents, then xslt and then embedding it back in the original xml.

Thanks.