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

Another grouping question

Subject: Another grouping question
From: "William Jordan" <williamhjordan@xxxxxxxxxxx>
Date: Sat, 21 Aug 2004 00:53:56 +0000
william jordan
Sorry about this question. I know there have been many questions regarding grouping, but I for one am still not getting it.

Here is my problem.

I am using XSLT1.0

My data is in this format.

<type name="UNIT1">
  <kind name="DMI">
     <age name="2">
        <division name="SEC">9</division>
        <division name="HGT">4</division>
        <division name="KIU">12<division>
     </age>
     <age name="3">
        <division name="SEC">4</division>
        <division name="HGT">56</division>
        <division name="KIU">125<division>
     </age>
     <age name="5">
        <division name="SEC">61</division>
        <division name="HGT">316</division>
        <division name="KIU">83<division>
     </age>
  </kind>
  <kind name="TYD">
     <age name="3">
        <division name="SEC">8</division>
        <division name="HGT">71</division>
        <division name="KIU">948</division>
     </age>
     <age name="10">
        <division name="SEC">794</division>
        <division name="HGT">51</division>
        <division name="KIU">6</division>
     </age>
  </kind>
</type>
<type name="UNIT2">
  <kind name="POR">
     <age name="10">
        <division name="SEC">7</division>
        <division name="HGT">94</division>
        <division name="KIU">5</division>
     </age>
  </kind>
</type>


My xsl file should first sum all divisions, grouped by the number of days aged <age>. So, for the first table, the first row (0 - 3), records where age is between 0 and 3 should be included. For the second row, records where the age is between 4 and 5 should be included. All types are included in this first table.


The second table should include only those records where type = UNIT1. The rows will work the same (row 1 where age is between 0 and 3, etc...).

Same for the third table.

The output should be thus

ALL TYPES
AGE   DIV_TOTAL   SEC   HGT   KIU
0  3   1237           21      131     1085
4  5   460             61      316      83
6  10  957            801    145      11

TYPE UNIT1
AGE   DIV_TOTAL   SEC   HGT   KIU
0  3   210             13       60       137
4  5   460             61      316      83
6  10  957            794    51        6


TYPE UNIT2 AGE DIV_TOTAL SEC HGT KIU 0  3 0 0 0 0 4  5 0 0 0 0 6  10 106 7 94 5

I know everyone must be getting tired of grouping questions. I have read up on them and still don't get how to do them in XSLT.

Thanks in advance

Bill

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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.