[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Setting values for variable
Thanks for the solution David, but I forget to mention if There is no Balance tag coming back or Balance tag value is 0, instead of calculating the Payment using 2% of Balance, we will substitute it with $10 <xsl:value-of select="sum(Record/Payment) + 0.02 * sum(Record[not(Payment)]/Balance[not(.=0)) + 10 * count(Record[not(Payment)][not(Balance) or Balance=0])"/> Ie: just write the thing in Xpath instead of English. It really is easier to use declarative programming instead of imperative programming: you just have to think like a normal person and not like a FORTRAN programmer. If describing the sum of a certain class of elements to a person you would never use this rather strange notion of "updatable variables" You wouldn't say start with the sum being zero and then iterate over the class of elements incrementing the sum with a new value, You'd just describe the final result as a function of the input not as a series of imperative programming steps. That is the essence of declarative programming, you just describe the desired result and leave it up to the compiler implementors what happens at the machine level. 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 ________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|