xml.propagate-page-break.xpl Maven / Gradle / Ivy
Propagate page breaking related properties.
The input is assumed to be a tree-of-boxes representation of a document where boxes are
represented by css:box elements. The document root must be a box or a css:_ element. The
parent of a box must be another box (or a css:_ element if it's the document
root). Inline boxes must have at least one non-inline box ancestor and must not have
non-inline descendant or sibling boxes. All other nodes must have at least one inline
box ancestor. The 'page-break' and 'volume-break' properties of block boxes must be
declared in css:page-break-before, css:page-break-after, css:page-break-inside and
css:volume-break-before attributes. 'page' properties must be declared in css:page
attributes. 'counter-set' properties for the 'page' counter must be declared in
css:counter-set-page attributes. 'volume' properties must be declared in css:volume
attributes.
A 'page-break-before' or 'volume-break-before' property is propagated to the closest
ancestor-or-self block box with a preceding sibling, or if there is no such element, to
the outermost ancestor-or-self block box. A 'page-break-after' or 'volume-break-after'
property is propagated to the closest ancestor-or-self block box with a following
sibling, or if there is no such element, moved to the outermost ancestor-or-self block
box. A 'page-break-inside' property with value 'avoid' on a box with child block boxes
is propagated to all its children, and all children except the last get a
'page-break-after' property with value 'avoid'. In case of conflicting values for a
certain property, 'left' and 'right' win from 'always', 'always' wins from 'avoid', and
'avoid' wins from 'auto'. When 'left' and 'right' are combined, the value specified on
the latest element in the document wins. In case of conflicting values between adjacent
siblings, the same precedence rules apply. Forced page breaks of type 'auto-right' are
introduced where needed to satisfy the 'page' properties. Forced page breaks of type
'auto-always' are introduced where needed to satisfy the 'volume' properties. These
forced page breaks are propagated also as described above.