Re: [xsl] Setting values for variable

Subject: Re: [xsl] Setting values for variable
From: xptm@xxxxxxx
Date: Fri, 10 Sep 2004 17:14:33 +0100
Damn, i was working on this but your solution is more elegant then mine. But
i'm
a rookie, anyway...

But just to ilustrate how vars should be used,

		<xsl:variable name="t1">
			<xsl:value-of select="sum(/Trade/Record[Payment]/Payment)" />
		</xsl:variable>
		<xsl:variable name="t2">
			<xsl:value-of select="sum(/Trade/Record[not(Payment)]/Balance)" />
		</xsl:variable>
		<xsl:value-of select="$t1+$t2*0.02"/>

However, i think Jhon want those values grouped by Account.

Quoting David Carlisle <davidc@xxxxxxxxx>:

>
> if I understand your description you want the sum of all Payment
> elements plus 2% of the sum of all Balance elemnts that don't have a
> sibling Payment so that's just
>
> <xsl:value-of
>   elect="sum(Record/Payment) + 0.02 * sum(Record[not(Payment)]/Balance)"/>
>
> as you see, no variables are required at all.
>
> David
>
> ________________________________________________________________________
> This e-mail has been scanned for all viruses by Star. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
> http://www.star.net.uk
> ________________________________________________________________________
>
>







O SAPO ja esta livre de vmrus com a Panda Software, fique vocj tambim!
Clique em: http://antivirus.sapo.pt

Current Thread