Subject: RE: [xsl] Sorted headers of multiple occurance child nodes From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Wed, 14 Sep 2005 16:11:21 +0100 |
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: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Sorted headers of multipl, David Carlisle | Thread | Re: [xsl] Sorted headers of multipl, Brian Huntington |
RE: [xsl] Quick QUestion, Michael Kay | Date | RE: [xsl] Making extension function, JBryant |
Month |