By default, the header area on each page is set off from
the content with a ruled line. Because the TCC style
does not use a running head, we turn off header.rule to eliminate this rule.
<xsl:param name="header.rule" select="0"/>
The stock header.content
template is in fo/pagesetup.xsl;
this template generates the content of the running head.
We replace that here with one that has no content.
<xsl:template name="header.content"> <xsl:param name="pageclass" select="''"/> <xsl:param name="sequence" select="''"/> <xsl:param name="position" select="''"/> <xsl:param name="gentext-key" select="''"/> </xsl:template>
Footer customization is discussed at length in Chapter 12 of Stayton under the heading “Running headers and footers.”
First we change the appearance of the text in the running
footer to make it look different from the body text.
This is specified by the footer.content.properties attribute set;
the stock version is in fo/param.xsl. The TCC Documentation Plan mandates nine-point italic
text.
<xsl:attribute-set name="footer.content.properties"> <xsl:attribute name="font-style">italic</xsl:attribute> <xsl:attribute name="font-size">9pt</xsl:attribute>
The rest of this attribute set is from the stock version.
<xsl:attribute name="font-family">
<xsl:value-of select="$body.fontset"/>
</xsl:attribute>
<xsl:attribute name="margin-left">
<xsl:value-of select="$title.margin.left"/>
</xsl:attribute>
</xsl:attribute-set>
The footer is formatted as a one-row, three-column table. The footer's content depends on two variables:
The pageclass describes the
general type of page. Values include:
titlepage | The title page. |
lot | List-of-titles pages, including the table of contents, list of figures, and such. |
front | Front matter: preface, dedication, etc. |
body | Main content pages. |
back | Back matter such as appendices and glossaries. |
index | Book-style index pages. |
Pages in each pageclass are
also divided by position. This is called the
sequence attribute of the
page, with these values:
first | First page of this class. |
odd | An odd-numbered, nonfirst page. |
even | An even-numbered, nonfirst page. |
blank | A blank page added to even out the page count. |
In our format, the content of the three columns of the
footer table is shown by this table. The
“Case” column describes which case applies,
and the three cells of the footer table are called
left, center, and right.
| Case | left | center | right |
|---|---|---|---|
pageclass is titlepage | blank | blank | blank |
Not titlepage, single-sided
| title | folio | logo |
Not titlepage,
double-sided, odd/first pages
| title | folio | logo |
Not titlepage,
double-sided, even/blank pages
| title | folio | logo |
“title” is the document's title.
“folio” is the page number.
“logo” is “New Mexico Tech Computer Center”.
“blank” denotes a blank cell.
This layout puts the page number in the center of single-sided pages, the outside of double-sided pages.
So, here's the footer.content
template. It is called once for each of the three
different footer positions, and returns the content that
should go in that position. It takes four parameters:
pageclass, sequence, and position are described above. The
gentext-key parameter is not
used; its function is discussed on p. 195 of Stayton.
<xsl:template name="footer.content"> <xsl:param name="pageclass" select="''"/> <xsl:param name="sequence" select="''"/> <xsl:param name="position" select="''"/> <xsl:param name="gentext-key" select="''"/>
The entire footer content is wrapped in a block container.
<fo:block>
First we eliminate the titlepage
case: there is no footer on title pages. (The current
article style has no separate
title page, if you're wondering how come all the TCC
documents have a running footer on the first page.)
<xsl:choose>
<xsl:when test="$pageclass = 'titlepage'">
<!--no footer on title pages-->
</xsl:when>
For non-title pages, the next important case is single-sided output.
<xsl:otherwise> <!--Not a title page-->
<xsl:choose>
<xsl:when test="$double.sided = 0"> <!-- Single-sided -->
<xsl:choose>
<xsl:when test="$position = 'left'">
<xsl:apply-templates select="."
mode="titleabbrev.markup"/>
</xsl:when>
<xsl:when test="$position = 'center'">
<fo:page-number/>
</xsl:when>
<xsl:when test="$position = 'right'">
<xsl:text>New Mexico Tech Computer Center</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when> <!-- Single-sided -->
The titleabbrev.markup mode
selects a titleabbrev if there
is one, defaulting to the document's title.
The remaining cases are for the two double-sided formats. First, the left position, which is the logo for odd pages and the page number for even pages.
<xsl:otherwise> <!--Double-sided-->
<xsl:choose>
<xsl:when test="$position = 'left'">
<xsl:choose>
<xsl:when test="$sequence = 'even' or
$sequence = 'blank'">
<fo:page-number/>
</xsl:when>
<xsl:otherwise> <!-- left/odd -->
<xsl:text>New Mexico Tech Computer Center</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
The center position always contains the running title.
<xsl:when test="$position = 'center'">
<xsl:apply-templates select="." mode="titleabbrev.markup"/>
</xsl:when>
The right position on a double-sided page contains the folio on odd pages, the logo on even pages.
<xsl:when test="$position = 'right'">
<xsl:choose>
<xsl:when test="$sequence = 'even' or
$sequence = 'blank'">
<xsl:text>New Mexico Tech Computer Center</xsl:text>
</xsl:when>
<xsl:otherwise> <!-- left/odd -->
<fo:page-number/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:otherwise> <!-- Double-sided -->
</xsl:choose>
</xsl:otherwise> <!--Not a title page-->
</xsl:choose>
</fo:block>
</xsl:template>
Why did we decide to have no running head? The principal motivation was aesthetics, and also to reclaim a bit more page for functional content.
However, one annoying property of this layout is that
the running title has to fit in a fairly restricted
space. If the document title is too long, it will be
folded in the footer, which is pretty ugly. The cure
for that is to add a titleabbrev element just after the document's title element; the content of that
element will be substituted for the full title in the
running footer.
Here is a more conventional plan that would get around this problem:
Place the running title in the header. It would be
left-justified on even pages, right-justified
otherwise. To set it off from the body of the page
with a ruled line, header.rule should be turned back on.
In the running footer, put the folio on the outside and the logo on the inside.