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

Re: Using an index with a sorted list of elements

Subject: Re: Using an index with a sorted list of elements
From: bix_xslt@xxxxxxxxxxx
Date: Wed, 19 Mar 2003 00:56:39 -0600
sortedlist descending

> I have a number of elements, similar to <element @value/>
> I want to find the element that has the biggest value of "value" less
> than a value $upperBound.

I would try to think about it more like this.  Let me sort the values first,
and then grab the value I want (i.e. small easy steps will get me there

        <x:for-each select="//*[@value &lt; $upperBound]">
            <x:sort data-type="number" order="descending" select="@value"/>
               <x:if test="position() = 1"><x:value-of

To break it down, this selects every node that has a @value less than the
upper bound, and then sorts based on that value attribute in a descending
order.  Then, it selects the first one.  There's probably another, slicker
way to do this with the [1], but I think this will work for you.


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

Current Thread


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.
First Name
Last Name
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.