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 February 28th, 2014, 06:48 AM
Registered User
 
Join Date: Feb 2014
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Default get sum of table data value

Hello,

I have a table with numbers in td and I want to write the sum of these numbers on each last td of the table row.

I read on a forum that I can put a variable before the for-each and after make a sum on these variable.

That's good, I have the sum but I have only this td and not the td with the numbers. And if I remove the variable, I have the td with numbers but cannot calculate the sum.

Here is my code: http://pastebin.com/XUWX39vx

Have someone an idea to help me please?
 
Old March 1st, 2014, 11:21 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

I think instead of
Code:
<td style="text-align:right;"><xsl:value-of select="sum($hours/td)" /></td>
you want
Code:
<xsl:copy-of select="$hours/td"/>
<td style="text-align:right;"><xsl:value-of select="sum($hours/td)" /></td>
to output the "td" elements in the variable and to output the sum as the last "td".
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog





Similar Threads
Thread Thread Starter Forum Replies Last Post
SUM function and TOTALS in a data view cwikoff SharePoint Development 0 July 21st, 2006 02:57 PM
Sum up the records in table aylmer018 Classic ASP Databases 2 August 19th, 2005 12:40 PM
Sum of random numbers in a table with XSLT Tschuri XSLT 0 May 8th, 2005 04:14 AM
Placing a computed sum in a table field cuzintone SQL Language 1 April 15th, 2005 05:02 AM
Update parent table with the sum of child table gbrown SQL Language 2 November 9th, 2004 07:53 AM





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