Subject: Re: [xsl] Get to 2 max values and element names From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 11 May 2012 17:24:27 -0400 |
Cheers, Wendell
Wendell,
I thought temporary trees would come up. This transform is actually done in two stages so that is possible and is possibly the way I will go using xsl's sort-by which would be the obvious route I guess. I was trying to avoid putting too much math(s) in the first transform as the first xsl is reused elsewhere.
We actually take some source data and transform it into a standard format and then do a second transform which is where I need to use the 4 values to do some other stuff; along the lines of:
<xsl:choose> <xsl:when test="(PenultValue div TopValue)> 0.3"> <xsl:text>In this test</xsl:text> <xsl:value-of select="TopName"/> <xsl:text> was over 30% more effective than</xsl:text> <xsl:value-of select="PenultName"/> </xsl:when> <xsl:when test="(PenultValue div TopValue)> 0.5"> <xsl:text>In this test</xsl:text> <xsl:value-of select="TopName"/> <xsl:text> was over twice as effective as</xsl:text> <xsl:value-of select="PenultName"/> </xsl:when> ... You get the idea </xsl:choose>
We COULD also interrupt the second or even intercept the data before the first transform and poke the data into SQL and spit it out again and inject our 4 elements. But I was curious to know if there was some way known of doing this with recursion or keys or something, completely in XSLT (1) using MSXML ;). Extension functions could also be used if need be.
For information the modifiers are hard coded so that if<Modifier/> = x then the four values are set as in:
When the Modifier = 1, the 4 Modifying vars are: vSteveMod = 1.62 vHelenMod = 2.65 vJackMod = 0.34 vPetraMod = 1.3
When the Modifier = 2, the 4 Modifying vars are: vSteveMod = 3.85 vHelenMod = 0.89 vJackMod = 6.5 vPetraMod = 14.6
When the Modifier = 1, the 4 Modifying vars are: vSteveMod = 0.05 vHelenMod = 0.22 vJackMod = 0.22 vPetraMod = 2.85 etc... Mathematically random
You have the whole weekend, make it a good one.
William Charlton The yMonda team yMonda Limited w: www.ymonda.net
-----Original Message----- From: Wendell Piez [mailto:wapiez@xxxxxxxxxxxxxxxx] Sent: 11 May 2012 16:34 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Get to 2 max values and element names
William,
On 5/11/2012 9:36 AM, W Charlton wrote:All using XSLT1
Your requirements more or less demand the use of temporary trees and pipelining. Can you use at least use a node-set() extension function, or would you be forced to pipeline on the file system?
XSLT 1.0 was explicitly not designed for this sort of transformation.
In XSLT 2.0, it would be a fun little problem (for those who consider such little problems fun).
Cheers, Wendell
-- ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Get to 2 max values and e, W Charlton | Thread | Re: [xsl] Get to 2 max values and e, Michael Müller-Hille |
RE: [xsl] Get to 2 max values and e, W Charlton | Date | [xsl] xsl:if test = empty string, r, Jorge |
Month |