Override styles with XSLT

The XSLT import extension points are used to override various steps of XSLT processing. For this, the extension attribute indicates the step that the override applies to; the file attribute is a relative path to the override within the current plugin. The plugin installer will add an XSL import statement to the default code so that your override becomes a part of the normal build.

The following XSLT steps are available to override in the core toolkit:

Overrides default (X)HTML output (including HTML Help and Eclipse Help). The referenced file is integrated directly into the XSLT step that generates XHTML.
Overrides default PDF output (formerly known as PDF2). The referenced file is integrated directly into the XSLT step that generates XSL-FO for PDF.
Overrides default DocBook output.
Overrides default RTF output.
Overrides the step that generates plugin.xml for Eclipse.
Overrides the preprocess step that resolves conref.
Overrides the preprocess step "topicpull" (the step that pulls text into <xref> elements, among other things).
Overrides the preprocess step "mapref" (the step that resolves references to other maps).
Overrides the preprocess step "mappull" (the step that updates navtitles in maps and causes attributes to cascade).
Overrides the preprocess step "maplink" (the step that generates map-based links).
Overrides the intermediate block-and-phrase format generated as input to troff processing.
Overrides the XSL that converts block-and-phrase intermediate markup into troff.

Example – Overriding XHTML header processing

The following two files represent a complete, simple style plug-in.

The plugin.xml file declares an XSLT file that extends XHTML processing:

<?xml version="1.0" encoding="UTF-8"?>
<plugin id="com.example.brandheader">
  <feature extension="dita.xsl.xhtml" file="xsl/header.xsl"/>

The xsl/header.xsl XSLT file referenced above in plugin.xml overrides the default header processing to provide a (theoretical) banner:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
  <xsl:template name="gen-user-header">
    <div><img src="http://www.example.com/company_banner.jpg" 
              alt="Example Company Banner"/></div>

Example – Overriding troff formatting

To apply custom formatting for your own domain to the intermediate markup generated as input to troff processing, create a plugin that extends dita.xsl.troff-ast and specify the path to your custom XSL as follows:

<feature extension="dita.xsl.troff-ast" file="xsl/your-domain.xsl"/>