关于xslt position()的几个问题



我有代码

<xsl:choose>
<xsl:when test="position() = 1 or position() = 4 or position() = 7 or position() = 10">
<xsl:attribute name="class">gallery-content gallery-content-large fadeInUpBig wow</xsl:attribute>
</xsl:when>
<xsl:when test="position() mod 2 = 0">
<xsl:attribute name="class">gallery-content gallery-content-small fadeInLeftBig wow</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="class">gallery-content gallery-content-small fadeInRightBig wow</xsl:attribute>
</xsl:otherwise>
</xsl:choose>

这个拐杖<xsl:when test="position() = 1 or position() = 4 or position() = 7 or position() = 10">工作,但我想要更多的过程自动化。如果有位置()的任何方法,使每3个元素采取属性?

回答我的问题太简单了。

position() = 1 or position() mod 3 = 1

最新更新