Re: sorting in groups

Subject: Re: sorting in groups
From: Steve Tinney <stinney@xxxxxxxxxxxxx>
Date: Fri, 31 Dec 1999 01:13:19 -0500
This is a known issue in XSLT 1.0.  Take a look through the xsl-list
archives for a variety of solutions, or if you can use Saxon
check out its grouping extension.

 Steve

Mattias Konradsson wrote:
> 
> I have something of a dilemma, I have an xml structure something like this
> 
> <root>
>         <item  category="" type="" date=""></item>
> <root>
> 
> and I want to show all the items in a list, the problem is that I want to
> sort it alphabetically or by date and grouped either by category
> or type so one list might look like this (grouped by category,
> alphabetically )
> 
> Category A
>     Item A
>     Item B
>     Item C
> 
> Category B
>     Item A1
>     Item B1
>     Item C1
> 
> or by type (alphabetically):
> 
> Type A
>     Item A
>     Item B
>     Item C
> 
> Type B
>     Item A1
>     Item B1
>     Item C1
> 
> So I need to make an stylesheet that first picks out all items in one
> category (or type), sorts them after your chosing, then picks the next
> cateogry or type. If I made a tree like this instead of a flat one it
> wouldnt be problem
> 
> <root>
>     <category name="">
>                 <type="" date=""></item>
>     </category name="">
> </root>
> 
> but then again, if I need to group by type then it wouldn't work because
> then the hierarchy would be under type, not category.
> 
> Is there any good way of doing this, and not have to hardcode category and
> type names into the stylesheet? If I'm being
> unclear about what I want to do then please ask me to clarify further. Any
> help would be deeply appreciated.
> 
> Regards
> ------------------
> Mattias  Konradsson
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-- 
----------------------------------------------------------------------
Steve Tinney                                        Babylonian Section
                                 *   University of Pennsylvania Museum
stinney@xxxxxxxxxxxxx                          Phila, PA. 215-898-4047


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


Current Thread