Leaders

Contact Us or call 1-877-932-8228
Leaders

Leaders

Leaders are used to separate the story titles from the page numbers. They are created with the <fo:leader> tag as shown below.

<xsl:template match="body/div/h2" mode="TOC"> <fo:block font-size="smaller" space-after=".1in" space-before=".15in" text-align-last="justify"> <fo:basic-link internal-destination="{generate-id(.)}"> <xsl:value-of select="."/> <fo:leader leader-pattern="dots"/> <fo:page-number-citation ref-id="{generate-id(.)}"/> </fo:basic-link> </fo:block> </xsl:template>

To force the page number to be aligned all the way to the right, we set the text-align-last attribute of the block to "justify". For the leader-pattern, we use "dots", which is common for a table of contents. Other options are "rule", "space", and "use-content", which are all shown in the following example.

Code Sample:

LeadersMarkers/Demos/Leaders.fo
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
	<fo:layout-master-set>
		<fo:simple-page-master master-name="Leaders" page-height="11in" page-width="8.5in" margin="1in">
			<fo:region-body/>
		</fo:simple-page-master>
	</fo:layout-master-set>
	<fo:page-sequence master-reference="Leaders">
		<fo:flow flow-name="xsl-region-body">
		
			<fo:block font-weight="bold" space-before=".5cm" space-after=".5cm">leader-pattern</fo:block>
			<fo:block space-after=".1in" text-align-last="justify">
				A<fo:leader leader-pattern="dots"/>Z
			</fo:block>
			<fo:block space-after=".1in" text-align-last="justify">
				A<fo:leader leader-pattern="rule"/>Z
			</fo:block>
			<fo:block space-after=".1in" text-align-last="justify">
				A<fo:leader leader-pattern="space"/>Z
			</fo:block>
			<fo:block space-after=".1in" text-align-last="justify">
				A<fo:leader leader-pattern="use-content">*</fo:leader>Z
			</fo:block>
			
			<fo:block font-weight="bold" space-before=".5cm" space-after=".5cm">leader-pattern-width</fo:block>
			<fo:block space-after=".1in" text-align-last="justify">
				A<fo:leader leader-pattern="dots" leader-pattern-width="1cm"/>Z
			</fo:block>
			<fo:block space-after=".1in" text-align-last="justify">
				A<fo:leader leader-pattern="rule" leader-pattern-width="1cm"/>Z
			</fo:block>
			<fo:block space-after=".1in" text-align-last="justify">
				A<fo:leader leader-pattern="use-content" leader-pattern-width="1cm">*</fo:leader>Z
			</fo:block>
			
			<fo:block font-weight="bold" space-before=".5cm" space-after=".5cm">leader-length</fo:block>
			<fo:block space-after=".1in" text-align="center">
				A<fo:leader leader-pattern="dots" leader-length="50%"/>Z
			</fo:block>
			<fo:block space-after=".1in" text-align="center">
				A<fo:leader leader-pattern="rule" leader-length="3in"/>Z
			</fo:block>
			<fo:block space-after=".1in" text-align="center">
				A<fo:leader leader-pattern="space" leader-length="50%"/>Z
			</fo:block>
			<fo:block space-after=".1in" text-align="center">
				A<fo:leader leader-pattern="use-content" leader-length="3in">*</fo:leader>Z
			</fo:block>
			
		</fo:flow>
	</fo:page-sequence>
</fo:root>

The output is shown below followed by a table showing common leader attributes.

<fo:leader> Attributes
Attribute Description
leader-pattern
  • dots
  • rule
  • space
  • use-content
leader-length the width of the leader
leader-pattern-width the distance between each glyph in the leader
leader-alignment
  • none
  • reference-area
  • page
Next