我需要合并两个节点MANHATTAN:
因为我们的系统规则如下:
"CREATEA+MODIFYA"仍然是"具有合并属性的CREATEA"
输入文件:
<?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做它需要几个小时。
从类似问题中调整解决方案,即如何合并具有";同一个父亲";,相同的方法和相同的id=0(使用XSLT)?
阅读解决方案,了解分组的工作原理,然后相应地更改分组键。