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

RE: Sorted headers of multiple occurance child nodes

Subject: RE: Sorted headers of multiple occurance child nodes
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 14 Sep 2005 16:11:21 +0100
mr and ms smith download
This looks like a standard grouping problem: use Muenchian grouping as per
http://www.jenitennison.com/xslt/grouping

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Brian Huntington [mailto:bhuntington@xxxxxxx] 
> Sent: 14 September 2005 15:20
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Sorted headers of multiple occurance child nodes
> 
> Using Saxon 6.5.2 to process XSLT 1.1
> 
> I would like to write sorted headers of /record/node values 
> whose values 
> may occur more than once in a document. I'm having a pretty 
> tough go of 
> conceptualizing how to accomplish this. I've checked the xsl-list 
> archives, and other online resources, but I haven't found anything 
> usefull. Any advice would be much appreciated.
> 
> Here's dummy XML source, to demonstrate the challenge:
> 
> <tableOfContents>
> <record>
> 	<author>Mr. Jones</author>
> 	<title>An article by Mr. Jones</title>
> 	<journalTitle>Journal of Oceanography</journalTitle>
> 	<subject>Oceanography</subject>
> </record>
> <record>
> 	<author>Ms. Smith</author>
> 	<title>An article by Ms. Smith</title>
> 	<journalTitle>Oceanic Reviews</journalTitle>
> 	<subject>Oceanography</subject>
> </record>
> <record>
> 	<author>Mr. Turner</author>
> 	<title>An article by Mr. Turner</title>
> 	<journalTitle>Journal of Volcanology</journalTitle>
> 	<subject>Volcanology</subject>
> </record>
> <record>
> 	<author>Dr. Love</author>
> 	<title>An article by Dr. Love</title>
> 	<journalTitle>Modern Psychology</journalTitle>
> 	<subject>Psychology</subject>
> </record>
> <record>
> 	<author>Ms. Walker</author>
> 	<title>An article by Ms. Walker</title>
> 	<journalTitle>Volcanos and Stuff</journalTitle>
> 	<subject>Volcanology</subject>
> </record>
> </tableOfContents>
> 
> The objective is to produce the following output. Markup and 
> whitespace 
> are incidental, I'm concerned with outputting headers and 
> sorting on the 
> subject node value, where the value may occur multiple times in the 
> input XML.
> 
> <html>
> <h1>Table of Contents</h1>
> <h2>Oceanography</h2>
>    <p>Mr. Jones, <b>An article by Mr. Jones</b>, <i>Journal of 
> Oceanography</i></p>
>    <p>Ms. Smith, <b>An article by Ms. Smith</b>, <i>Oceanic 
> Reviews</i></p>
> <h2>Psychology</h2>
>    <p>Dr. Love, <b>An article by Dr. Love</b>, <i>Modern 
> Psychology</i></p>
> <h2>Volcanology</h2>
>    <p>Mr. Turner, <b>An article by Mr. Turner</b>, <i>Journal of 
> Volcanology</i></p>
>    <p>Ms. Walker, <b>An article by Ms. Walker</b>, <i>Volcanos and 
> Stuff</i></p>
> </html>
> 
> Again, any help would be mucho appreciated.
> Brian Huntington

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.