forked from EpiDoc/Stylesheets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
teiaddanddel.xsl
162 lines (152 loc) · 6.84 KB
/
teiaddanddel.xsl
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id$ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:t="http://www.tei-c.org/ns/1.0" exclude-result-prefixes="t" version="2.0">
<!-- Contains templates for subst, add and del -->
<!-- Imported by htm-teiaddanddel.xsl or called directly from start-txt.xsl -->
<xsl:template match="t:subst">
<xsl:param name="parm-external-app-style" tunnel="yes" required="no"/>
<xsl:param name="parm-internal-app-style" tunnel="yes" required="no"/>
<xsl:param name="location" tunnel="yes" required="no"/>
<xsl:apply-templates/>
<xsl:if test="$parm-internal-app-style = 'ddbdp'">
<!-- Found in [htm|txt]-tpl-apparatus -->
<xsl:call-template name="app-link">
<xsl:with-param name="location">
<xsl:choose>
<xsl:when test="$location = 'apparatus'">apparatus</xsl:when>
<xsl:otherwise>text</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="t:add">
<xsl:param name="parm-leiden-style" tunnel="yes" required="no"></xsl:param>
<xsl:choose>
<xsl:when test="$parm-leiden-style=('ddbdp','dclp','sammelbuch')">
<xsl:choose>
<xsl:when test="parent::t:subst"/>
<xsl:when test="@place = 'above'">
<xsl:text>\</xsl:text>
</xsl:when>
<xsl:when test="@place = 'below'">
<xsl:text>/</xsl:text>
</xsl:when>
<xsl:when test="@place = 'left'">
<xsl:text>(added at left: </xsl:text>
</xsl:when>
<xsl:when test="@place = 'right'">
<xsl:text>(added at right: </xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="$parm-leiden-style=('petrae','iospe')">
<xsl:text>\</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="parent::t:subst or @place='overstrike'">
<xsl:text>«</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>`</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates/>
<xsl:call-template name="cert-low"/>
<xsl:choose>
<xsl:when test="$parm-leiden-style=('ddbdp','dclp','sammelbuch')">
<xsl:choose>
<!-- if my parent is subst which in turn is in the appcrit-part of a further app-like element
(i.e. my ancestor is reg, corr, rdg, or del[corrected]), then include value of my sibling del in parens -->
<xsl:when test="parent::t:subst and ancestor::t:*[local-name()=('reg','corr','rdg')
or self::t:del[@rend='corrected']]">
<!-- If add contains app, *only* render del (because add is rendered before the subst by app templates) -->
<xsl:text> (</xsl:text><xsl:choose>
<xsl:when test="t:app"><xsl:call-template name="resolvesubst">
<!-- From tpl-apparatus.xsl -->
<xsl:with-param name="delpath" select="../t:del/node()"/>
</xsl:call-template></xsl:when>
<xsl:otherwise><xsl:call-template name="resolvesubst">
<!-- From tpl-apparatus.xsl -->
<xsl:with-param name="delpath" select="../t:del/node()"/>
<xsl:with-param name="addpath" select="node()"/>
</xsl:call-template></xsl:otherwise></xsl:choose><xsl:text>)</xsl:text>
</xsl:when>
<xsl:when test="parent::t:subst"/>
<xsl:when test="@place = 'above'">
<xsl:text>/</xsl:text>
</xsl:when>
<xsl:when test="@place = 'below'">
<xsl:text>\</xsl:text>
</xsl:when>
<xsl:when test="@place = 'left' or @place = 'right'">
<xsl:text>)</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="$parm-leiden-style=('petrae','iospe')">
<xsl:text>/</xsl:text>
</xsl:when>
<xsl:when test="parent::t:subst or @place='overstrike'">
<xsl:text>»</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>´</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="t:del">
<xsl:param name="parm-internal-app-style" tunnel="yes" required="no"/>
<xsl:param name="parm-leiden-style" tunnel="yes" required="no"/>
<xsl:param name="parm-apparatus-style" tunnel="yes" required="no"/>
<xsl:param name="location" tunnel="yes" required="no"/>
<xsl:if test="$parm-apparatus-style = 'ddbdp'">
<xsl:if test="@rend = 'slashes' or @rend = 'cross-strokes'">
<!-- Found in [htm | txt]-tpl-apparatus -->
<xsl:call-template name="app-link">
<xsl:with-param name="location">
<xsl:choose>
<xsl:when test="$location = 'apparatus'">apparatus</xsl:when>
<xsl:otherwise>text</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:if>
<xsl:choose>
<xsl:when test="starts-with($parm-leiden-style, 'edh') or $parm-leiden-style=('petrae','iospe')">
<xsl:text>[[</xsl:text>
<xsl:apply-templates/>
<xsl:text>]]</xsl:text>
</xsl:when>
<xsl:when test="($parm-leiden-style = ('ddbdp','dclp','sammelbuch')) and @rend='slashes'">
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="($parm-leiden-style = ('ddbdp','dclp','sammelbuch')) and @rend='cross-strokes'">
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="$parm-leiden-style = 'rib'">
<xsl:choose>
<xsl:when test="@rend='erasure'">
<span class="erasure"><xsl:apply-templates/></span>
</xsl:when>
<xsl:when test="not(@rend)"/>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="parent::t:subst"/>
<xsl:otherwise>
<xsl:text>⟦</xsl:text>
<xsl:apply-templates/>
<xsl:call-template name="cert-low"/>
<xsl:text>⟧</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>