Re: [xsl] Grouping, Sorting on Aggegrated sum of the groupings, for Top XX Groupings

Subject: Re: [xsl] Grouping, Sorting on Aggegrated sum of the groupings, for Top XX Groupings
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Mon, 13 Jun 2005 20:38:54 -0700 (PDT)
Hello Darin,
  I have a collection of XSLT grouping problems at -
http://gandhimukul.tripod.com/grouping.html .. Hope it
might help you ;)

Regards,
Mukul

--- Darin <darind@xxxxxxxxx> wrote:

> I am using MSXML 4.0 running on an IIS 5.0 server
> running classic ASP.
> 
> I'm trying to transform the xml below grouped by the
> Id attribute, and sort
> (descending) on the aggregated sum(Value).  I'm also
> trying to limit the
> amount of groupings to 6, where the first 5
> groupings are the highest
> aggregated sum values, and the 6th grouping is an
> aggregation of the
> remaining groups.
> 
> Here is an example of the XML:
> 
> <x>
>     <y Id="1" Name="Label" Value="2151"/>
>     <y Id="2" Name="Label1" Value="2760"/>
>     <y Id="2" Name="Label1" Value="50"/>
>     <y Id="3" Name="Label2" Value="99"/>
>     <y Id="4" Name="Label3" Value="9"/>
>     <y Id="4" Name="Label3" Value="55"/>
>     <y Id="5" Name="Label4" Value="56"/>
>     <y Id="13" Name="Label5" Value="118"/>
>     <y Id="14" Name="Label6" Value="193"/>
>     <y Id="17" Name="Label7" Value="54"/>
>     <y Id="23" Name="Label8" Value="76"/>
>     <y Id="23" Name="Label8" Value="76"/>
>     <y Id="23" Name="Label8" Value="76"/>
>     <y Id="25" Name="Label9" Value="100"/>
> </x>
> 
> I would like the xml to look like:
> 
> <x>
> <!-- Summation of the Top 5 entries aggregated sum
> (Desc) -->
>     <y Id="2" Name="Label1" Value="2810"/>
>     <y Id="1" Name="Label" Value="2151"/>
>     <y Id="23" Name="Label8" Value="228"/>
>     <y Id="14" Name="Label6" Value="193"/>
>     <y Id="13" Name="Label5" Value="118"/>
> 
> <!-- Summation of the remaining entries -->
>     <y Id="" Name="Other" Value="373"/>
> 
> <!-- <y Id="3" Name="Label2" Value="99"/>
>     <y Id="4" Name="Label3" Value="64"/>
>     <y Id="5" Name="Label4" Value="56"/>
>     <y Id="17" Name="Label7" Value="54"/>
>     <y Id="25" Name="Label9" Value="100"/> -->
> </x>
> 
> 
> I have tried to use Keys and the XPath position
> function, but with no
> success.
> 
> Thanks in an advance for any help!
> 
> Darin
> 
> 



		
__________________________________ 
Discover Yahoo! 
Use Yahoo! to plan a weekend, have fun online and more. Check it out! 
http://discover.yahoo.com/

Current Thread