[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Get to 2 max values and element names
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
|
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
|