Next / Previous / Contents / TCC Help System / NM Tech homepage

6. tcc_html.xsl: HTML customization layer

The tcc_html.xsl file is an XSLT script that lies on top of the DocBook XSL Stylesheets, specifying the local customizations for our HTML presentation.

It starts with the usual xsl:stylesheet root element. Attributes include:

<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:date="http://exslt.org/dates-and-times"
    extension-element-prefixes="date"
    exclude-result-prefixes="date">
  <!-- XSL-HTML stylesheet customization layer for the TCC
   !   For documentation, see:
   !       http://www.nmt.edu/tcc/doc/docbook42xep/ims/
   !-->

Next we import the html/chunk.xsl stylesheet from the stock DocBook XSL Stylesheets. Stayton discusses this in the chapter on HTML customization, the section on chunking: this file is the root HTML stylesheet for chunked HTML output (as opposed to one huge page).

<xsl:import
    href="http://www.nmt.edu/tcc/doc/docbook42xep/mss/html/chunk.xsl"/>
  <xsl:output method="html"/>

The remaining local customizations are divided into these sections:

6.1. HTML general page layout

The first general customization we need is to link to the CSS stylesheet that customizes the appearance of all DocBook-generated Web pages. The content of the html.stylesheet parameter appears as S in the generated style sheet link: “<link rel="stylesheet" href="S" type="text/css">

<xsl:param name="html.stylesheet">/tcc/docbook.css</xsl:param>

The color scheme defined in the stock html/docbook.xsl file is black text on a white background. Since the TCC has different colors (defined in the CSS style sheet, docbook.css), we need to get rid of the stock color scheme. To do this, we define an empty body.attributes template to replace the template by that name that contains the color definitions.

<xsl:template name="body.attributes"/>

In early 2009, a lot of browsers started rendering the non-break space character (&nbsp;) as dark lozenge with a question mark inside it. This turns out to have been caused by an incorrect encoding scheme. This issue is discussed in Stayton, 3rd ed., p. 298, in the chapter “Languages, characters, and encoding,” the section entitled “Output encoding.” The default encoding is ISO-8859-1, but it should be UTF-8. The chunker.output.encoding variable controls the encoding that appears in the meta tag for chunked output.

<xsl:param name="chunker.output.encoding">UTF-8</xsl:param>