Modes Example (Broken)

Without modes, you always get the same template:

Figure 9. modes-broken.xsl

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

<xsl:template match="chapter/title">
  <h2><xsl:apply-templates/></h2>
</xsl:template>

<xsl:template match="xref">
  <xsl:variable name="linkend" select="@linkend"/>
  <xsl:apply-templates select="//*[@id=$linkend]/title"/>
</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 10. modes-broken.html

<?xml version="1.0" encoding="utf-8"?>
<h2>Chapter Title</h2>

<p>This chapter is self-referential:
<h2>Chapter Title</h2>.</p>