1 <?xml version="1.0" encoding="utf-8"?>
2 <xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:d="http://docbook.org/ns/docbook"
5 xmlns:xlink="http://www.w3.org/1999/xlink">
7 <!-- Fredrik Unger <fred@tree.se> -->
9 <xsl:import href="../default.html.xsl"/>
11 <xsl:template match="d:link">
12 <xsl:variable name="name">
13 <xsl:call-template name="object.id"/>
15 <xsl:variable name="href">
16 <xsl:text>#ftn.</xsl:text>
17 <xsl:call-template name="object.id"/>
19 <xsl:apply-templates mode="no.anchor.mode"/>
21 <xsl:text>[</xsl:text>
22 <a name="{$name}" href="{$href}">
23 <xsl:apply-templates select="." mode="class.attribute"/>
24 <xsl:apply-templates select="." mode="footnote.number"/>
26 <xsl:text>]</xsl:text>
30 <xsl:template match="d:link" mode="footnote.number">
32 <xsl:when test="string-length(@label) != 0">
33 <xsl:value-of select="@label"/>
35 <xsl:when test="ancestor::d:table or ancestor::d:informaltable">
36 <xsl:variable name="tfnum">
37 <xsl:number level="any" from="d:table|d:informaltable" format="1"/>
41 <xsl:when test="string-length($table.footnote.number.symbols) >= $tfnum">
42 <xsl:value-of select="substring($table.footnote.number.symbols, $tfnum, 1)"/>
45 <xsl:number level="any" from="d:table | d:informaltable"
46 format="{$table.footnote.number.format}"/>
51 <xsl:variable name="pfoot" select="preceding::d:footnote[not(@label)]"/>
52 <xsl:variable name="ptfoot" select="preceding::d:table//d:footnote |
53 preceding::d:informaltable//d:footnote"/>
54 <xsl:variable name="fnum" select="count($pfoot) - count($ptfoot) + 1"/>
57 <xsl:when test="string-length($footnote.number.symbols) >= $fnum">
58 <xsl:value-of select="substring($footnote.number.symbols, $fnum, 1)"/>
61 <xsl:number value="$fnum" format="{$footnote.number.format}"/>
67 <xsl:template name="process.footnotes">
68 <xsl:variable name="footnotes" select=".//d:footnote | .//d:link"/>
69 <xsl:variable name="table.footnotes"
70 select=".//d:table//d:footnote | .//d:informaltable//d:footnote"/>
72 <!-- Only bother to do this if there's at least one non-table footnote -->
73 <xsl:if test="count($footnotes)>count($table.footnotes)">
74 <div class="footnotes">
76 <hr width="100" align="{$direction.align.start}"/>
77 <xsl:apply-templates select="$footnotes" mode="process.footnote.mode"/>
81 <xsl:if test="$annotation.support != 0 and //d:annotation">
82 <div class="annotation-list">
83 <div class="annotation-nocss">
84 <p>The following annotations are from this essay. You are seeing
85 them here because your browser doesn’t support the user-interface
86 techniques used to make them appear as ‘popups’ on modern browsers.</p>
89 <xsl:apply-templates select="//d:annotation"
90 mode="annotation-popup"/>
95 <xsl:template match="d:link" name="process.footnote" mode="process.footnote.mode">
97 <xsl:call-template name="common.html.attributes"/>
98 <xsl:variable name="href" select="./@xlink:href"/>
99 <xsl:text>[</xsl:text>
100 <xsl:apply-templates select="." mode="footnote.number"/>
101 <xsl:text>] </xsl:text>
102 <a href="{$href}"><xsl:value-of select="./@xlink:href"/></a>
106 <xsl:template match="d:link" mode="table.footnote.mode">
107 <xsl:call-template name="process.footnote"/>