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

Calculating min/max values for sum of different node v

Subject: Calculating min/max values for sum of different node values
From: "Bogdan Constantinescu" <bconstantinescu@xxxxxxxxxxxxxx>
Date: Wed, 21 May 2003 12:34:38 -0400
xslt min
Hi,

Here is a sample of the xml file that I am using:

<graph>
	<year value="2000">
		<return month="1">1</return>
		<return month="2">-2.5</return>
		<return month="3">2</return>
		<return month="4">3</return>
		<return month="5">4</return>
		<return month="6">2</return>
		<return month="7">-1</return>
		<return month="8">0</return>
		<return month="9">1</return>
		<return month="10">9</return>
		<return month="11">5</return>
		<return month="12">0</return>
	</year>
	<year value="2001">
		<return month="1">0</return>
		<return month="2">1</return>
		<return month="3">2.2</return>
		<return month="4">1</return>
		<return month="5">2.5</return>
		<return month="6">1</return>
		<return month="7">3</return>
		<return month="8">2</return>
		<return month="9">1</return>
		<return month="10">6</return>
		<return month="11">2.1</return>
		<return month="12">1</return>
	</year>
	<year value="2002">
		<return month="1">0</return>
		<return month="2">1</return>
		<return month="3">2</return>
		<return month="4">1</return>
		<return month="5">2.5</return>
		<return month="6">1.5</return>
		<return month="7">-3</return>
		<return month="8">2</return>
		<return month="9">1</return>
		<return month="10">6</return>
		<return month="11">2.1</return>
		<return month="12">1</return>
	</year>
</graph>

What I want to do is the following:

I will have 4 variables defined in the XSL:

<xsl:variable name="startYear">2001</xsl:variable>
<xsl:variable name="endYear">2002</xsl:variable>
<xsl:variable name="startMonth">2</xsl:variable>
<xsl:variable name="endtMonth">5</xsl:variable>

which will get each time different values from a configuration file. Let's
use these hardcoded values for now.

I want to calculate the min/max (and store the results in some variables for
later use) for the sums of all the return values that are in the specified
range. For example, in this case I want to sum all the return values from
year 2001 that have the month attribute between 2 and 5, and then calculate
the sum for all the return values from year 2002 that have the month
attribute between 2 and 5 and in the end calculate the max/min of these 2
sums.

Does anybody have any idea if I can do this in XSL ?

Thanks a lot for your help !

Bogdan Constantinescu









 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.