RE: [xsl] Grouping by attribute values

Subject: RE: [xsl] Grouping by attribute values
From: cknell@xxxxxxxxxx
Date: Tue, 01 Mar 2005 08:49:40 -0500
Go to this URL ( and get this document: - Overcoming decades old legacy systems with XSLT and Muenchian grouping .
Charles Knell
cknell@xxxxxxxxxx - email

-----Original Message-----
From:     Josh Taylor <jktylr@xxxxxxxxxxx>
Sent:     Tue, 01 Mar 2005 09:38:16 -0400
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  [xsl] Grouping by attribute values

I have the following problem. My XML is structured in the following way:

<?xml version="1.0" encoding="UTF-8"?>
<ratePremiums rateDate="20041001" territory="100" type="1">
<coverage id="Liability">
  <premium class="1" drivingRecord="0" 
  <premium class="1" drivingRecord="0" 
  <premium class="1" drivingRecord="1" 
  <premium class="1" drivingRecord="1" 
  <premium class="12" drivingRecord="2" limit="200">0.0</premium>
  <premium class="12" drivingRecord="2" limit="300">0.0</premium>

I need to display premiums grouped first by class, then by driving record 
and then by limit in
HTML tables.

So a table for each class, a row for each driving record and a column for 
each limit (much like an engineering table).

To elaborate: Desired output for the snipet above is:
Class 1:
  <tr><th></th><th>200 K</th><th>300 K</th></tr>
  <tr><td>DR = 
  <tr><td>DR = 
... etc.

I have no idea how to loop through the premiums, isolated a unique class to 
create a table. Then for that class loop through unique driving record 
values and display the premiums according to limit.

I do not want to structure my XML with this table view in mind.

Thank you for your time!

- Josh Taylor

Current Thread