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

Re: Find the node with maximum elements

Subject: Re: Find the node with maximum elements
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Sun, 4 Nov 2007 19:08:20 +0530
Re:  Find the node with maximum elements
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="&#xa;"/>
> </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

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