我有以下xml:
<main>
<cat>
<id>12</id>
<name>Pizza-Tuno</name>
<depends>
<depend>
<id>2</id>
<name>Tuno</name>
<type>Food</type>
</depend>
<depend>
<id>122</id>
<name>Knife</name>
<type>Tool</type>
</depend>
<depend>
<id>1123</id>
<name>Water</name>
<type>Food</type>
</depend>
<depend>
<id>417</id>
<name>Scissors</name>
<type>Tool</type>
</depend>
</depends>
</cat>
</main>
目前我有这个xsl:
<html>
<body>
Foods:
<ul>
<xsl:apply-tempaltes match="main/cat" />
</ul>
Tools:
<ul>
<xsl:apply-tempaltes match="main/cat" />
</ul>
</body>
</html>
<xsl:template match="main/cat">
<li>
<xsl:value-of select="name" />
</li>
</xsl:template>
我想要这个输出:
<html>
<body>
Foods:
<ul>
<li>Tuno</li>
<li>Water<li/>
</ul>
Tools:
<ul>
<li>Knife</li>
<li>Scissors</li>
</ul>
</body>
</html>
我怎么能用 xsl 做到这一点?元素应该除以元素..