[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Adding subtotals to a report

Subject: Re: Adding subtotals to a report
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Fri, 19 Apr 2002 01:50:41 +0200
subtotals in xsl
David Messing 477-1289 wrote:
<xsl:template match="ScheduleVariance">
...
		<td><font color="gold"><b>Total</b></font></td>
		<xsl:for-each select="Employee">
		<xsl:variable name="subtotals">
			<subtotal><xsl:value-of select="Total" /></subtotal>
		</xsl:variable>
		<tr>
			<xsl:call-template name="Employee" />
		</tr>
		</xsl:for-each>
...
I get the report formatted the way they want it, but when I try to add
> this to it to get subtotals, I get variable is not defined or in scope.

That's because the variable is not in scope. The scope
of variables is the enclosing element, in this case
the for-each statement working on your Employee elements.

Why don't you access the totals directly?

 <tr>
 	<td></td>
 	<td><b>Totals</b></td>
 	<td></td>
 	<td></td>
 	<td></td>
 	<td></td>
 	<td></td>
 	<td><xsl:value-of select="sum(Employee/Total)" /></td>
 </tr>

J.Pietschmann


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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.