Leaders and rules

Sometimes adjustable horizontal space between two neighbouring objects has to be filled e.g. in a book's table of contents. The fo:leader serves this purpose:

Figure 950. Two simulated entries in a table of contents. Create comment in forum
...
<fo:block text-align-last='justify'>Valid
  XML<fo:leader leader-pattern="dots"/>
page 7</fo:block>

<fo:block text-align-last='justify'>XSL
<fo:leader leader-pattern='dots'/>
page 42</fo:block> ...
Two simulated entries in a table of contents.

The attributes' value text-align-last = 'justify' forces the fo:block to extend to the available width of the current fo:region-body area. The fo:leader inserts the necessary amount of content of the specified type defined in in leader-pattern to fill up the gap between its neighbouring components. This principle can be extended to multiple objects:

Figure 951. Four entries separated by equal amounts of dotted space. Create comment in forum
<fo:block text-align-last='justify'>A<fo:leader
leader-pattern="dots"/>B<fo:leader
leader-pattern="dots"/>C<fo:leader leader-pattern="dots"/>D</fo:block>
Four entries separated by equal amounts of dotted space.

A fo:leader may also be used to draw horizontal lines to separate objects. In this case there are no neighbouring components within the current line in which the fo:leader appears. This is frequently used to draw a border between xsl-region-body and xsl-region-before and/or xsl-region-after:

Figure 952. A horizontal line separator between header and body of a page. Create comment in forum
...
<fo:page-sequence master-reference="simplePageLayout">
  <fo:static-content flow-name="xsl-region-before">
    <fo:block text-align-last='justify'>FO<fo:leader/>page 5</fo:block>
    <fo:block text-align-last='justify'>
      <fo:leader leader-pattern="rule" leader-length="100%"/>
    </fo:block>
  </fo:static-content>
  <fo:flow flow-name="xsl-region-body">
    <fo:block>Some body text ...</fo:block>
  </fo:flow>
</fo:page-sequence>...
A horizontal line separator between header and body of a page.

Note the empty leader < fo:leader /> between the FO and the page 5 text node inserting horizontal whitespace to get the page number centered to the header's right edge. This is in accordance with the leader-pattern attributes default value space.