1 | <?xml version="1.0" encoding="ASCII"?> |
---|
2 | <!--This file was created automatically by html2xhtml--> |
---|
3 | <!--from the HTML stylesheets.--> |
---|
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"> |
---|
5 | |
---|
6 | <!-- ******************************************************************** |
---|
7 | $Id$ |
---|
8 | ******************************************************************** |
---|
9 | |
---|
10 | This file is part of the XSL DocBook Stylesheet distribution. |
---|
11 | See ../README or http://docbook.sf.net/release/xsl/current/ for |
---|
12 | copyright and other information. |
---|
13 | |
---|
14 | ******************************************************************** --> |
---|
15 | |
---|
16 | <xsl:template match="footnote"> |
---|
17 | <xsl:variable name="name"> |
---|
18 | <xsl:call-template name="object.id"/> |
---|
19 | </xsl:variable> |
---|
20 | <xsl:variable name="href"> |
---|
21 | <xsl:text>#ftn.</xsl:text> |
---|
22 | <xsl:call-template name="object.id"/> |
---|
23 | </xsl:variable> |
---|
24 | |
---|
25 | <xsl:choose> |
---|
26 | <xsl:when test="ancestor::tgroup"> |
---|
27 | <sup> |
---|
28 | <xsl:text>[</xsl:text> |
---|
29 | <a id="{$name}" href="{$href}"> |
---|
30 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
31 | <xsl:apply-templates select="." mode="footnote.number"/> |
---|
32 | </a> |
---|
33 | <xsl:text>]</xsl:text> |
---|
34 | </sup> |
---|
35 | </xsl:when> |
---|
36 | <xsl:otherwise> |
---|
37 | <sup> |
---|
38 | <xsl:text>[</xsl:text> |
---|
39 | <a id="{$name}" href="{$href}"> |
---|
40 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
41 | <xsl:apply-templates select="." mode="footnote.number"/> |
---|
42 | </a> |
---|
43 | <xsl:text>]</xsl:text> |
---|
44 | </sup> |
---|
45 | </xsl:otherwise> |
---|
46 | </xsl:choose> |
---|
47 | </xsl:template> |
---|
48 | |
---|
49 | <xsl:template match="footnoteref"> |
---|
50 | <xsl:variable name="targets" select="key('id',@linkend)"/> |
---|
51 | <xsl:variable name="footnote" select="$targets[1]"/> |
---|
52 | |
---|
53 | <xsl:variable name="target.href"> |
---|
54 | <xsl:call-template name="href.target"> |
---|
55 | <xsl:with-param name="object" select="$footnote"/> |
---|
56 | </xsl:call-template> |
---|
57 | </xsl:variable> |
---|
58 | |
---|
59 | <xsl:variable name="href"> |
---|
60 | <xsl:value-of select="substring-before($target.href, '#')"/> |
---|
61 | <xsl:text>#ftn.</xsl:text> |
---|
62 | <xsl:value-of select="substring-after($target.href, '#')"/> |
---|
63 | </xsl:variable> |
---|
64 | |
---|
65 | <sup> |
---|
66 | <xsl:text>[</xsl:text> |
---|
67 | <a href="{$href}"> |
---|
68 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
69 | <xsl:apply-templates select="$footnote" mode="footnote.number"/> |
---|
70 | </a> |
---|
71 | <xsl:text>]</xsl:text> |
---|
72 | </sup> |
---|
73 | </xsl:template> |
---|
74 | |
---|
75 | <xsl:template match="footnote" mode="footnote.number"> |
---|
76 | <xsl:choose> |
---|
77 | <xsl:when test="string-length(@label) != 0"> |
---|
78 | <xsl:value-of select="@label"/> |
---|
79 | </xsl:when> |
---|
80 | <xsl:when test="ancestor::tgroup"> |
---|
81 | <xsl:variable name="tfnum"> |
---|
82 | <xsl:number level="any" from="table|informaltable" format="1"/> |
---|
83 | </xsl:variable> |
---|
84 | |
---|
85 | <xsl:choose> |
---|
86 | <xsl:when test="string-length($table.footnote.number.symbols) >= $tfnum"> |
---|
87 | <xsl:value-of select="substring($table.footnote.number.symbols, $tfnum, 1)"/> |
---|
88 | </xsl:when> |
---|
89 | <xsl:otherwise> |
---|
90 | <xsl:number level="any" from="tgroup" format="{$table.footnote.number.format}"/> |
---|
91 | </xsl:otherwise> |
---|
92 | </xsl:choose> |
---|
93 | </xsl:when> |
---|
94 | <xsl:otherwise> |
---|
95 | <xsl:variable name="pfoot" select="preceding::footnote[not(@label)]"/> |
---|
96 | <xsl:variable name="ptfoot" select="preceding::tgroup//footnote"/> |
---|
97 | <xsl:variable name="fnum" select="count($pfoot) - count($ptfoot) + 1"/> |
---|
98 | |
---|
99 | <xsl:choose> |
---|
100 | <xsl:when test="string-length($footnote.number.symbols) >= $fnum"> |
---|
101 | <xsl:value-of select="substring($footnote.number.symbols, $fnum, 1)"/> |
---|
102 | </xsl:when> |
---|
103 | <xsl:otherwise> |
---|
104 | <xsl:number value="$fnum" format="{$footnote.number.format}"/> |
---|
105 | </xsl:otherwise> |
---|
106 | </xsl:choose> |
---|
107 | </xsl:otherwise> |
---|
108 | </xsl:choose> |
---|
109 | </xsl:template> |
---|
110 | |
---|
111 | <!-- ==================================================================== --> |
---|
112 | |
---|
113 | <xsl:template match="footnote/para[1]|footnote/simpara[1]" priority="2"> |
---|
114 | <!-- this only works if the first thing in a footnote is a para, --> |
---|
115 | <!-- which is ok, because it usually is. --> |
---|
116 | <xsl:variable name="name"> |
---|
117 | <xsl:text>ftn.</xsl:text> |
---|
118 | <xsl:call-template name="object.id"> |
---|
119 | <xsl:with-param name="object" select="ancestor::footnote"/> |
---|
120 | </xsl:call-template> |
---|
121 | </xsl:variable> |
---|
122 | <xsl:variable name="href"> |
---|
123 | <xsl:text>#</xsl:text> |
---|
124 | <xsl:call-template name="object.id"> |
---|
125 | <xsl:with-param name="object" select="ancestor::footnote"/> |
---|
126 | </xsl:call-template> |
---|
127 | </xsl:variable> |
---|
128 | <p> |
---|
129 | <xsl:if test="@role and $para.propagates.style != 0"> |
---|
130 | <xsl:apply-templates select="." mode="class.attribute"> |
---|
131 | <xsl:with-param name="class" select="@role"/> |
---|
132 | </xsl:apply-templates> |
---|
133 | </xsl:if> |
---|
134 | <sup> |
---|
135 | <xsl:text>[</xsl:text> |
---|
136 | <a id="{$name}" href="{$href}"> |
---|
137 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
138 | <xsl:apply-templates select="ancestor::footnote" mode="footnote.number"/> |
---|
139 | </a> |
---|
140 | <xsl:text>] </xsl:text> |
---|
141 | </sup> |
---|
142 | <xsl:apply-templates/> |
---|
143 | </p> |
---|
144 | </xsl:template> |
---|
145 | |
---|
146 | <!-- ==================================================================== --> |
---|
147 | |
---|
148 | <xsl:template match="*" mode="footnote.body.number"> |
---|
149 | <xsl:variable name="name"> |
---|
150 | <xsl:text>ftn.</xsl:text> |
---|
151 | <xsl:call-template name="object.id"> |
---|
152 | <xsl:with-param name="object" select="ancestor::footnote"/> |
---|
153 | </xsl:call-template> |
---|
154 | </xsl:variable> |
---|
155 | <xsl:variable name="href"> |
---|
156 | <xsl:text>#</xsl:text> |
---|
157 | <xsl:call-template name="object.id"> |
---|
158 | <xsl:with-param name="object" select="ancestor::footnote"/> |
---|
159 | </xsl:call-template> |
---|
160 | </xsl:variable> |
---|
161 | <xsl:variable name="footnote.mark"> |
---|
162 | <sup> |
---|
163 | <xsl:text>[</xsl:text> |
---|
164 | <a id="{$name}" href="{$href}"> |
---|
165 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
166 | <xsl:apply-templates select="ancestor::footnote" mode="footnote.number"/> |
---|
167 | </a> |
---|
168 | <xsl:text>] </xsl:text> |
---|
169 | </sup> |
---|
170 | </xsl:variable> |
---|
171 | |
---|
172 | <xsl:variable name="html"> |
---|
173 | <xsl:apply-templates select="."/> |
---|
174 | </xsl:variable> |
---|
175 | |
---|
176 | <xsl:choose> |
---|
177 | <xsl:when test="function-available('exsl:node-set')"> |
---|
178 | <xsl:variable name="html-nodes" select="exsl:node-set($html)"/> |
---|
179 | <xsl:choose> |
---|
180 | <xsl:when test="$html-nodes//p"> |
---|
181 | <xsl:apply-templates select="$html-nodes" mode="insert.html.p"> |
---|
182 | <xsl:with-param name="mark" select="$footnote.mark"/> |
---|
183 | </xsl:apply-templates> |
---|
184 | </xsl:when> |
---|
185 | <xsl:otherwise> |
---|
186 | <xsl:apply-templates select="$html-nodes" mode="insert.html.text"> |
---|
187 | <xsl:with-param name="mark" select="$footnote.mark"/> |
---|
188 | </xsl:apply-templates> |
---|
189 | </xsl:otherwise> |
---|
190 | </xsl:choose> |
---|
191 | </xsl:when> |
---|
192 | <xsl:otherwise> |
---|
193 | <xsl:copy-of select="$html"/> |
---|
194 | </xsl:otherwise> |
---|
195 | </xsl:choose> |
---|
196 | </xsl:template> |
---|
197 | |
---|
198 | <!-- ==================================================================== --> |
---|
199 | |
---|
200 | <!-- |
---|
201 | <xsl:template name="count-element-from"> |
---|
202 | <xsl:param name="from" select=".."/> |
---|
203 | <xsl:param name="to" select="."/> |
---|
204 | <xsl:param name="count" select="0"/> |
---|
205 | <xsl:param name="list" select="$from/following::*[local-name(.)=local-name($to)] |
---|
206 | |$from/descendant-or-self::*[local-name(.)=local-name($to)]"/> |
---|
207 | |
---|
208 | <xsl:choose> |
---|
209 | <xsl:when test="not($list)"> |
---|
210 | <xsl:text>-1</xsl:text> |
---|
211 | </xsl:when> |
---|
212 | <xsl:when test="$list[1] = $to"> |
---|
213 | <xsl:value-of select="$count + 1"/> |
---|
214 | </xsl:when> |
---|
215 | <xsl:otherwise> |
---|
216 | </xsl:otherwise> |
---|
217 | </xsl:choose> |
---|
218 | </xsl:template> |
---|
219 | --> |
---|
220 | |
---|
221 | <!-- ==================================================================== --> |
---|
222 | |
---|
223 | <xsl:template name="process.footnotes"> |
---|
224 | <xsl:variable name="footnotes" select=".//footnote"/> |
---|
225 | <xsl:variable name="table.footnotes" select=".//tgroup//footnote"/> |
---|
226 | |
---|
227 | <!-- Only bother to do this if there's at least one non-table footnote --> |
---|
228 | <xsl:if test="count($footnotes)>count($table.footnotes)"> |
---|
229 | <div class="footnotes"> |
---|
230 | <br/> |
---|
231 | <hr width="100" align="left"/> |
---|
232 | <xsl:apply-templates select="$footnotes" mode="process.footnote.mode"/> |
---|
233 | </div> |
---|
234 | </xsl:if> |
---|
235 | |
---|
236 | <xsl:if test="$annotation.support != 0 and //annotation"> |
---|
237 | <div class="annotation-list"> |
---|
238 | <div class="annotation-nocss"> |
---|
239 | <p>The following annotations are from this essay. You are seeing |
---|
240 | them here because your browser doesn’t support the user-interface |
---|
241 | techniques used to make them appear as ‘popups’ on modern browsers.</p> |
---|
242 | </div> |
---|
243 | |
---|
244 | <xsl:apply-templates select="//annotation" mode="annotation-popup"/> |
---|
245 | </div> |
---|
246 | </xsl:if> |
---|
247 | </xsl:template> |
---|
248 | |
---|
249 | <xsl:template name="process.chunk.footnotes"> |
---|
250 | <!-- nop --> |
---|
251 | </xsl:template> |
---|
252 | |
---|
253 | <xsl:template match="footnote" name="process.footnote" mode="process.footnote.mode"> |
---|
254 | <xsl:choose> |
---|
255 | <xsl:when test="local-name(*[1]) = 'para' or local-name(*[1]) = 'simpara'"> |
---|
256 | <div> |
---|
257 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
258 | <xsl:apply-templates/> |
---|
259 | </div> |
---|
260 | </xsl:when> |
---|
261 | |
---|
262 | <xsl:when test="$html.cleanup != 0 and function-available('exsl:node-set')"> |
---|
263 | <div> |
---|
264 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
265 | <xsl:apply-templates select="*[1]" mode="footnote.body.number"/> |
---|
266 | <xsl:apply-templates select="*[position() > 1]"/> |
---|
267 | </div> |
---|
268 | </xsl:when> |
---|
269 | |
---|
270 | <xsl:otherwise> |
---|
271 | <xsl:message> |
---|
272 | <xsl:text>Warning: footnote number may not be generated </xsl:text> |
---|
273 | <xsl:text>correctly; </xsl:text> |
---|
274 | <xsl:value-of select="local-name(*[1])"/> |
---|
275 | <xsl:text> unexpected as first child of footnote.</xsl:text> |
---|
276 | </xsl:message> |
---|
277 | <div> |
---|
278 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
279 | <xsl:apply-templates/> |
---|
280 | </div> |
---|
281 | </xsl:otherwise> |
---|
282 | </xsl:choose> |
---|
283 | </xsl:template> |
---|
284 | |
---|
285 | <xsl:template match="tgroup//footnote" mode="process.footnote.mode"> |
---|
286 | </xsl:template> |
---|
287 | |
---|
288 | <xsl:template match="footnote" mode="table.footnote.mode"> |
---|
289 | <xsl:call-template name="process.footnote"/> |
---|
290 | </xsl:template> |
---|
291 | |
---|
292 | </xsl:stylesheet> |
---|