Subject: RE: [xsl] Adding subtotals to a report From: "David Messing 477-1289" <DMessing@xxxxxxxxxxxxxxxxxxx> Date: Thu, 18 Apr 2002 17:40:50 -0700 |
When I try summing the totals directly I get 0. I can do this <xsl:value-of select="sum(/*/*/*/@Total)" /> to get an overall total for the document. When I try to do this: <xsl:value-of select="sum(/*/Project[ProjectName = @ProjectName]/*/@Total)" /> I get 0 again. I know the data is there, I just need a little help getting to it. -----Original Message----- From: J.Pietschmann [mailto:j3322ptm@xxxxxxxx] Sent: Thursday, April 18, 2002 4:51 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Adding subtotals to a report 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 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Adding subtotals to a rep, Michael Kay | Thread | RE: [xsl] Adding subtotals to a rep, Michael Kay |
Re: [xsl] Adding subtotals to a rep, J.Pietschmann | Date | RE: [xsl] remote XML with document(, Jonathan Yue |
Month |