BizTalk Utilities CV ,   Jobs ,   Code library
 
Home Page


Add/Edit your code items
Search the code library
Browse for the code library


XSLT
How to use XSL function sum() to sum 2 XML fields
A simple template to display singular and plural counts
Helpful XSLT ""break"" template
Support automatic transformation using XSLT in IE in side by side mode
Displaying XML data in Pages
Repeated search and replace in XSLT
Combinations of k out of n numbers
Permutations of the values of N nodes
DVC Algorithms in XSLT
Another way of avoiding XSLT processor crash
Re: DVC Algorithms in XSLT
trig functions in xslt
XSLT string Replace function
A Slide-In Menu made with XML/XSLT
What is SVG?
Family Tree maker
Alternative Ordering - ""Women and Children to the lifeboats first""
Restructuring flat delimited XML
Hex and Binary Conversions in XSLT - with Boolean math functions
Using XSLT to produce SVG (1)


 
 

<< XQuery.NET and XML >>


By Slawomir Tyszko
First Posted 01/13/2002
Times viewed 237

Re: How to use XSL function sum() to sum 2 XML fields


Summary The alternative solution to Qing-Hua Jiang's code is of course one using recursion, i.e. a named template calling itself recursively. It is not that fascinating, as it uses a standard approach to computing in XSLT, but its advantage is that it works also with XSLT processors (like, for instance James Clark's XT) that do not have the "node-set" extension function implemented.

To put the computed total amount to a table cell just call the template named total taking one parameter items, which is the node-set containing all the item elements. The template then calls itself the number of times equal to the number of elements in the input node-set. The computed amount is being cumulated in the result parameter. The computation is performed in reverse order, with parameter count stepping down to 0.

Additional information


Rate this article on a scale of 1 to 10 (0 votes, average 0)

Your vote :  

<< XQuery.NET and XML >>





Leave a comment for this article
Your name
Your email (optional)
Your comment
Optional: Upload an attachment
Enter the code shown:

 
 

    Email TopXML