<?xml version="1.0" encoding="utf-8"?>
<!--
Footnotes.
-->
<stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Create a footnote. -->
<template name="footnote" match="footnote">
<common formats="/latex/xelatex/">
<xsl:text>\footnote{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</common>
<common formats="/html/xhtml/">
<a>
<xsl:attribute name="name">
<xsl:text>footnote-</xsl:text>
<xsl:number level="any" count="footnote" />
<xsl:text>-source</xsl:text>
</xsl:attribute>
<xsl:attribute name="href">
<xsl:text>#footnote-</xsl:text>
<xsl:number level="any" count="footnote" />
<xsl:text>-target</xsl:text>
</xsl:attribute>
<xsl:text>[</xsl:text>
<xsl:number level="any" count="footnote" />
<xsl:text>]</xsl:text>
</a>
</common>
</template>
<!-- Footnote back-links for HTML only (LaTeX does this all for you automatically). -->
<template name="footnote-list" match="footnote" mode="list">
<common formats="/html/xhtml/">
<p>
<a>
<xsl:attribute name="name">
<xsl:text>footnote-</xsl:text>
<xsl:number level="any" count="footnote" />
<xsl:text>-target</xsl:text>
</xsl:attribute>
<sup>
<xsl:text>[</xsl:text>
<xsl:number level="any" count="footnote" />
<xsl:text>]</xsl:text>
</sup>
</a>
<xsl:text> </xsl:text>
<xsl:apply-templates />
<xsl:text> </xsl:text>
<!-- Provide a back link to the original footnote marker. -->
<a>
<xsl:attribute name="href">
<xsl:text>#footnote-</xsl:text>
<xsl:number level="any" count="footnote" />
<xsl:text>-source</xsl:text>
</xsl:attribute>
<xsl:text>[Back]</xsl:text>
</a>
</p>
</common>
</template>
</stylesheet>