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

Re: Top n values

Subject: Re: Top n values
From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx>
Date: Fri, 18 Oct 2002 09:23:43 +0000
n values
..continued from previous mail..
you can also do without node-set()..
<xsl:for-each select="/root/item">
<xsl:sort select="." order="descending" data-type="number"/>
<xsl:if test="position()&lt;=3">
<xsl:value-of select="."/><br/>
</xsl:if>
</xsl:for-each>


From: Dan Diebolt <dandiebolt@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Top n values
Date: Thu, 17 Oct 2002 12:30:04 -0700 (PDT)

I need to process the top n values in a list where n
is dynamic. So if n=3 and I had the following XML:

<root>
 <item>1</item>
 <item>5</item>
 <item>3</item>
 <item>2</item>
 <item>6</item>
 <item>4</item>
</root>

I need to process <item>'s with values 6,5,4. If I had
captured n in a variable/parameter, what is the most
efficient way to do this? What I want to avoid is walking
the <item> nodset multiple times as there are a lot of
<item>s (thousands). Thanks.

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


_________________________________________________________________
Get faster connections?-- switch to?MSN Internet Access! http://resourcecenter.msn.com/access/plans/default.asp



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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