John Evans Solachuk
John Evans Solachuk

Reputation: 2105

XSL-FO : How do I repeat an xsl table for every page?

I've done it previously by including the table in region-before AKA header section of xsl-fo. However, this introduces a problem of needing to dynamically set the margin-top of the region-body because the table's height is not fixed.

Hence, I would need to include it in region-body. I've found questions on this but they are only on how to repeat headers of a table. In my case, I need to repeat the whole table in each page. Is it possible? If so, how do I do that?

EDIT Btw, I'm using FOP with Xalan

Upvotes: 0

Views: 1350

Answers (2)

Kevin Brown
Kevin Brown

Reputation: 8877

Place the table you want to repeat in the header of another table. The table would be one cell wide and contain all the body content. Because the table is in the header it will repeat on each page tha the body table content flows to. This would work only if you have content for the body that is one column.

Upvotes: 0

Tony Graham
Tony Graham

Reputation: 8068

If you are using either Antenna House or FOP with either Saxon 9.5, Xalan, or DotNet 4.0 XSLT processors, then you can use the XSLT extensions from the Print and Page Layout Community Group @ W3C to run the FO processor in the middle of your XSLT transform. See the examples at http://www.w3.org/community/ppl/wiki/XSLTExtensions

You can make a minimal FO document for rendering just the table, then run the extension functions on that to get an area tree containing the formatted table. Lastly, you'd then adjust the margins for the fo:region-body based on the height of the formatted table.

If you don't have an XSLT processor that can run the extension functions but do have an FO processor that can produce area tree output, you could run the FO processor once to get the area tree for the table, then run it for real and have the XSLT transform use the previously generated area tree XML to work out the table height and the margins for fo:region-body.

Upvotes: 1

Related Questions