xsl-fo

How to set dynamic block-container size that occupies the rest of the page


I have been struggling with xls-fo because of a severe lack of examples.

I want to generate a dynamic invoice which has the grand total at the bottom of the page.

enter image description here enter image description here enter image description here

I have been trying with height="100%" with block-container and table, then try to set position relative to the bottom. The interpreter doesn't recognise percentage height and I have no luck at all.

Relative positioning also doesn't work. I don't know the right syntax. I can see some work has been done with fo:conditional-page-master-reference. I don't even know how to apply for that page-sequence-master.

Can you give me the simplest working xsl-fo structure for this layout?


Solution

  • The simplest way would be to generate an fo:footnote at the end of the last fo:block. There are multiple fo:footnote examples at https://www.antennahouse.com/xsl-fo-samples.

    If you are using Antenna House Formatter, you could make an fo:float that floats to the bottom of the page. See https://www.antenna.co.jp/AHF/help/en/ahf-float.html

    The fo:conditional-page-master-reference way would also work. There's also a sample for that at https://www.antennahouse.com/xsl-fo-samples.

    To get the grand total into the footer of the only or last page would also require that you use fo:static-content, fo:marker, and fo:retrieve-marker. There's also fo:marker samples, plus markers are covered in "How to Develop Stylesheets for XML to XSL-FO Transformation" available at https://www.antennahouse.com/xml-to-xsl-fo-stylesheets.