xsltapache-foptable-footer

Apache-FOP XSL-FO how do I display the table footer on last page only


I have a data table with a table footer (using the <fo:table-footer> tag). The table footer displays the total of the numeric values in one of one the columns (this is a pre-calculated total in the XML, it is not calculated in the XSL stylesheet). When the table fits on one page it works well. The table footer appears at the foot of the table as expected. When the table is too long to fit on one page I get a table footer at the bottom of the table on EACH page. This looks weird and instead I want the total value for the whole column to only appear at the end of the table on the last page only.

In my XSL stylesheet, how do I tell the table footer to only display at the end of the table on the last page (ie. not on each page, but only at the end of the table on the last page)?


Solution

  • Use the table-omit-footer-at-break property on <fo:table> precisely for this purpose:

    Alternatively, just don't use <fo:table-footer> and replace it with another <fo:table-body>. Often my students are surprised to learn that you can have any number of <fo:table-body> elements in a single table. For your solution, just flow another body at the end of your existing body (or bodies) ... don't bother with an actual footer.