xsl-list
[Top] [All Lists]

Re: Re: sorting by maximum value of multiple nodes

2006-02-09 10:13:14
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(_at_)cooltoad(_dot_)com> wrote:
I'm sorry, I'm using XSLT 1.0.  I should have mentioned that originally.
Billie

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>