1<?xml version='1.0'?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                xmlns:fo="http://www.w3.org/1999/XSL/Format"
4                version='1.0'>
5
6<!-- ********************************************************************
7     $Id$
8     ********************************************************************
9
10     This file is part of the XSL DocBook Stylesheet distribution.
11     See /README or http://nwalsh.com/docbook/xsl/ for copyright
12     and other information.
13
14     ******************************************************************** -->
15
16<xsl:template match="footnote">
17  <fo:footnote>
18    <fo:inline>
19      <xsl:text>[</xsl:text>
20      <xsl:apply-templates select="." mode="footnote.number"/>
21      <xsl:text>]</xsl:text>
22    </fo:inline>
23    <fo:footnote-body font-size="{$footnote.font.size}">
24      <xsl:apply-templates/>
25    </fo:footnote-body>
26  </fo:footnote>
27</xsl:template>
28
29<xsl:template match="footnoteref">
30  <xsl:variable name="footnote" select="id(@linkend)"/>
31  <fo:inline>
32    <xsl:text>[</xsl:text>
33    <xsl:apply-templates select="$footnote" mode="footnote.number"/>
34    <xsl:text>]</xsl:text>
35  </fo:inline>
36</xsl:template>
37
38<xsl:template match="footnote" mode="footnote.number">
39  <xsl:number level="any" format="1"/>
40</xsl:template>
41
42<!-- ==================================================================== -->
43
44<xsl:template match="footnote/para[1]
45                     |footnote/simpara[1]
46                     |footnote/formalpara[1]"
47              priority="2">
48  <!-- this only works if the first thing in a footnote is a para, -->
49  <!-- which is ok, because it usually is. -->
50  <fo:block>
51    <xsl:text>[</xsl:text>
52    <xsl:apply-templates select="ancestor::footnote" mode="footnote.number"/>
53    <xsl:text>] </xsl:text>
54    <xsl:apply-templates/>
55  </fo:block>
56</xsl:template>
57
58</xsl:stylesheet>
59