I have a XML in which there is another XML (within CDATA). Now I want to modify the content of child XML. How is it possible?
In the below XML, If Address Type is Home, I want to change it to “01”.
Is it possible in XSLT 1.0??
<?xml>
<a>
<b>This is Parent</b>
<c>
<![CDATA[
<?xml>
<a1>This is Child XML></a1>
<person_address type="Home">
<street>ABCDStreet</street>
<city/>
<country/>
</person_address>
]]>
</c>
</a>
As described in the linked question above in the comment, you can’t treat the content of CDATA as XML, it is pure text.
First easy solution coming into mind (not saying the best one): in your case (XSLT 1.0 and simple text replacement) you could use some EXSLT extension template like
replace()to match the string against a regex and replace it with the wanted value.