This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Grouping on multiple nested elements
- From: PAUL DICKINSON <dickinson dot paul at abc dot net dot au>
- To: "XSL-List at lists dot mulberrytech dot com" <XSL-List at lists dot mulberrytech dot com>
- Date: Tue, 16 Jul 2002 17:29:21 +1000
- Subject: [xsl] Grouping on multiple nested elements
- A1-type: MAIL
- Alternate-recipient: prohibited
- Hop-count: 1
- Posting-date: Tue, 16 Jul 2002 17:47:08 +1000
- Reply-to: xsl-list at lists dot mulberrytech dot com
- Ua-content-id: C913IQD3T6HV
Dear all,
I have XML data like
<?xml version="1.0"?>
<data>
<story>
<story_id>589608</story_id>
<story_title>It's Only Human Nature</story_title>
<program_name>Science Show</program_name>
<transmission_date>20020629</transmission_date>
<description>What is human nature? Who really knows?</description>
<subjects>
<subject>Psychology</subject>
<subject>Health</subject>
<subject></subject>
<subject></subject>
<subject></subject>
<subject></subject>
<subject></subject>
<subject></subject>
</subjects>
</story>
<story>
<story_id>591325</story_id>
<story_title>Fins responsible for Hyshot crash</story_title>
<program_name>Science News</program_name>
<transmission_date>20020627</transmission_date>
<description>The failure of a set of fins on the launch rocket was likely
to be the cause of the Hyshot scramjet crash in October 2001, according to
the final report of the investigation released last week. The finding
clears the way for a second launch.</description>
<subjects>
<subject>Australian</subject>
<subject>Space</subject>
<subject>Engineering</subject>
<subject></subject>
<subject></subject>
<subject></subject>
<subject></subject>
<subject></subject>
</subjects>
</story>
<story>
<story_id>591756</story_id>
<story_title>Immunisation gets bad rap on internet</story_title>
<program_name>Science News</program_name>
<transmission_date>20020627</transmission_date>
<description>The internet has an abundance of websites that are negative
towards vaccination and tend to rely on unscientific evidence according to
two separate studies published this week.</description>
<subjects>
<subject>Australian</subject>
<subject>Health</subject>
<subject>Information Technology</subject>
<subject></subject>
<subject></subject>
<subject></subject>
<subject></subject>
<subject></subject>
</subjects>
</story>
</data>
(but more) and I am attempting to output stories grouped by their
subject(s) e.g.
Australian
story title
description
story title
description
...
Health
story title
description
...
Space
...
I have no problem grouping by program_name using the Muenchian method -
there is only one program_name for each story. However, grouping by subject
has me stumped - do I need multiple keys and how do I keep track of the
current subject?
Apologies if this has been covered previously but I have search the
archives in vain.
Regards
Paul Dickinson
ABC Online
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list