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
|
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>
</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
|