You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Wim Deblauwe <wi...@gmail.com> on 2005/06/15 17:07:09 UTC

How do I add 2 numbers in jelly?

Hi,

I can't find a good jelly resource anywhere on the net, so I hope this
list might help me out.
Consider this jelly fragment:

<x:forEach var="passRate"
select="//aggregator[@name='junitpassrate'][not(text()='-')][text()]">
    <x:set var="passrateValue" select="substring-before(text(), ' %')"/>
    <echo>passrateValue: ${passrateValue}</echo>

    Need to do an addition of all passrateValue values in a variable    

</x:forEach>

//Do some further calculation with the total here


How can I do this addition in jelly?

regards,

Wim

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


Re: How do I add 2 numbers in jelly?

Posted by Wim Deblauwe <wi...@gmail.com>.
It works now. The problem was that one of my variables was a string,
not a number. Using the XPath function 'number()' solved this.

2005/6/15, Wim Deblauwe <wi...@gmail.com>:
> I'll check out the resource tomorrow for more info. I already tried
> the statement you say, but it did not seem to work.
> 
> 2005/6/15, Kenney Westerhof <fo...@neonics.com>:
> > On Wed, 15 Jun 2005, Wim Deblauwe wrote:
> >
> > See http://jakarta.apache.org/commons/jexl/reference/syntax.html,
> > jexl is Java Expression Language, the default scripting language used in
> > jelly. You can use <j:set var="sum" value="${ sum + passRateValue }"/> or
> > something.
> >
> > > Hi,
> > >
> > > I can't find a good jelly resource anywhere on the net, so I hope this
> > > list might help me out.
> > > Consider this jelly fragment:
> > >
> > > <x:forEach var="passRate"
> > > select="//aggregator[@name='junitpassrate'][not(text()='-')][text()]">
> > >     <x:set var="passrateValue" select="substring-before(text(), ' %')"/>
> > >     <echo>passrateValue: ${passrateValue}</echo>
> > >
> > >     Need to do an addition of all passrateValue values in a variable
> > >
> > > </x:forEach>
> > >
> > > //Do some further calculation with the total here
> > >
> > >
> > > How can I do this addition in jelly?
> > >
> > > regards,
> > >
> > > Wim
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> > --
> > Kenney Westerhof
> > http://www.neonics.com
> > GPG public key: http://www.gods.nl/~forge/kenneyw.key
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>

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


Re: How do I add 2 numbers in jelly?

Posted by Wim Deblauwe <wi...@gmail.com>.
I'll check out the resource tomorrow for more info. I already tried
the statement you say, but it did not seem to work.

2005/6/15, Kenney Westerhof <fo...@neonics.com>:
> On Wed, 15 Jun 2005, Wim Deblauwe wrote:
> 
> See http://jakarta.apache.org/commons/jexl/reference/syntax.html,
> jexl is Java Expression Language, the default scripting language used in
> jelly. You can use <j:set var="sum" value="${ sum + passRateValue }"/> or
> something.
> 
> > Hi,
> >
> > I can't find a good jelly resource anywhere on the net, so I hope this
> > list might help me out.
> > Consider this jelly fragment:
> >
> > <x:forEach var="passRate"
> > select="//aggregator[@name='junitpassrate'][not(text()='-')][text()]">
> >     <x:set var="passrateValue" select="substring-before(text(), ' %')"/>
> >     <echo>passrateValue: ${passrateValue}</echo>
> >
> >     Need to do an addition of all passrateValue values in a variable
> >
> > </x:forEach>
> >
> > //Do some further calculation with the total here
> >
> >
> > How can I do this addition in jelly?
> >
> > regards,
> >
> > Wim
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> 
> --
> Kenney Westerhof
> http://www.neonics.com
> GPG public key: http://www.gods.nl/~forge/kenneyw.key
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
>

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


Re: How do I add 2 numbers in jelly?

Posted by Kenney Westerhof <fo...@neonics.com>.
On Wed, 15 Jun 2005, Wim Deblauwe wrote:

See http://jakarta.apache.org/commons/jexl/reference/syntax.html,
jexl is Java Expression Language, the default scripting language used in
jelly. You can use <j:set var="sum" value="${ sum + passRateValue }"/> or
something.

> Hi,
>
> I can't find a good jelly resource anywhere on the net, so I hope this
> list might help me out.
> Consider this jelly fragment:
>
> <x:forEach var="passRate"
> select="//aggregator[@name='junitpassrate'][not(text()='-')][text()]">
>     <x:set var="passrateValue" select="substring-before(text(), ' %')"/>
>     <echo>passrateValue: ${passrateValue}</echo>
>
>     Need to do an addition of all passrateValue values in a variable
>
> </x:forEach>
>
> //Do some further calculation with the total here
>
>
> How can I do this addition in jelly?
>
> regards,
>
> Wim
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key

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