Re: [xsl] Grouping (yet again)

Subject: Re: [xsl] Grouping (yet again)
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 19 Feb 2002 17:55:21 +0000
Hi Steven,

> all-in-all, it looks pretty well, but something is wrong with the
> grouping...: the numbers are completely incorrect :-(

Well, you're generating one datum element per dir per week per group.
The value attribute of the datum element for that particular
dir/week/group is the value of the value attribute of the *first*
datum element in the source document with that dir/week/group.

You don't say what's wrong with the numbers (aside from being
incorrect) but I'm guessing that you want that value to be the sum of
all the value attributes of the datum elements with the same
dir/week/group? In that case, you need to generate it with:

  <datum dir="{@dir}"
    value="{sum(key('datum-groupyearweekdir',
                    concat(@group, '-', @year, '-', @week, '-', @dir))
                  /@value)}" />

In the description you also say that you want the datum for each week
to include a total attribute that holds the sum of the value
attributes for that week. You don't currently have that in your
stylesheet, but it will follow the same pattern as above.

If that isn't what's wrong with the numbers, do post again with more
details.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread