我需要使用 XPATH 和 XSLT 以某种特定方式从 XML 中提取数据
<data>
<person id="p1">
<name>User1</name>
</person>
<person id="p2">
<name>User2</name>
</person>
<person id="p3">
<name>User3</name>
</person>
<employee eid="emp1" pid="p1">
<dept>dept1</dept>
</employee>
<employee eid="emp2" pid="p3">
<dept>dept3</dept>
</employee>
<employee eid="emp3" pid="p2">
<dept>dept1</dept>
</employee>
</data>
从上面的示例中,我需要在输出 xml 中使用 Person 和相应的 Employee 元素创建每个 XML。这两个xml之间的链接是
person.id = 员工.pid
像 XML1:
<person id="p1">
<name>User1</name>
</person>
<employee eid="emp1" pid="p1">
<dept>dept1</dept>
</employee>
XML2:
<person id="p2">
<name>User2</name>
</person>
<employee eid="emp3" pid="p2">
<dept>dept1</dept>
</employee>
XML3:
<person id="p3">
<name>User3</name>
</person>
<employee eid="emp2" pid="p3">
<dept>dept3</dept>
</employee>
我尝试了很多方法,但无法做到这一点。
谢谢...