[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Get to 2 max values and element names

Subject: RE: Get to 2 max values and element names
From: "W Charlton" <XSLList@xxxxxxxxxx>
Date: Fri, 11 May 2012 19:58:32 +0100
RE:  Get to 2 max values and element names
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) &gt; 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) &gt; 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:  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.