This repository was archived by the owner on Dec 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwikisource.xsl
More file actions
93 lines (91 loc) · 2.76 KB
/
wikisource.xsl
File metadata and controls
93 lines (91 loc) · 2.76 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:html="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="html"
>
<xsl:output indent="yes" encoding="UTF-8" method="xml" omit-xml-declaration="yes"/>
<xsl:variable name="lf" select="' '"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="
html:div[@class='tableItem']
| html:span[@class='mw-cite-backlink']
| html:div[@id='mw-navigation']
">
<!-- strip -->
</xsl:template>
<xsl:template match="
html:ol[@class='references']
">
<xsl:apply-templates/>
<!-- cross -->
</xsl:template>
<!--
<li id="cite_note-p132-17"> => <div id="sdfootnote17">
-->
<xsl:template match="html:li[starts-with(@id, 'cite_note')]">
<xsl:variable name="num">
<xsl:variable name="tmp" select="substring-after(@id, '-')"/>
<xsl:choose>
<xsl:when test="contains($tmp, '-')">
<xsl:value-of select="substring-after($tmp, '-')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$tmp"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<div id="sdfootnote{$num}">
<!--
<p>
<a name="sdfootnote{$num}sym" href="#sdfootnote{$num}anc" class="sdfootnotesym-western">
<xsl:value-of select="$num"/>
</a>
<xsl:apply-templates select="node()[not(self::html:p)]"/>
</p>
<xsl:apply-templates select="html:p"/>
-->
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="html:span[@class='reference-text']">
<xsl:choose>
<xsl:when test="ancestor::html:p">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<p>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
</p>
</xsl:otherwise>
</xsl:choose>
<!--
<xsl:apply-templates/>
-->
</xsl:template>
<!--
<a href="#cite_note-1"> =>
<a class="sdfootnoteanc" name="sdfootnote1anc" href="#sdfootnote1sym">
-->
<xsl:template match="html:a[starts-with(@href, '#cite_note')]">
<xsl:variable name="num">
<xsl:variable name="tmp" select="substring-after(@href, '-')"/>
<xsl:choose>
<xsl:when test="contains($tmp, '-')">
<xsl:value-of select="substring-after($tmp, '-')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$tmp"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<a name="sdfootnote{$num}anc" class="sdfootnoteanc" href="#sdfootnote{$num}sym">
<xsl:apply-templates/>
</a>
</xsl:template>
</xsl:transform>