Brent Johnson Escribio :-)
> 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">
> ${item.getName()},
> </jx:forEach>
Hi Brent,
you can use varStatus="status" for example:
<jx:forEach items="${location.getContainer()}" var="item"
varStatus="status">
...
then you can use the attributes of status: index, count, current, ...
see more in :
http://cocoon.apache.org/2.1/userdocs/flow/jxtemplate.html#forEach
Cheers,
Carlos Ch�vez.
> ----
>
> 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
> item.
>
> In XSLT you can achieve something similar by doing <xsl:if
> test="position() != last()">...</xsl:if>
>
> Thanks,
>
> - Brent
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
Carlos Ch�vez
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]