Subject: RE: RE: RE: [xsl] Setting values for variable From: cknell@xxxxxxxxxx Date: Fri, 10 Sep 2004 12:16:07 -0400 |
<?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" encoding="UTF-8" /> <xsl:template match="/"> <xsl:apply-templates /> </xsl:template> <xsl:template match="Trade"> <xsl:variable name="R-type-with-Payment" select="sum(Record[Account='R']/Payment)" /> <xsl:variable name="I-type-with-Payment" select="sum(Record[Account='I']/Payment)" /> <xsl:variable name="R-type-without-Payment" select="sum(Record[Account='R'][not(Payment)]/Balance) * 0.02" /> <xsl:variable name="I-type-without-Payment" select="sum(Record[Account='I'][not(Payment)]/Balance) * 0.02" /> <xsl:text> </xsl:text> R Account totals: <xsl:value-of select="$R-type-with-Payment + $R-type-without-Payment" /> <xsl:text> </xsl:text> I Account totals: <xsl:value-of select="$I-type-with-Payment + $I-type-without-Payment" /> </xsl:template> </xsl:stylesheet> -- Charles Knell cknell@xxxxxxxxxx - email -----Original Message----- From: john lee <excel_man@xxxxxxxxxxx> Sent: Fri, 10 Sep 2004 15:47:02 +0000 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: RE: [xsl] Setting values for variable Thanks for all the replies. This is my situation: <Trade> <Record> <Account>R</Account> <Payment>10000</Payment> <Balance>50000</Balance> </Record> <Record> <Account>R</Account> <Balance>40000</Balance> </Record> <Record> <Account>I</Account> <Payment>5000</Payment> <Balance>50000</Balance> </Record> <Record> <Account>I</Account> <Balance>50000</Balance> </Record> </Trade> I need to run the total based on the account Type. If there is <Payment> Tag coming back, I'll calculate the total based on the payment, but if there isnt, I will substitute the amount with 2% of the value in the <Balance>. So I need to go into all the Record, look to see if there is Payment tag coming back. If yes, use it. If no, use 2% of the Balance value. Anybody can help me with this problem ? Thanks _________________________________________________________________ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Setting values for variab, David Carlisle | Thread | RE: RE: RE: [xsl] Setting values fo, john lee |
Re: [xsl] Setting values for variab, xptm | Date | Re: [xsl] Setting values for variab, David Carlisle |
Month |