[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Grouping and sorting using an unknown node name

Subject: Grouping and sorting using an unknown node name
From: "Trem Stamp" <trem@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 8 Oct 2002 08:41:09 +1000
unknown node
Hi,

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:

Cond
1993-01-11         165
1993-02-10         154

TP
1993-01-11         0
1993-02-10         465

Turb
1993-01-11         0
1993-02-10         23

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:

<Collection>
 <Group>
  <Reading>
   <Date>1993-02-10</Date>
   <SiteNumber>991001</SiteNumber>
   <Cond>
    <ordinate>154</ordinate>
   </Cond>
   <TP>
    <ordinate>465</ordinate>
   </TP>
   <Turb>
    <ordinate>23</ordinate>
   </Turb>
  </Reading>
 </Group>
 <Group>
  <Reading>
   <Date>1993-01-11</Date>
   <SiteNumber>991001</SiteNumber>
   <Cond>
    <ordinate>165</ordinate>
   </Cond>
   <TP>
    <ordinate>0</ordinate>
   </TP>
   <Turb>
    <ordinate>0</ordinate>
   </Turb>
  </Reading>
 </Group>
 ................
</Collection>

Thanks,

Trem



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.