Applying Style

Suppose that you have a stylesheet which customizes another stylesheet, perhaps changing the formatting of a few elements. Suppose that one of these elements is formatted by a complex template in the base stylesheet, and all you want to change is one small, special case. How can you do this?

The answer is with <xsl:apply-imports>:

...
<xsl:import href="basestyle.xsl"/>
...
<xsl:template match="table">
  <xsl:choose>
    <xsl:when test="@role='something-special'">
      <xsl:call-template name="special-table-handler"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:apply-imports/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>