Markers in XSL-FO

Markers are used to produce running headers or footers and dynamic table headers or footers. There are two XSL-FO elements used to create markers:

  • <fo:marker>
  • <fo:retreive-marker>

The <fo:marker> is used first to undicate the element. It can be used with block- or inline-level formatting objects and should be placed inside <fo:flow> only. The <fo:marker> should also be the initial child of its parent element. The <fo:marker> has only one attribute - marker-class-name - used as an identifier when retrieving an element.

The <fo:retreive-marker> is used as a descendant of an <fo:static-content> element to match an <fo:marker> found in the <fo:flow>.

The <fo:retreive-table-marker> has the same functionality as the <fo:retreive-marker>. The only difference is that it is used for tables.

Here is a simple example showing markers' usage:

   ...
   <fo:static-content flow-name="header">
     <fo:block text-align="right">
       <fo:retrieve-marker retrieve-class-name="chapter"/>
     </fo:block>
   </fo:static-content>
   <fo:flow flow-name="contents" font-family="Calibri" font-size="12pt">
     ...
     <fo:block>
       <fo:marker marker-class-name="chapter">
         Chapter 1.
       </fo:marker>
       <fo:block font-weight="bold">
         Chapter 1.
       </fo:block>
       <fo:block>
         This chapter containt the information about...
       </fo:block>
     </fo:block>
     ...
   </fo:flow>
   ...