xsl-list
[Top] [All Lists]

Re: Setting values for variable

2004-09-10 09:14:33
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(_at_)nag(_dot_)co(_dot_)uk>:


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
________________________________________________________________________

--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--









O SAPO já está livre de vírus com a Panda Software, fique você também!
Clique em: http://antivirus.sapo.pt