Subject: Re: Find the node with maximum elements
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Sun, 4 Nov 2007 19:08:20 +0530
|
On 11/4/07, G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx> wrote:
> Which is what I already indicated in my response:
>
> At 2007-11-03 15:19 -0400, G. Ken Holman wrote:
> >You can optimize the speed by putting the max value into a variable
> >and testing against that
Sorry, Ken. Unfortunately, I didn't read your post completely.
> <?xml version="1.0" encoding="US-ASCII"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="2.0">
>
> <xsl:output method="text"/>
>
> <xsl:template match="/">
> <xsl:value-of select="/Sample/*[count(Car)=max(/Sample/*/count(Car))]
> /name(.)"
> separator="
"/>
> </xsl:template>
>
> </xsl:stylesheet>
This solution is nice. But if the OP wants to do something else with
the result (not just printing the result (sequence), as this solution
demonstrates), then I think xsl:for-each loop will be necessary.
--
Regards,
Mukul Gandhi
|