I need to merge the two nodes MANHATTAN:
because our system rule is the following:
"CREATE A + MODIFY A" is still a "CREATE A with the merged attributes"
input file:
<?xml version="1.0" encoding="UTF-8"?>
<world>
<COUNTRY id="USA" >
<STATE id="NEW JERSEY">
<CITY id="NEW YORK" method="modify">
<DISTRICT id="MANHATTAN" method="create">
<attributes>
<population>99 </population>
<income> 10000</income>
</attributes>
</DISTRICT>
<DISTRICT id="MANHATTAN" method="modify">
<attributes>
<temperature>78</temperature>
<income>15000</income>
<information>suburb of newyork</information>
</attributes>
</DISTRICT>
</CITY>
</STATE>
Expected output:
<?xml version="1.0" encoding="UTF-8"?>
<world>
<COUNTRY id="USA" >
<STATE id="NEW JERSEY">
<CITY id="NEW YORK" method="modify">
<DISTRICT id="MANHATTAN" method="create">
<attributes>
<population>99 </population>
<temperature>78</temperature>
<income>15000</income>
<information>suburb of newyork</information>
</attributes>
</DISTRICT>
</CITY>
</STATE>
</COUNTRY>
</world>
Please help, I have just began XSLT and doing it in Perl or Python will takes hours.