Next / Previous / Contents / NM Tech homepage

7.5. HTML inline element customizations

This part of the stylesheet makes changes to the appearance of certain specific DocBook elements.

7.5.1. The inline.italicsansseq template

Some later parts of the stylesheet need the ability to select new font types. For example, we want application names (the application element) to be presented in an italic, sans-serif font, so that they really stand out from other elements such as userinput.

Accordingly, we need templates that set their arguments using such font variants. These templates are modeled on the ones from the stock stylesheets, such as the inline.italicseq template for italics, which is located in html/inline.xsl.

The first one is inline.italicsansseq. This template is used to format content using italic sans-serif font.

zdp_html.xsl
<!--inline.italicssansseq: Select italic sans-serif font-->
<xsl:template name="inline.italicsansseq">

This template takes one argument, content, which by default is the context node's content.

  • The anchor template, from html/html.xsl, defines an HTML anchor (<a name="I"/>) if its context node has an id="I" attribute.

  • The simple.xlink template implements a basic XLink (see the XLink standard) if the context node has an xlink:href attribute.

This xsl:param element, then, sets the content parameter to the context node's content, optionally preceded by an anchor, and optionally wrapped in an XLink.

zdp_html.xsl
  <!--Drop an anchor, and implement XLink features-->
  <xsl:param name="content">
    <xsl:call-template name="anchor"/>
    <xsl:call-template name="simple.xlink">
      <xsl:with-param name="content">
        <xsl:apply-templates/>
      </xsl:with-param>
    </xsl:call-template>
  </xsl:param>

The content is then wrapped in an HTML span element with a class="N" attribute where N is the element's local name. For example, if this template is used to wrap a DocBook application element, it will generate a span with class="application". This makes it possible to write CSS rules that apply to that element type.

zdp_html.xsl
  <span class="{local-name(.)}"
  ><xsl:copy-of select="$content"/></span>
</xsl:template>