Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 13th, 2009, 11:06 AM
Registered User
 
Join Date: Jan 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSLT recursive Additions

Recursive Addition
Hey all,
I need some procedure that can add the value of a specific node recursive.
In other words I need something that could do following:-

var a;

for (int i=0;i<count;i++)
{
a = a + value of (xslt node)
}
print a;

Thankx
 
Old January 13th, 2009, 11:11 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Do you want to use XSLT 1.0 or 2.0?
Are you aware that even XSLT/XPath 1.0 has a function named 'sum' http://www.w3.org/TR/xpath#function-sum so you might simply be able to use
Code:
<xsl:value-of select="sum(foo)"/>
where foo is the name of the elements you want to sum up.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
 
Old January 13th, 2009, 11:41 AM
Registered User
 
Join Date: Jan 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nope. Never knew abt that. But 3 CHeers. it solved my problem.

Thanks





Similar Threads
Thread Thread Starter Forum Replies Last Post
No additions using VBA and SQL Bob Pierce Access VBA 1 February 6th, 2007 01:20 PM
Showing 5 latest additions, problem with sorting Konfu XSLT 0 March 11th, 2006 10:21 AM
textboxes and additions toiletgraffiti C# 4 January 23rd, 2006 11:50 AM
recursive XSLT Help boates XSLT 2 January 11th, 2006 03:50 PM
Access 2000 "Open ODBC SQL Table for Additions" cjdphlx Access VBA 3 July 18th, 2005 02:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.