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

RE: Calculation of Minimum or Maximum value of an ele

Subject: RE: Calculation of Minimum or Maximum value of an element
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Tue, 12 Nov 2002 09:33:09 -0000
minimum and maximum values
Here are four techniques you can use:

1. Use the XPath expression

       A[not(../A &lt; .)]
   which finds all A elements that have no other A whose value is
smaller. This expression has quadratic performance.

2. Sort the list and (using the xx:node-set() extension) select the
first or last in sorted order. This has (n log n) performance.

3. Use a recursive template. This has linear performance.

4. Use a library routine, such as the EXSLT min() function: see
www.exslt.org.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Chitra Lalita Madhwacharyula
> Sent: 12 November 2002 01:46
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Calculation of Minimum or Maximum value of an element
> 
> 
> 
> 	Hello,
> 
> 	Can anyone please tell me how to calculate the minimum or
> maximum values of a set of nodes and display them using 	XSLT ?
> 	For e.g if I have
> 	<A>300</A>
> 	<A>250</A>
> 	<A>900</A>
> 	How can I write a template or a function which 
> calculates the least A element value and displays it ???
> 
> 	Thanx,
> 	Chitra
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 


 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.