[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

sorting in groups


Subject: sorting in groups
From: "Mattias Konradsson" <preacher@xxxxxxxxxxx>
Date: Fri, 31 Dec 1999 02:47:09 +0100

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



Current Thread
Keywords
xml