Figure 4. recursive.xml
<doc>
<para>This is a <emphasis>test</emphasis>.
<emphasis>Nested <emphasis>emphasis</emphasis></emphasis>.</para>
</doc>
Figure 5. recursive.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="doc">
<html><head><title>A Document</title></head>
<body><xsl:apply-templates/></body></html>
</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:template match="emphasis/emphasis">
<b><xsl:apply-templates/></b>
</xsl:template>
</xsl:stylesheet>
Figure 6. recursive.html
<html>
<head>
<title>A Document</title>
</head>
<body>
<p>This is a <i>test</i>.
<i>Nested <b>emphasis</b></i>.</p>
</body>
</html>