8. Stylesheet to process footnotes

xsl:stylesheet id="stylesheet" exclude-result-prefixes="x2 lit xs" version="1.0" xml:lang="en"

fn
fn in footnotes mode
display-footnotes template

xsl:template name="display-footnotes" id="display-footnotes"
  xsl:variable name="fn" select="//xs:fn"
  xsl:if test="count($fn)>0"
    <hr />
    <h3>Notes</h3>
    <ol>
      xsl:apply-templates select="$fn" mode="footnotes"
    </ol>
  
xsl:template match="xs:fn" mode="footnotes" id="fn-footnotes"
  xsl:variable name="n"xsl:number level="any"
  <li id="footnote-{$n}">
    xsl:apply-templates
  </li>
xsl:template match="xs:fn" id="fn"
  xsl:variable name="n"xsl:number level="any"
  <sup>
    <a id="#footnote-anchor-{$n}" href="#footnote-{$n}">
      xsl:value-of select="$n"
    </a>
  </sup>