我需要在这两个节点合并MANHATTAN:
因为我们的系统规则如下:
“CREATE A + MODIFY A”仍然是“ 创建一个与所述合并后的属性”
输入文件:
<?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>
预期输出:
<?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>
请帮帮忙,我刚开始XSLT和Perl中做或Python将需要数个小时。