xsl-list
[Top] [All Lists]

Re: [xsl] Grouping based on the sum of an attribute

2007-01-26 11:10:59
Thanks for the correction and explanation. Much appreciated.

Spencer

On 1/26/07, David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:

> Unreal David,, Thanks so much.

of course it would be even better if it gave the right answer.

use:

group-by="(sum((@cols,preceding-sibling::*/@cols))-1) idiv $tcols">




There were two mistakes in the first

I forgot the -1 (actually I didn't forget but it gave the right answer
on your test case, so i didn't think about it) The reaon that it
gave teh right answer in teh test case is interesting (if you are
interested in that sort of thing:-)

I used
sum(@cols,preceding-sibling::*/@cols)
instead of
sum((@cols,preceding-sibling::*/@cols))
which means that instead of summing the sequence of this @col and teh
earlier ones, it instead called the function sum with two arguments
first @col and second the earlier '@col.

You (or at least I) might have expected the two argument sum to be an
error, but before complaining to Michael that i got no warning, I
checked the spec and was reminded of the optional second argument that
allows you to specify a sum of an empty sequence.


David

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>