[XSL-LIST Mailing List Archive Home]
[xsl] Grouping and sorting using an unknown node name
Subject: [xsl] Grouping and sorting using an unknown node name|
From: "Trem Stamp" <trem@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 8 Oct 2002 08:41:09 +1000
I have been looking on various sites for ideas on the best way to do some
grouping/sorting, and I'm unsure of the best way to tackle it.
I've looked at the xsl:key but am not sure that this is appropriate for what
I'm doing. The problem is that I have an unknown number of
element readings with unknown names (see example below), which means I don't
see how I can define an xsl:key. For example, the readings
below contain Cond,TP and Turb. The xml to be styled will vary (ie. there
may be less than these or more with names that cannot be known beforehand),
although all elements will have a child node called <ordinate>.
What I need to be able to do is group by the reading type (in alphabetical
order), and for each reading type values, they need to be in date order.
So for example the result would be:
I'm thinking along the lines of finding out how many reading types there are
per reading (ie. in this case 3), and then for each reading
call a template which selects the first node of each reading which has an
ordinate value and repeat till n. I don't know whether this is the way to go
about this and still not sure of how to group by date in this instance.
Any advice would be much appreciated.
I'm using a Saxon windows binary processor
I have the following sample xml:
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list