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

Grouping

Subject: Grouping
From: "Chris D'Iorio" <cdiorio@xxxxxxxxxxxx>
Date: Fri, 09 Feb 2001 23:04:41 -0500
chris d iorio
I've been banging my head against a brick wall for a few days now. Having seen the level of expertise here, and given my own preliminary stumblings in xml and xslt, I feel a little foolish trying to poach some assistance when I really ought to be studying more, but I don't seem to be able to find any answers. I'd be very grateful for any assistance with the following problem:

I have the following XML:

<newsbriefs>
<item>
<date>2001-02-08</date>
<title>Newsletter No. 14</title>
<category type="news"/>
<jurisdiction name="All"/>
<summary>The Regie des Rentes has released an English version of La Lettre No. 14, which discusses the changes brought about by Bill 102.</summary>
<source>
<link href="http://www.rrq.gouv.qc.ca/an/prive/lettrercr/lettre14.htm">Newsletter</link>
</source>
<news/>
<backgrounders/>
<progress>
<first_reading/>
<second_reading/>
<third_reading/>
<royal_assent/>
<in_force/>
</progress>
<subjects>
<subject_ref reference="pensions"/>
<subject_ref reference="governance"/>
</subjects>
</item>
<item>
<date>2001-02-09</date>
<title>Labour Force statistics</title>
<category type="news"/>
<jurisdiction name="All"/>
<summary>Employment was virtually unchanged in January. The unemployment rate edged up 0.1 percentage points to 6.9%.</summary>
<source>
<link href="http://www.statcan.ca/Daily/English/010209/d010209a.htm">StatsCan Daily</link>
</source>
<news/>
<backgrounders/>
<progress>
<first_reading/>
<second_reading/>
<third_reading/>
<royal_assent/>
<in_force/>
</progress>
<subjects>
<subject_ref reference="general"/>
</subjects>
</item>


Many of the <item>s in my file have multiple <subject_ref> tags. I'm trying (with no success) to find a way to group them by subject_ref/@reference, but with no luck. I've gone through the archives, and found reference to a solution by Steve Muench involving the use of keys. I've (very unsuccessfully) tried to make the following work:

<xsl:key name="group" match="subject_ref" use="@reference"/>

[...]

<xsl:for-each select="//subject_ref[generate-id(.)=generate-id(key('group', @reference)[1])]">

[...]

Do I have a problem because of the fact that I have more than one <subject_ref > child for many of the <subjects> nodes in my xml?

I would really appreciate any pointers on how to make this work.

Chris D'Iorio
inRatio Inc.


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



Current Thread
  • Grouping
    • Chris D'Iorio - Fri, 9 Feb 2001 23:06:20 -0500 (EST) <=

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.