xsl-list
[Top] [All Lists]

Extracting highest values within a range

2005-01-14 09:39:15
Hi

Consider the following column based structure.

<wrapper>
        <column1>
                <name>Result1</name>
                <name>Result2</name>
                <name>Result3</name>
                <name>Result4</name>
                <name>Result5</name>
                <name>Result6</name>
        </column1>
        <column2>
                <amount>1000</amount>
                <amount>200</amount>
                <amount>3000</amount>
                <amount>40</amount>
                <amount>50</amount>
                <amount>11</amount>
        </column2>
        <column3>
                <amount>44</amount>
                <amount>800</amount>
                <amount>66</amount>
                <amount>120</amount>
                <amount>90</amount>
                <amount>101</amount>
        </column3>
        <column4>
                <amount>1000</amount>
                <amount>200</amount>
                <amount>3000</amount>
                <amount>40</amount>
                <amount>50</amount>
                <amount>11</amount>
        </column4>
        <column5>
                <amount>1000</amount>
                <amount>200</amount>
                <amount>3000</amount>
                <amount>40</amount>
                <amount>50</amount>
                <amount>11</amount>
        </column5>
</wrapper>

I need to compare a range of results and output the highest <amount> for
each <column>. The range will be defined by matching the text value of
<name> nodes in <column1>. So given the following parameters...

<params>
        <resultstocompare>
                <start>Result1</start>
                <end>Result3</end>
        </resultstocompare>
        <resultstocompare>
                <start>Result5</start>
                <end>Result6</end>
        </resultstocompare>
</params>

... I would get the following result.

<wrapper>
        <column1>
                <name>Result1 - Result3</name>
                <name>Result4</name>
                <name>Result5 - Result6</name>
        </column1>
        <column2>
                <amount>3000</amount>
                <amount>40</amount>
                <amount>50</amount>
        </column2>
        <column3>
                <amount>800</amount>
                <amount>120</amount>
                <amount>101</amount>
        </column3>
        <column4>
                <amount>3000</amount>
                <amount>40</amount>
                <amount>50</amount>
        </column4>
        <column5>
                <amount>3000</amount>
                <amount>40</amount>
                <amount>50</amount>
        </column5>
</wrapper> 

Note that 'Result4' hasn't been used in any comparison and passes
through 'as-is'.

Any suggestions would be greatly appreciated.

--
Kevin

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>