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/16 09:00:14 UTC

JEXL arithmatic strangeness

Hi,

does somebody know why division does not work in JEXL? I have the
following fragment:

<x:set var="nrOfProjects"
select="count(//aggregator[@name='junitpassrate'][not(text()='-')][text()])"/>
<x:forEach var="passRate"
select="//aggregator[@name='junitpassrate'][not(text()='-')][text()]">
    <x:set var="passrateValue" select="number(substring-before(text(), ' %'))"/>
    <j:set var="passrateTotal" value="${passrateTotal + passrateValue}"/>
    <echo>total: ${passrateTotal}</echo>
</x:forEach>
<echo>total: ${passrateTotal}</echo>
<echo>nrOfProjects: ${nrOfProjects}</echo>
<j:set var="averagePassrate" value="${passrateTotal / nrOfProjects}"/>
<p>Average pass rate (not-weighed): </p>
<echo>${averagePassrate}</echo>
<j:set var="averagePassrate2" value="${passrateTotal * nrOfProjects}"/>
<echo>${averagePassrate2}</echo>

The variable 'averagePassrate' is empty somehow. However when I change
the division ('/') by multiplification or addition or subtraction, the
math is performed correctly. Any ideas?

regards,

Wim

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