Custom Processing of XML Content

There are several XSLT files you can optionally place in your document type to automatically pre-process any document of that type.
/HARP-META/preprocess.xsl
This file will be applied early in the processing of any content using the document type. It will be applied after XInclude resolution and application of default attributes, but before any other processing occurs. You can use this hook to perform TD-specific cleanup or modifications to your document. This is valid for both non-DITA and DITA document types.
/HARP-META/preprocessTopic.xsl
When processing a DITA map, this transform will be applied to topics referenced by that map before they are processed and contextualized.
/HARP-META/postprocessTopic.xsl
When processing a DITA map, this transform will be applied to contextualized topics after all other processing has completed.
/HARP-META/preprocessMap.xsl
When processing a DITA map, this transform will be applied after the map is flattened but before other processing is applied.
/HARP-META/postprocessMap.xsl
When processing a DITA map, this transform will be applied after all other DITA pre-processing, including topic contextualization.

For example, say you wanted to impose a rule that for Titania Delivery, all second-level <topicref> elements should be presented as a single chunk. You could use /HARP-META/preprocess.xsl to add chunk="to-content" to such topicrefs.

<xsl:template match="/&map;/&topicref;/&topicref;[not(@chunk)]">
  <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:attribute name="chunk">to-content</xsl:attribute>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>