0

我试图仅在最后一个兄弟节点之后创建一个 div 元素。这是我的xml代码

<Mammal>
<Lion>34</Lion>
<Lion>56</Lion>
<Lion>67</Lion>
</Mammal>

用于此的 xsl 代码,

<xsl:template match="kingdom">
<xsl:apply-templates select="Mammal/Lion"></xsl:apply-templates>
</xsl:kingdom>

<xsl:template match="Mammal/Lion">
<!-- I need an xsl test here to check if a sibling is the last -->
<div>All mamals are printed</div>
<!-- End of test-->
</xsl:template>

请帮助我,提前谢谢你

4

1 回答 1

0

你不能简单地做:

<xsl:template match="kingdom">
    <xsl:apply-templates select="Mammal/Lion"/>
    <div>All mamals are printed</div>
</xsl:kingdom>
于 2021-10-18T18:24:37.550 回答