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:
The xsl: namespace is the
usual XSLT namespage.
We also use one of the EXSLT extensions to XSLT, the
date package, as namespace date:
The extension-element-prefixes
attribute informs the XSLT processor that the
date: namespace prefix extends
XSLT.
The exclude-result-prefixes
attribute instructs the XSLT processor to process
elements in the date:
namespace rather than copying them to the output.
<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.
! Do not edit this file. It is extracted automatically from
! the documentation:
! http://www.nmt.edu/tcc/doc/docbook43/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/docbook43/mss/html/chunk.xsl"/>
<xsl:output method="html"/>
The remaining local customizations are divided into these sections:
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 in the generated style sheet link:
“S<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 ( ) as a
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>