[xsl] Sorted headers of multiple occurance child nodes

Subject: [xsl] Sorted headers of multiple occurance child nodes
From: Brian Huntington <bhuntington@xxxxxxx>
Date: Wed, 14 Sep 2005 10:20:02 -0400
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:

	<author>Mr. Jones</author>
	<title>An article by Mr. Jones</title>
	<journalTitle>Journal of Oceanography</journalTitle>
	<author>Ms. Smith</author>
	<title>An article by Ms. Smith</title>
	<journalTitle>Oceanic Reviews</journalTitle>
	<author>Mr. Turner</author>
	<title>An article by Mr. Turner</title>
	<journalTitle>Journal of Volcanology</journalTitle>
	<author>Dr. Love</author>
	<title>An article by Dr. Love</title>
	<journalTitle>Modern Psychology</journalTitle>
	<author>Ms. Walker</author>
	<title>An article by Ms. Walker</title>
	<journalTitle>Volcanos and Stuff</journalTitle>

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.

<h1>Table of Contents</h1>
<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>
<p>Dr. Love, <b>An article by Dr. Love</b>, <i>Modern Psychology</i></p>
<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>

Again, any help would be mucho appreciated.
Brian Huntington

Current Thread