Figure 16. namedtemplate.xml
<chapter>
<warning>
<para>Using a damaged extension cord may cause a fire.</para>
</warning>
<caution>
<para>Freshly brewed coffee is hot.</para>
</caution>
</chapter>
Figure 17. namedtemplate.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template name="admonition">
<xsl:param name="type">Warning</xsl:param>
<table border="1">
<tr><th><xsl:value-of select="$type"/>:</th></tr>
<tr><td><xsl:apply-templates/></td></tr>
</table>
</xsl:template>
<xsl:template match="warning">
<xsl:call-template name="admonition"/>
</xsl:template>
<xsl:template match="caution">
<xsl:call-template name="admonition">
<xsl:with-param name="type">Caution</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="para">
<p><xsl:apply-templates/></p>
</xsl:template>
<xsl:template match="emphasis">
<i><xsl:apply-templates/></i>
</xsl:template>
</xsl:stylesheet>
Figure 18. namedtemplate.html
<table border="1">
<tr>
<th>Warning:</th>
</tr>
<tr>
<td>
<p>Using a damaged extension cord may cause a fire.</p>
</td>
</tr>
</table>
<table border="1">
<tr>
<th>Caution:</th>
</tr>
<tr>
<td>
<p>Freshly brewed coffee is hot.</p>
</td>
</tr>
</table>