Customization of the TCC header and footer content follows the TCC Documentation Guidelines. The intent is to mimic the style of HTML pages generated by other tools, such as PyStyler [PDF file].
Because the TCC's navigational features are completely different in structure from the stock templates, we have elected to completely replace the header.navigation and footer.navigation templates. See page 140 of Stayton for a description of when these templates are called.
The first template we define is header.navigation, which sets up the top-of-page features in HTML. This template is a customized copy of the stock header.navigation template from html/chunk-common.xsl.
The template takes three parameters:
The previous page's node, or empty if this is the first child of its parent.
The next page's node, or empty if there is none.
Not used by this template. If you're curious about what it does in the stock template, see the stock template in html/chunk-common.xsl.
<xsl:template name="header.navigation"> <xsl:param name="prev" select="/foo"/> <xsl:param name="next" select="/foo"/> <xsl:param name="nav.context"/> |
Next are two variables internal to this template:
The root element of the DocBook document. The XPath expression "/*[1]" selects the first child of the document root, which is probably an article.
The parent element of this node. The XPath expression "parent::*" selects the parent node.
<xsl:variable name="home" select="/*[1]"/> <xsl:variable name="up" select="parent::*"/> |
The first HTML header element is the top-of-page navigational bar, containing the links “Next / Prev / ...” and so forth. This is produced by calling the tcc.top.nav.bar template, and passing our prev, next, and home nodes to it.
<xsl:call-template name="tcc.top.nav.bar">
<xsl:with-param name="prev" select="$prev"/>
<xsl:with-param name="next" select="$next"/>
<xsl:with-param name="home" select="$home"/>
</xsl:call-template>
|
Next is a small table, with one row and two columns, that positions the title on the top left and the TCC logo on the top right. This is wrapped in a div element with class navheader so that a CSS stylesheet can customize the appearance of this area.
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr valign="top">
<td align="left" valign="top">
<h1>
<xsl:apply-templates select="$home" mode="object.title.markup"/>
</h1>
</td>
<td>
<img alt="Tech Computer Center logo"
src="/tcc/images/logo.png"/>
</td>
</tr>
</table>
|
The mode="object.title.markup" template call causes the title text to be inserted as content of the HTML h1 element.
Lastly, we add a horizontal rule to set off the header from the page body.
<hr/> </div> </xsl:template> |