开发者

Several questions about xslt position()

I have a code

<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>

This crutch <xsl:when test="position() = 1 or position() = 4 or position() = 7 or position() = 10"> works, but I would like more process automatisat开发者_JAVA技巧ion. If there's any method of position() to make every 3rd element takes attributes?


answer for my question was to simple.

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜