Common actions can be separted as a "named template".
The syntax is very similar:
<xsl:template name="internal-style"> <style type="text/css"> ... </style> </xsl:template>
The context node remains the same when it is used:
<xsl:template name="make-attribute"> <xsl:attribute name="altid/@type"> <xsl:apply-templates/> </xsl:attribute> </xsl:template>