-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfootnote.xsl
More file actions
61 lines (46 loc) · 1.63 KB
/
footnote.xsl
File metadata and controls
61 lines (46 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:lxir="http://www.latex-lxir.org"
xmlns:mathml="http://www.w3.org/1998/Math/MathML"
exclude-result-prefixes="lxir mathml">
<xsl:template match="footnoteCall">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('#', ./@idref)"/>
</xsl:attribute>
<xsl:attribute name="class">footnoteMark</xsl:attribute>
<xsl:apply-templates select="@* | *"/>
</a>
</xsl:template>
<xsl:template match="footnoteCall/@idref"/>
<xsl:template match="footnoteCall/footnoteMark">
<xsl:apply-templates select="@* | * | text()"/>
</xsl:template>
<xsl:template match="footnotelist">
<section class="footnotelist">
<header><h1>Footnotes</h1></header>
<xsl:apply-templates select="@* | * | text()"/>
</section>
</xsl:template>
<xsl:template match="footnote">
<div class="footnote"><!-- a footnote can contain multiple paragraphs -->
<xsl:apply-templates select="@*"/>
<div class="footnote-intro"><!-- same problem as above -->
<xsl:apply-templates select="footnoteMark"/>
<xsl:apply-templates select="footnoteBackref"/>
</div>
<xsl:apply-templates select="footnoteText"/>
</div>
</xsl:template>
<xsl:template match="footnote/footnoteMark">
<span class="footnoteMark"><xsl:apply-templates select="@* | * | text()"/></span>
</xsl:template>
<xsl:template match="footnoteBackref">
<a href="{concat('#', @idref)}" class="footnoteBackref">^</a>
</xsl:template>
<xsl:template match="footnoteText">
<div class="footnoteText"><xsl:apply-templates select="@* | * | text()"/></div>
</xsl:template>
</xsl:stylesheet>