Im using XSLT to build a list of select products. They are shown in rows of three. I want to add a class to the right most (third) box in each row to remove the right margin. Any ideas how I can do this? Im really new to XSLT.
Asked
Active
Viewed 377 times
1
-
2see http://stackoverflow.com/questions/3806578/xsl-for-each-add-code-block-every-n-rows – ax. Mar 19 '11 at 15:10
-
all these sequence partitions follow the same pattern as making a table of N columns. Example http://stackoverflow.com/questions/2355952/xslt-rendering-a-node-sequence-as-m-x-n-table . Others: http://www.google.com/search?q=site%3Astackoverflow.com+xslt+list+into+table – Mar 19 '11 at 15:10
-
ax: care to put that in as an answer so I can give you credit. – Elad Lachmi Mar 20 '11 at 06:15
1 Answers
1
Here is a solution I got from the Umbraco forum. Can't take credit for it, but I'm posting it for future reference.
<xsl:for-each select="$currentPage/child::* [@isDoc]">
<div class="something">
<xsl:if test="position() mod 3 = 0">
<xsl:attribute name="class">something someotherclass</xsl:attribute>
</xsl:if>
Content of div
</div>
</xsl:for-each>

Elad Lachmi
- 10,406
- 13
- 71
- 133