[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Sorted headers of multiple occurance child nodes
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|