RE: [xsl] Conditional Summation

Subject: RE: [xsl] Conditional Summation
From: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 2 Aug 2001 10:57:59 +0200 (MET DST)
Hi Katie,

> I am also trying to add up Fee values based on the Fee's Code.  If the Code 
> for a fee is not "Taxes", "Insurance" or "Other" the fee Amount should not 
> be included in the sum for the Total.

context node is FeeSet:
sum(Fee[Code[.='Taxes' or .='Insurance' or .='Other']]/Amount)

reads:
sum all the Amounts which are a child of a Fee that has a Code child whose
string-value is either 'Taxes', 'Insurance', or 'Other'.

> A simplified version of my xml is:
> 
> <Loan>
> 	<FeeSet>
> 		<Fee>
> 			<Code>Taxes</Taxes>

Assuming you meant <Code>Taxes</Code>

> 			<Amount>300.0</Amount>
> 		</Fee>
> 		<Fee>
> 			<Code>Appraisal</Taxes>
> 			<Amount>700.0</Amount>
> 		</Fee>
> 		<Fee>
> 			<Code>Other</Taxes>
> 			<Amount>200.0</Amount>
> 		</Fee>
> 		<Fee>
> 			<Code>Insurance</Taxes>
> 			<Amount>400.0</Amount>
> 		</Fee>
> 	</FeeSet>
> </Loan>

Cheers,
Oliver


/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread