Apache™ FOP: Whitespace Management
This page describes an extension for FOP’s page breaking algorithm that enables the handling of dynamic content. Dynamic content has multiple variants, only one of which will be inserted in the document. Variant selection is done in a First Come First Served manner and the first variant that fits within the remaining space in the current page is chosen. If no appropriate variant is found, the dynamic content will be skipped without affecting the rest of the document layout.
Here is an example of dynamic content with two variants:
<fo:multi-switch fox:auto-toggle="select-first-fitting" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"> <fo:multi-case> <fo:block>First variant</fo:block> </fo:multi-case> <fo:multi-case> <fo:block>Second variant</fo:block> </fo:multi-case> </fo:multi-switch>
Space attributes (space-before, space-after) are not currently supported. This is primarily due to how space resolution is done in FOP, which requires the whole FO content to be known before doing page breaking.
Dynamic content inside a table cell does not work.