I am trying to add an attribute to a node which is part of a CDATA. My XML is
<documents>
<document id="1234">
<field name="CDATA" value="bill"><![CDATA[<bill name="xxx" age="12" />]]> </field>
</document>
</documents>
The result xml should be
<docs>
<doc>
<bill name="xxx" age="12" id="1234" />
</doc>
</docs>
The id attribute in the document node should be added as an attribute to the node inside the CDATA.
I was able to get the CDATA value as field[@name='CDATA'] but I was not sure how to add the attribute of document to the cdata..
Can anyone please suggest me how to do this or point me in the right direction?
parse-xml()that can be used to parse the text and create from it an XML document/fragment: w3.org/TR/xpath-functions-30/#func-parse-xml