Came up against this today, and here's the hack I came up with. You'd probably still need to add the odd/even classes, but this will help wrap two items within a div
Does this still work in 4.5.1 ? I keep getting errors ...
my code:
<!-- The fun starts here --> <div id="companyValues"> <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']"> <div class="companyValueItem"> <xsl:if test="number(position()) mod 2 != 0"> a </xsl:if> <xsl:if test="number(position()) mod 2 = 0"> b </xsl:if>
Odd /Even using position
I have a requirement to display content in a Z fashion, e.g. Row 1, item 1 on left item 2 on right; Row 2 , item 3 on left , item 4 on right.
For this to work I am thinking I need to use XSLT's IF condition checking for odd/even number - what would be the syntax for this? some kind of
IF position() mod 2 = 0 or something? - not sure how to do this with XSLT
you use something like this:
>Tommy
Is there any examples that do what I want e.g
1 >>> 2
3 >>> 4
5 >>> 6
The DIVs I am forced to use are
<Div class="row>
<div class="first">1</div>
<div>2</div>
</div>
Next row etc..
I feel I am nearly there with the postition but strugliing with how best to do this.
out of my head it would be :
>Tommy
aah, sorry, I did not read your post correctly - the previous example was a generic example
I suppose this thread will help you out on the divs
>Tommy
Came up against this today, and here's the hack I came up with. You'd probably still need to add the odd/even classes, but this will help wrap two items within a div
Does this still work in 4.5.1 ? I keep getting errors ...
my code:
My error:
Nevermind, there was a different error in the xslt somewhere
The following snippet can be used to set the class to odd or even
is working on a reply...