Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Seems nice,
Have not tried it yet but it would be nice to have additional classes for the first and last item.
Ron
If umbraco doesn't have that; it should: +1
How do you mean? If listing items with xslt you just use the position() and count() functions to determine your position in an iteration.....
As Darren says, it's a simple thing to do in xslt using the position() and last() functions. I prefer last() but you could certainly use count() if you prefer.
The basic idea would be something like this...
<ul><xsl:for-each select="_something_here_"> <li> <xsl:choose> <xsl:when test="position() = 1"> <xsl:attribute name="class">first</xsl:attribute> </xsl:when> <xsl:when test="position() = last()"> <xsl:attribute name="class">last</xsl:attribute> </xsl:when> </xsl:choose> <xsl:value-of select="@nodeName" /> </li></xsl:for-each></ul>
The output for a loop of four items would be something like this...
<ul> <li class="first">item 1</li> <li>item 2</li> <li>item 3</li> <li class="last">item 4</li></ul>
cheers,doug.
Cool -- thanks for the tip -- just another square-peg php-approach to this elegant solution. I retract my +1.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Classes for first and last item
Seems nice,
Have not tried it yet but it would be nice to have additional classes for the first and last item.
Ron
If umbraco doesn't have that; it should: +1
How do you mean? If listing items with xslt you just use the position() and count() functions to determine your position in an iteration.....
As Darren says, it's a simple thing to do in xslt using the position() and last() functions. I prefer last() but you could certainly use count() if you prefer.
The basic idea would be something like this...
The output for a loop of four items would be something like this...
cheers,
doug.
Cool -- thanks for the tip -- just another square-peg php-approach to this elegant solution. I retract my +1.
is working on a reply...