This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Adding numbers in xsl loop
I wrote:
> In your case, you want to iterate over a set of projects and add the
> associated durations to an ongoing total. You can do this with a
> recursive template such as the following:
Or of course just use:
<xsl:variable name="projects"
select="projects/project[medewerker[login = $loginMatch]]/name" />
<xsl:value-of
select="sum(hours/entry[projectname = $projects]
[login = $loginMatch]
[date/year=$jaarX]
[date/month=$maandX]/duration)" />
Perhaps using a key for the entries:
<xsl:key name="entries" match="entry" use="projectname" />
and then do:
sum(key('entries', $projects)[login = $loginMatch]
[date/year=$jaarX]
[date/month=$maandX]/duration)
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list