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

Re: Re: sorting by maximum value of multiple nodes

Subject: Re: Re: sorting by maximum value of multiple nodes
From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx>
Date: Thu, 9 Feb 2006 22:43:14 +0530
xslt maximum
Hi Billie,
   Please find below the XSLT 1.0 solution. I have used the node-set
extension function, which is usually available in popular XSLT
processors, namely Saxon and Xalan. I don't know which XSLT processor
you are using.

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                       xmlns:common="http://exslt.org/common"
                       version="1.0">

<xsl:output method="text" />

<xsl:template match="/employees">
   <xsl:variable name="rtf">
     <xsl:for-each select="employee">
       <employee>
         <xsl:copy-of select="*[not(self::Patent)]" />
         <xsl:for-each select="Patent">
           <xsl:sort select="translate(date,'-','')"
order="descending" data-type="number" />
           <xsl:copy-of select="." />
         </xsl:for-each>
       </employee>
     </xsl:for-each>
   </xsl:variable>

   <xsl:apply-templates select="common:node-set($rtf)/employee">
     <xsl:sort select="translate(Patent[1]/date,'-','')"
order="descending" data-type="number" />
   </xsl:apply-templates>

</xsl:template>

<xsl:template match="employee">
   <xsl:value-of select="firstName" /><xsl:text>
</xsl:text><xsl:value-of select="lastName"
/><xsl:text>&#xa;</xsl:text>
</xsl:template>

</xsl:stylesheet>

Regards,
Mukul

On 2/9/06, Billie <whynot77@xxxxxxxxxxxx> wrote:
> I'm sorry, I'm using XSLT 1.0.  I should have mentioned that originally.
> Billie

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