Re: Subtotaling on columns

At 2003-07-11 11:34 -0400, Yoshida, Ken wrote:
>I would like to have a subtotal at the end of my document.  How do I do 
>that?  Here is the code I currently have:

Unfortunately the code does not help and you may have more basic problems 
that just calculating subtotals: your placement of blocks inside of cells 
appears to assume a horizontal alignment that is not guaranteed.  If one of 
your names should wrap to two lines instead of being only one line, then 
all the subsequent names will not line up with the values in the other 
columns.  You probably should be creating individual table rows inside of 
the processing for each Customer.

Also, you say "subtotal" but you need it at the "end of the document", 
which means you probably want "total", which you can calculate with XSLT 
across all of your customers.  Check out if the sum() function will do what 
you want ... but I'm not sure because you don't describe how you are 
calculating your totals.

If, however, you want a subtotal for a portion of the table at the end of 
each page, not at the end of each document, this is not available in table 
processing and you have to put your subtotals into the after region by 
using markers.  Calculate a subtotal on the fly for each row of your table 
and put that value into a marker associated with each row.  In your after 
region, retrieve the last marker on the page, and you will have the last 
running total showing up on your page.

I hope this helps.

................... Ken


--
Upcoming hands-on courses: in-house corporate training available;
North America public:  XSL-FO Aug 4,2003; XSLT/XPath Aug 12, 2003

G. Ken Holman                mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.         http://www.CraneSoftwrights.com/f/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6                      Definitive XSLT and XPath
ISBN 0-13-140374-5                              Definitive XSL-FO
ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
ISBN 1-894049-11-X              Practical Formatting Using XSL-FO
Member of the XML Guild of Practitioners:    http://XMLGuild.info
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc

Received on Friday, 11 July 2003 12:46:08 UTC