|
Subject: [xsl] Get to 2 max values and element names From: "W Charlton" <XSLList@xxxxxxxxxx> Date: Fri, 11 May 2012 14:36:27 +0100 |
I have a peculiar problem. We have to extract the top 2 (modified) values from
some elements in a list and also get the element names. The xml is something
like:
<Data>
<Modifier>6</Modifier>
<List>
<Julian>123</Julian>
<Steve>45654</Steve>
<Helen>98412</Helen>
<Jack>-50</Jack>
<Ruth>981</Ruth>
<Susan>8431</Susan>
<Trevor>354</Trevor>
<Petra>6257</Petra>
<Harold>25632</Harold>
<Mary>8695</Mary>
</List>
</Data>
Note: We know that sometimes Jackbs (and only Jackbs) value is negative,
in which case he is excluded from the calculation.
It is also possible that any of the numbers are NULL in which case they are
also excluded or ignored.
I need to do the following:
Depending on the value of the Modifier (1-10) we have 4 variables.
vSteveMod, vHelenMod, vJackMod and vPetraMod
These vary depending on the value of the Modifier, there are 10 quartets of
values.
We now need to calculate the modified values for Steve, Helen, Jack and Petra
(these 4 are chosen specifically for this test) dictated by the current
Modifier (6).
So say that when the Modifier = 6, the 4 Modifying vars are:
vSteveMod = 1.2
vHelenMod = 0.65
vJackMod = 0.89
vPetraMod = 1.32
We then multiply these *Mod vars by the related value, so:
vSteveResult = 1.2 * 45654 = 54784.8
vHelenResult = 0.65 * 98412 = 63967.8
vJackResult = 0.89 * -50 = EXCLUDED
vPetraResult = 1.32 * 6257 = 8259.24
Finally we need to extract 4 values:
The Top value and element name.
The next (penultimate) highest value and also the element name.
e.g. in this case:
TopValue = 63967.8
TopName = Helen
PenultValue = 54784.8
PenultName = Steve
All using XSLT1
William Charlton
The yMonda team
yMonda Limited
w: www.ymonda.net
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] How to count elments whi, henry human | Thread | Re: [xsl] Get to 2 max values and e, Wendell Piez |
| Re: [xsl] Get the first Array eleme, henry human | Date | Re: [xsl] Get to 2 max values and e, Wendell Piez |
| Month |