我有如下 XML 内容:
<details>
<name>Name 1</name>
<name>Name 2</name>
<name>Name 3</name>
<address>Address 1</address>
<address>Address 2</address>
<address>Address 3</address>
<address>Address 4</address>
....
</details>
我想得到如下输出:
<details>
<names>
<name>Name 1</name>
<name>Name 2</name>
<name>Name 3</name>
</names>
<addresses>
<address>Address 1</address>
<address>Address 2</address>
<address>Address 3</address>
<address>Address 4</address>
</addresses>
...
我尝试使用以下 XSL,但没有得到所需的输出:
<xsl:template match="address">
<addresses>
<xsl:for-each select="*">
<xsl:apply-templates/>
</xsl:for-each>
</addresses>
</xsl:template>