Output an image inside xsl:for-each, every iteration except the last one
Greetings all,
I'd like to output an image from my xslt script for every iteration of an xsl:for-each loop, except for the last iteration. Is there a way to "do something different" through some kind of an if-test, to see if we're in the last iteration of an xsl:for-each loop?
Output an image inside xsl:for-each, every iteration except the last one
Greetings all,
I'd like to output an image from my xslt script for every iteration of an xsl:for-each loop, except for the last iteration. Is there a way to "do something different" through some kind of an if-test, to see if we're in the last iteration of an xsl:for-each loop?
Here's the pseudo-code:
<xsl:for-each select="$currentPage/node [string(data [@alias='umbracoNaviHide']) != '1']">
<!-- output an image here for every iteration of the loop, except for the last one! -->
</xsl:for-each>
Thanks in advance for your suggestions.
-NorthK
Hi North,
You can just exclude the last item from the processing by adding another predicate:
(Also, in XSLT it's more common to use not(something = value) instead of something != value)
/Chriztian
Guys,
Thanks a lot for taking the time to answer-- your suggestions worked perfectly!
-NorthK
is working on a reply...