如何在xsl中应用模板中仅在最后一个兄弟元素之后创建div元素?



我试图仅在最后一个兄弟节点之后创建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>

请帮帮我,提前谢谢你

你就不能直接:

<xsl:template match="kingdom">
<xsl:apply-templates select="Mammal/Lion"/>
<div>All mamals are printed</div>
</xsl:kingdom>

最新更新