1 <?xml version="1.0" encoding="US-ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets. Do not edit this file.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="exsl" version="1.0">
6 <!-- ********************************************************************
8 ********************************************************************
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.
14 ******************************************************************** -->
16 <xsl:template match="footnote">
17 <xsl:variable name="name">
18 <xsl:call-template name="object.id"/>
20 <xsl:variable name="href">
21 <xsl:text>#ftn.</xsl:text>
22 <xsl:call-template name="object.id"/>
26 <xsl:when test="ancestor::tgroup">
28 <xsl:text>[</xsl:text>
29 <a id="{$name}" href="{$href}">
30 <xsl:apply-templates select="." mode="footnote.number"/>
32 <xsl:text>]</xsl:text>
37 <xsl:text>[</xsl:text>
38 <a id="{$name}" href="{$href}">
39 <xsl:apply-templates select="." mode="footnote.number"/>
41 <xsl:text>]</xsl:text>
47 <xsl:template match="footnoteref">
48 <xsl:variable name="targets" select="key('id',@linkend)"/>
49 <xsl:variable name="footnote" select="$targets[1]"/>
50 <xsl:variable name="href">
51 <xsl:text>#ftn.</xsl:text>
52 <xsl:call-template name="object.id">
53 <xsl:with-param name="object" select="$footnote"/>
57 <xsl:text>[</xsl:text>
59 <xsl:apply-templates select="$footnote" mode="footnote.number"/>
61 <xsl:text>]</xsl:text>
65 <xsl:template match="footnote" mode="footnote.number">
67 <xsl:when test="string-length(@label) != 0">
68 <xsl:value-of select="@label"/>
70 <xsl:when test="ancestor::tgroup">
71 <xsl:variable name="tfnum">
72 <xsl:number level="any" from="table|informaltable" format="1"/>
76 <xsl:when test="string-length($table.footnote.number.symbols) >= $tfnum">
77 <xsl:value-of select="substring($table.footnote.number.symbols, $tfnum, 1)"/>
80 <xsl:number level="any" from="tgroup" format="{$table.footnote.number.format}"/>
85 <xsl:variable name="pfoot" select="preceding::footnote[not(@label)]"/>
86 <xsl:variable name="ptfoot" select="preceding::tgroup//footnote"/>
87 <xsl:variable name="fnum" select="count($pfoot) - count($ptfoot) + 1"/>
90 <xsl:when test="string-length($footnote.number.symbols) >= $fnum">
91 <xsl:value-of select="substring($footnote.number.symbols, $fnum, 1)"/>
94 <xsl:number value="$fnum" format="{$footnote.number.format}"/>
101 <!-- ==================================================================== -->
103 <xsl:template match="footnote/para[1]|footnote/simpara[1]" priority="2">
104 <!-- this only works if the first thing in a footnote is a para, -->
105 <!-- which is ok, because it usually is. -->
106 <xsl:variable name="name">
107 <xsl:text>ftn.</xsl:text>
108 <xsl:call-template name="object.id">
109 <xsl:with-param name="object" select="ancestor::footnote"/>
112 <xsl:variable name="href">
113 <xsl:text>#</xsl:text>
114 <xsl:call-template name="object.id">
115 <xsl:with-param name="object" select="ancestor::footnote"/>
119 <xsl:if test="@role and $para.propagates.style != 0">
120 <xsl:attribute name="class">
121 <xsl:value-of select="@role"/>
125 <xsl:text>[</xsl:text>
126 <a id="{$name}" href="{$href}">
127 <xsl:apply-templates select="ancestor::footnote" mode="footnote.number"/>
129 <xsl:text>] </xsl:text>
131 <xsl:apply-templates/>
135 <!-- ==================================================================== -->
137 <xsl:template match="*" mode="footnote.body.number">
138 <xsl:variable name="name">
139 <xsl:text>ftn.</xsl:text>
140 <xsl:call-template name="object.id">
141 <xsl:with-param name="object" select="ancestor::footnote"/>
144 <xsl:variable name="href">
145 <xsl:text>#</xsl:text>
146 <xsl:call-template name="object.id">
147 <xsl:with-param name="object" select="ancestor::footnote"/>
150 <xsl:variable name="footnote.mark">
152 <xsl:text>[</xsl:text>
153 <a id="{$name}" href="{$href}">
154 <xsl:apply-templates select="ancestor::footnote" mode="footnote.number"/>
156 <xsl:text>] </xsl:text>
160 <xsl:variable name="html">
161 <xsl:apply-templates select="."/>
165 <xsl:when test="function-available('exsl:node-set')">
166 <xsl:variable name="html-nodes" select="exsl:node-set($html)"/>
168 <xsl:when test="$html-nodes//p">
169 <xsl:apply-templates select="$html-nodes" mode="insert.html.p">
170 <xsl:with-param name="mark" select="$footnote.mark"/>
171 </xsl:apply-templates>
174 <xsl:apply-templates select="$html-nodes" mode="insert.html.text">
175 <xsl:with-param name="mark" select="$footnote.mark"/>
176 </xsl:apply-templates>
181 <xsl:copy-of select="$html"/>
186 <!-- ==================================================================== -->
189 <xsl:template name="count-element-from">
190 <xsl:param name="from" select=".."/>
191 <xsl:param name="to" select="."/>
192 <xsl:param name="count" select="0"/>
193 <xsl:param name="list" select="$from/following::*[name(.)=name($to)]
194 |$from/descendant-or-self::*[name(.)=name($to)]"/>
197 <xsl:when test="not($list)">
198 <xsl:text>-1</xsl:text>
200 <xsl:when test="$list[1] = $to">
201 <xsl:value-of select="$count + 1"/>
209 <!-- ==================================================================== -->
211 <xsl:template name="process.footnotes">
212 <xsl:variable name="footnotes" select=".//footnote"/>
213 <xsl:variable name="table.footnotes" select=".//tgroup//footnote"/>
215 <!-- Only bother to do this if there's at least one non-table footnote -->
216 <xsl:if test="count($footnotes)>count($table.footnotes)">
217 <div class="footnotes">
219 <hr width="100" align="left"/>
220 <xsl:apply-templates select="$footnotes" mode="process.footnote.mode"/>
224 <xsl:if test="$annotation.support != 0 and //annotation">
225 <div class="annotation-list">
226 <div class="annotation-nocss">
227 <p>The following annotations are from this essay. You are seeing
228 them here because your browser doesn’t support the user-interface
229 techniques used to make them appear as ‘popups’ on modern browsers.</p>
232 <xsl:apply-templates select="//annotation" mode="annotation-popup"/>
237 <xsl:template name="process.chunk.footnotes">
241 <xsl:template match="footnote" name="process.footnote" mode="process.footnote.mode">
243 <xsl:when test="local-name(*[1]) = 'para' or local-name(*[1]) = 'simpara'">
244 <div class="{name(.)}">
245 <xsl:apply-templates/>
249 <xsl:when test="$html.cleanup != 0 and function-available('exsl:node-set')">
250 <div class="{name(.)}">
251 <xsl:apply-templates select="*[1]" mode="footnote.body.number"/>
252 <xsl:apply-templates select="*[position() > 1]"/>
258 <xsl:text>Warning: footnote number may not be generated </xsl:text>
259 <xsl:text>correctly; </xsl:text>
260 <xsl:value-of select="local-name(*[1])"/>
261 <xsl:text> unexpected as first child of footnote.</xsl:text>
263 <div class="{name(.)}">
264 <xsl:apply-templates/>
270 <xsl:template match="tgroup//footnote" mode="process.footnote.mode">
273 <xsl:template match="footnote" mode="table.footnote.mode">
274 <xsl:call-template name="process.footnote"/>