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

Re: does xslt support max(), min() and avg() functions

Subject: Re: does xslt support max(), min() and avg() functions ??
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 14 Feb 2001 12:55:53 +0000
xslt min function
Hi Anand,

> i want to get the maximum, minimum and average values of xml
> elements....i want to use XSLTs for this purpose...does XSLT support
> mathematical functions ornot ?? how can i implement mathematical
> functions using XSLTs ??

XSLT supports a fairly limited list of mathematical functions, which
doesn't include maximums, minimums or averages.

How to calculate maximums and minimums depends on the source XML, but
there are generally three possibilities:

  1. an XPath that picks the node whose value isn't lower than any
  2. sorting a node set and choosing the first in the sorted order
  3. using recursion

Calculating averages involves counting the nodes whose values you want
to average using the count() function, and summing their values either
through the sum() function or through recursion if necessary.

If you give more details about what you're trying to achieve, what
your source XML looks like and what XSLT you've managed to put
together so far, I'm sure someone will be able to help you more.



Jeni Tennison

 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.