xsl-list
[Top] [All Lists]

Calculating min/max values for sum of different node values

2003-05-21 09:34:38
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



<Prev in Thread] Current Thread [Next in Thread>
  • Calculating min/max values for sum of different node values, Bogdan Constantinescu <=