cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brent Johnson <>
Subject Jxtemplate forEach Variables
Date Wed, 04 Aug 2004 15:21:54 GMT
When looping in a JXTemplate using jx:forEach I can refer to the
current item as the variable specified in the var attribute.  Are
there any other variables I can access in this loop related to the
loop itself?  I'd like to be able to test an expression to find out if
I'm at the last item in the loop.  Here's an example:

List of items:
<jx:forEach items="${location.getContainer()}" var="item">

The problem with this is trivial I know - but doing this will result
in a string that ends with a comma.  I'd like to be able to test if
I'm at the end - so I can append a comma only when I'm not on the last

In XSLT you can achieve something similar by doing <xsl:if
test="position() != last()">...</xsl:if>


- Brent

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message