Re: does xslt support max(), min() and avg() functions
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 other 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. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format