我是XSLT的新手,我需要帮助将两个不同的XML文档合并为一个。使用XSLT合并两个diff XMLS(1.0)
XML1.xml
<customers>
<customer>
<Person name="Ram" Id="101"/>
<address>flat 4</address>
</customer>
<customer>
<Person name="Raghav" Id="102"/>
<address>flat 9</address>
</customer>
</customers>
XML2.xml
<Products>
<Product>
<name>Onida Tv</name>
<consumer>Ram</consumer>
</Product>
<Product>
<name>washing machine</name>
<consumer>Ram</consumer>
</Product>
<Product>
<name>Water purifier</name>
<consumer>Raghav</consumer>
</Product>
<Product>
<name>iPhone</name>
<consumer>Raghav</consumer>
</Products>
</Products>
希望的XML输出:
<customers>
<customer>
<Person name="Ram" Id="101"/>
<address>flat 4</address>
<products>
<name>washing machine</name>
<name>Onida TV</name>
</products>
</customer>
<customer>
<Person name="Raghav" Id="102"/>
<address>flat 9</address>
<products>
<name>iPhone</name>
<name>Water purifier</name>
</products>
</customer>
</customers>
第二XML将被认为是在该上下文中外部。我需要为每个客户添加相应的产品。我怎样才能做到这一点?
请注明XSLT 1.0或2.0。 - 注意:“Ram”与“Ram”不同;你确定这就是你的数据看起来的样子吗? – 2014-09-03 09:28:20
第二次看,它不可能,因为它不是格式良好。这个''不是XML。 –
2014-09-03 09:35:43
嗨@ michael.hor257k,我已更新查询 – user3698644 2014-09-03 10:36:12