W3C home > Mailing lists > Public > www-xsl-fo@w3.org > July 2003

Re: Subtotaling on columns

From: G. Ken Holman <gkholman@CraneSoftwrights.com>
Date: Fri, 11 Jul 2003 12:45:57 -0400
Message-Id: <5.2.0.9.0.20030711123828.024449b8@pop.storm.ca>
To: "'www-xsl-fo@w3.org'" <www-xsl-fo@w3.org>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:11 GMT