[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Grouping based on the sum of an attribute
Subject: Re: [xsl] Grouping based on the sum of an attribute From: David Carlisle <davidc@xxxxxxxxx> Date: Fri, 26 Jan 2007 17:58:39 GMT |
> 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Grouping based on the sum, Spencer Tickner | Thread | Re: [xsl] Grouping based on the sum, Spencer Tickner |
Re: [xsl] Grouping based on the sum, Spencer Tickner | Date | Re: [xsl] Grouping based on the sum, Spencer Tickner |
Month |