Next / Previous / Contents / NM Tech homepage

7.3. HTML headers and footers

We completely replace the header.navigation and footer.navigation templates. See page 140 of Stayton for a description of when these templates are called.

7.3.1. The header.navigation template

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.

<!--header.navigation: Navigational links in the page header-->
<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 template, and passing our prev, next, and home nodes to it.

  <xsl:call-template name="">
    <xsl:with-param name="prev" select="$prev"/>
    <xsl:with-param name="next" select="$next"/>
    <xsl:with-param name="home" select="$home"/>

Next is a small table, with one row and two columns, that positions the title on the top left and the 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.

  <!--Navigational links in the page header-->
  <div class="navheader">
    <table width="100%" summary="Navigation header">
      <tr valign="top">
        <td align="left" valign="top">
            <xsl:apply-templates select="$home"
          <img alt="logo" src="{$html.logo}"/>

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.