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

RE: sorting by maximum value of multiple nodes

Subject: RE: sorting by maximum value of multiple nodes
From: cknell@xxxxxxxxxx
Date: Wed, 08 Feb 2006 15:53:43 -0500
sort multiple nodes
XSLT 1.0 or XSLT 2.0?
-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Billie <whynot77@xxxxxxxxxxxx>
Sent:     Wed, 8 Feb 2006 13:09:52 -0500
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:   sorting by maximum value of multiple nodes

Hi everyone,
What I'd like to do is sort a list by the maximum value of a node that may
appear multiple times.  I think I'll do much better explaining this in code
rather than words, so here is the XML:

<employees>
	<employee>
		<firstName>Joe</firstName>
		<lastName>Black</lastName>
		<Patent>
			<date>2005-10-13</date>
			<id>65-AHK</id>
		</Patent>
		<Patent>
			<date>2006-01-03</date>
			<id>65-AHK</id>
		</Patent>
		<Patent>
			<date>2004-08-24</date>
			<id>65-AHK</id>
		</Patent>
	</employee>
	<employee>
		<firstName>Jane</firstName>
		<lastName>Doe</lastName>
		<Patent>
			<date>2005-11-18</date>
			<id>65-AHK</id>
		</Patent>
		<Patent>
			<date>2006-01-19</date>
			<id>65-AHK</id>
		</Patent>
	</employee>
<employees>

I'm looking to sort this list by which employee has the most recent Patent, so
in this case, Jane Doe would be first because her most recent Patent has a
date of 2006-01-19 and Joe Black's most recent Patent has a date of 2006-01-03.

So I would want the XSL to be something like:
<xsl:apply-templates select="employee">
	<xsl:sort>
		(what do I do here?)
	</xsl:sort>
</xsl:apply-templates>

Thanks for any help!

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

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-2007 All Rights Reserved.