commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Libbrecht <>
Subject Re: [Jelly] xml:forEach, core:forEach and varStatus?
Date Wed, 12 Nov 2003 08:22:35 GMT

On Mercredi, nove 12, 2003, at 01:13 Europe/Paris, Bill Keese wrote:

> I suspect you can use position() but I haven't tried it.
> <xml:expr select="position()"/>

Only in super-restricted XPath expressions.

Marcus, <x:forEach select=""> needs an XPath expression which 
definitely not as powerful as jexl expression (but is also much more 

It is easy to make the same loop with an j:for I think:

<x:set var="myNodes" select="$elt//xyz"/>
<j:forEach items="${myNodes}" var="node">

To get explore these kinds of things, you simply attempt to go a bit 
deeper in the java "realities" behind Jelly (which is really 
java-hooked) using something like <j:log>${myNodes.getClass()}</j:log> 
and so on...
In this case, you should have gotten a java.util.List.

Tell me if it works for you.


> Marcus Crafter wrote:
>> Hi All,
>> Hope all is well.
>> Was just wondering, one of the differences between the core:forEach 
>> tag
>> and the xml:forEach tag as far as 'for-loop' functionality goes, is 
>> the
>> 'varStatus' attribute which is available on the core tag (but not on 
>> the
>> xml tag).
>> Is there any way to achieve the same functionatlity on the xml tag? 
>> ie.
>> have an integer index available, into the set being iterator over? 
>> Some
>> xpath wizardry perhaps?
>> Thoughts/comments/etc all appreciated.
>> Cheers,
>> Marcus
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message