Re: [xsl] Adding numbers in xsl loop

Subject: Re: [xsl] Adding numbers in xsl loop
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 25 Jun 2002 12:27:43 +0100
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


Current Thread