I'm working with a XML requests whereby I need to change the attribute value of an element if another attribute value is equal to one or more values. Xpath can't update the XML itself (so I understand) and I have been looking at XSL but it's quite complicated and I don't normally work in XML.
This is a cut down version of the XML I'm working wth :
<t6:Catalogue xmlns:t6="http://xxx.yy.com">
<t6:Items>
<t6:Item />
<t6:Item />
<t6:Item />
</t6:Items>
<t6:Mappings>
<t6:Mapping action="ADD_NEW" type="MAP"></t6:Mapping>
<t6:Mapping action="ADD_NEW" type="FOO"></t6:Mapping>
<t6:Mapping action="ADD_NEW" type="CAR"></t6:Mapping>
<t6:Mapping action="ADD_NEW" type="PLANE"></t6:Mapping>
<t6:Mapping action="ADD_NEW" type="MAP"></t6:Mapping>
</t6:Mappings>
</t6:Catalogue>
I need to change the action from ADD_NEW to UPDATE_OLD in the Mappings block if type equals PLANE or CAR.
I have been looking at peoples' other examples of XSL and trying to wrap my head around how to start it but cannot. The tool I am using supports XSL and has a custom piece of software where I can drop an XSL template into it and it will apply it to the XML message I specify.
But I'm not sure where to start -- at risk of sounding like, "Please do my work for me, SO users", if someone could give me at least a starting point of how I first point to my structure and then how to change a value IF x = y.
Thanks everyone.