Copy existing XML, duplicate element and modify
- by Robert
Hi,
I have a tricky XSL problem at the moment.
I need to copy the existing XML, copy a certain element (plus its child elements) and modify the value of two child-elements.
The modifications are: divide value of the 'value' element by 110 and edit the value of the 'type' element from 'normal' to 'discount'.
This is currently what I have:
Current XML:
<dataset>
<data>
<prices>
<price>
<value>50.00</value>
<type>normal</type>
</price>
</prices>
</data>
</dataset>
Expected result
<dataset>
<data>
<prices>
<price>
<value>50.00</value>
<type>normal</type>
</price>
<price>
<value>45.00</value>
<type>discount</type>
</price>
</prices>
</data>
</dataset>
Any takers?
I've gotten as far as copying the desired 'price' element using copy-of, but I'm stuck as to how to modify it next.