Next / Previous / Contents / NM Tech homepage

7.2. HTML title page and table of contents

The main customization for title pages is to include the generated html-titlepage.xsl template that came out of the title page customization process; see Section 9, “html-titlepage.xml: HTML title page template”.

<!--Include the title page customization-->
<xsl:include href="html-titlepage.xsl"/>

This next bit is high wizardry. We often use tags such as code and filename inside section and subsection titles. With the stock stylesheets, text marked up with these tags uses ordinary fonts. It wasn't obvious to me how to fix this, so I wrote to Bob Stayton, and got back this highly useful reply:

It certainly isn't obvious, but this customization will achieve what you want for code and userinput:

<xsl:template match="d:code|d:userinput" mode="no.anchor.mode">
  <xsl:apply-templates select="." />

If you want to trace this through the templates:

  1. Processes <section> with mode="toc" in autotoc.xsl. That applies templates in mode="title.markup".

  2. Matches on <section> in mode="title.markup" in titles.xsl. That sets variable $title to the content of the <title> element. Applies templates on $title in mode="title.markup".

  3. Matches on title in mode="title.markup" in titles.xsl. Applies templates in mode="no.anchor.mode".

The 'no.anchor.mode' prevents links and index entries. There are no templates in such mode for inlines, so it defaults to outputting just the text content of the element. The customization above applies the regular userinput or code template to the element instead.

So, here's the customization that does this for filename, sgmltag, userinput, code, and varname elements:

<!--Render these tags normally inside titles-->
<xsl:template match="d:filename|d:sgmltag|d:userinput|d:varname|d:code"
  <xsl:apply-templates select="." />