【发布时间】:2018-10-31 05:50:23
【问题描述】:
我正在使用 XSLT 将 XML 文档转换为具有更多意义的新 XML 文档。 源 XML:
<root>
<A>
<country>Italy</country>
<city>Rome</city>
<score>13</score>
</A>
<A>
<country>Italy</country>
<city>Florence</city>
<score>14</score>
</A>
<A>
<country>France</country>
<city>Paris</city>
<score>20</score>
</A>
</root>
节点<country>、<city> 和<score> 都是兄弟节点。
我的问题是:如何在 XSLT 中像这样重新排列兄弟姐妹?
<country>
<city>
<score>
</score>
</city>
</country>
我期望的 XML:
<root>
<Italy>
<Rome>
<score>13</score>
</Rome>
<Florence>
<score>14</score>
</Florence>
</Italy>
<France>
<Paris>
<score>20</score>
</Paris>
</France>
</root>
【问题讨论】:
-
你可以使用 XSLT-2.0 吗?
-
@zx485 是的。谢谢你的回答。