You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Johannes Becker <jo...@gmx.net> on 2005/07/12 14:46:34 UTC

JXTemplate - Incrementing value of variable in a loop

Hi,

I want to increment the value of a variable in a <jx:forEach>-loop. In my
case, I want to increment the variable "total" with the "quantity"-element
(from item).

<jx:set var="total" value="0"/>
<jx:forEach select="#{item}">
	???	#{total} +=  #{quantity}   ???		
</jx:forEach>

Is there a way to do this? Or a workaround?

Thanks
Jonny

-- 
5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
+++ GMX - die erste Adresse f�r Mail, Message, More +++

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JXTemplate - Incrementing value of variable in a loop

Posted by Upayavira <uv...@odoko.co.uk>.
Johannes Becker wrote:
> Hi,
> 
> I want to increment the value of a variable in a <jx:forEach>-loop. In my
> case, I want to increment the variable "total" with the "quantity"-element
> (from item).
> 
> <jx:set var="total" value="0"/>
> <jx:forEach select="#{item}">
> 	???	#{total} +=  #{quantity}   ???		
> </jx:forEach>
> 
> Is there a way to do this? Or a workaround?

See http://cocoon.apache.org/2.1/userdocs/flow/jxtemplate.html#forEach
(esp begin, step, end attributes).

Never used them, I assume they work.

Upayavira

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org