forked from EpiDoc/Stylesheets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
htm-teiapp.xsl
295 lines (285 loc) · 14.8 KB
/
htm-teiapp.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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id$ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:t="http://www.tei-c.org/ns/1.0" exclude-result-prefixes="t"
version="2.0">
<!-- Contains app and its children rdg, ptr, note and lem -->
<xsl:template match="t:app">
<xsl:param name="parm-internal-app-style" tunnel="yes" required="no"></xsl:param>
<xsl:param name="parm-external-app-style" tunnel="yes" required="no"></xsl:param>
<xsl:param name="parm-edn-structure" tunnel="yes" required="no"></xsl:param>
<xsl:param name="location" tunnel="yes" required="no"/>
<xsl:choose>
<xsl:when test="$parm-edn-structure = 'igcyr'">
<xsl:for-each select=".">
<p>
<xsl:value-of select="@loc"/><xsl:text> </xsl:text>
<xsl:if test="t:lem">
<xsl:for-each select="t:lem[@resp]">
<xsl:variable name="authors">
<xsl:variable name="resp" select="tokenize(./@resp,' ')"/>
<xsl:for-each select="$resp">
<xsl:variable name="indresp">
<xsl:sequence select="substring-after(.,'#')"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="document('Workspace/files/BIBLIOGRAPHY.xml')//t:bibl[@xml:id = $indresp]">
<xsl:for-each
select="document('Workspace/files/BIBLIOGRAPHY.xml')//t:bibl[@xml:id = $indresp]">
<xsl:text> </xsl:text>
<xsl:choose><xsl:when test="t:author"><xsl:value-of select="t:author[1]/t:name[@type='surname']"/>
<xsl:if test="t:author[2]">
<xsl:text>-</xsl:text>
<xsl:value-of select="t:author[2]/t:name[@type='surname']"/>
</xsl:if></xsl:when>
<xsl:when test="t:editor">
<xsl:value-of select="t:editor[1]/t:name[@type='surname']"/>
<xsl:if test="t:editor[2]">
<xsl:text>-</xsl:text>
<xsl:value-of select="t:editor[2]/t:name[@type='surname']"/>
</xsl:if>
</xsl:when></xsl:choose>
<xsl:text> </xsl:text>
<xsl:value-of select="t:date"/>
</xsl:for-each>
</xsl:when>
<xsl:when test="contains($indresp,'SEG')">
<xsl:text> SEG </xsl:text><xsl:value-of select="substring-after($indresp, 'SEG')"/>
</xsl:when>
<xsl:when test="contains($indresp,'SECir')">
<xsl:text> SECir </xsl:text><xsl:value-of select="substring-after($indresp, 'SECir')"/>
</xsl:when>
<xsl:when test="contains($indresp,'Sammelbuch')">
<xsl:text> Sammelbuch </xsl:text><xsl:value-of select="$indresp"/>
</xsl:when>
<xsl:otherwise>
<xsl:text> !</xsl:text><xsl:value-of select="$indresp"/><xsl:text>!</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not(position()=last())">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:apply-templates><xsl:with-param name="location" tunnel="yes">apparatus</xsl:with-param></xsl:apply-templates>
<xsl:text> </xsl:text>
<xsl:value-of select="$authors"/>
</xsl:for-each>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:for-each select="t:rdg">
<xsl:variable name="authors">
<xsl:choose><xsl:when test="./@resp">
<xsl:variable name="resp" select="tokenize(./@resp,' ')"/>
<xsl:for-each select="$resp">
<xsl:variable name="indresp">
<xsl:sequence select="substring-after(.,'#')"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="document('Workspace/files/BIBLIOGRAPHY.xml')//t:bibl[@xml:id = $indresp]">
<xsl:for-each
select="document('Workspace/files/BIBLIOGRAPHY.xml')//t:bibl[@xml:id = $indresp]">
<xsl:text> </xsl:text>
<xsl:choose><xsl:when test="t:author"><xsl:value-of select="t:author[1]/t:name[@type='surname']"/>
<xsl:if test="t:author[2]">
<xsl:text>-</xsl:text>
<xsl:value-of select="t:author[2]/t:name[@type='surname']"/>
</xsl:if></xsl:when>
<xsl:when test="t:editor">
<xsl:value-of select="t:editor[1]/t:name[@type='surname']"/>
<xsl:if test="t:editor[2]">
<xsl:text>-</xsl:text>
<xsl:value-of select="t:editor[2]/t:name[@type='surname']"/>
</xsl:if>
</xsl:when></xsl:choose>
<xsl:text> </xsl:text>
<xsl:value-of select="t:date"/>
</xsl:for-each>
</xsl:when>
<xsl:when test="contains($indresp,'SEG')">
<xsl:text> SEG </xsl:text><xsl:value-of select="substring-after($indresp, 'SEG')"/>
</xsl:when>
<xsl:when test="contains($indresp,'SECir')">
<xsl:text> SECir </xsl:text><xsl:value-of select="substring-after($indresp, 'SECir')"/>
</xsl:when>
<xsl:when test="contains($indresp,'Sammelbuch')">
<xsl:text> Sammelbuch </xsl:text><xsl:value-of select="$indresp"/>
</xsl:when>
<xsl:otherwise>
<xsl:text> !</xsl:text><xsl:value-of select="$indresp"/><xsl:text>!</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not(position()=last())">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:text>Other reading</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:apply-templates><xsl:with-param name="location" tunnel="yes">apparatus</xsl:with-param></xsl:apply-templates>
<xsl:text> </xsl:text>
<xsl:value-of select="$authors"/>
<xsl:if test="./note"><xsl:value-of select="./note"/></xsl:if>
<xsl:choose><xsl:when test="not(position() = last())"><xsl:text>; </xsl:text></xsl:when><xsl:otherwise><xsl:text>.</xsl:text></xsl:otherwise></xsl:choose>
</xsl:for-each>
<xsl:text> </xsl:text>
<xsl:for-each select="t:note">
<xsl:value-of select="."/>
</xsl:for-each>
</p>
</xsl:for-each>
</xsl:when>
<xsl:when test="@resp='previous'">
<span class="previouslyread">
<xsl:apply-templates/>
</span>
</xsl:when>
<xsl:when test="@resp='autopsy'"/>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
<!-- Found in htm-tpl-apparatus - creates links to footnote in apparatus -->
<xsl:if test="$parm-internal-app-style = 'ddbdp'">
<xsl:call-template name="app-link">
<xsl:with-param name="location" select="'text'"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="t:rdg">
<xsl:param name="parm-edition-type" tunnel="yes" required="no"/>
<xsl:choose>
<xsl:when test="$parm-edition-type = 'diplomatic'">
<xsl:choose>
<xsl:when test="@resp='previous'"/>
<xsl:when test="@resp='autopsy'">
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="not(preceding-sibling::t:lem or preceding-sibling::t:rdg)">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:when>
<xsl:when test="@resp='previous'">
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="@resp='autopsy'"/>
<xsl:when test="parent::t:app"/>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="t:wit">
<xsl:choose>
<!-- Temporary -->
<xsl:when test="parent::t:app"/>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="t:lem">
<xsl:param name="parm-edition-type" tunnel="yes" required="no"></xsl:param>
<xsl:param name="parm-leiden-style" tunnel="yes" required="no"></xsl:param>
<xsl:param name="parm-hgv-gloss" tunnel="yes" required="no"></xsl:param>
<xsl:choose>
<xsl:when test="$parm-leiden-style=('ddbdp','dclp','sammelbuch') and ancestor::t:div[@type='translation']">
<xsl:variable name="wit-val" select="@resp"/>
<xsl:variable name="lang" select="ancestor::t:div[@type = 'translation']/@xml:lang"/>
<span class="term">
<xsl:apply-templates/>
<span class="gloss" style="display:none">
<b><xsl:choose>
<xsl:when test="$lang = 'en'">
<xsl:if test=".//t:term[@target]">
<xsl:text>Glossary/</xsl:text>
</xsl:if>
<xsl:text>Correction:</xsl:text>
</xsl:when>
<xsl:when test="$lang = 'de'">
<xsl:if test=".//t:term[@target]">
<xsl:text>Glossar/</xsl:text>
</xsl:if>
<xsl:text>Korrektur:</xsl:text>
</xsl:when>
</xsl:choose></b>
<xsl:for-each select=".//t:term[@target]">
<xsl:value-of select="document($parm-hgv-gloss)//t:item[@xml:id = current()/@target]/t:term"/>
<xsl:text>. </xsl:text>
<xsl:value-of select="document($parm-hgv-gloss)//t:item[@xml:id = current()/@target]/t:gloss[@xml:lang = $lang]"/>
<xsl:text>; </xsl:text>
</xsl:for-each>
<xsl:value-of select="$wit-val"/>
</span>
</span>
</xsl:when>
<xsl:when test="$parm-leiden-style=('ddbdp','dclp','sammelbuch') and ancestor::t:*[local-name()=('reg','corr','rdg')
or self::t:del[@rend='corrected']]">
<xsl:apply-templates/>
<xsl:if test="@resp">
<xsl:choose>
<xsl:when test="$parm-leiden-style=('ddbdp','dclp')"><xsl:text> FNORD-SPLIT </xsl:text></xsl:when>
<xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
</xsl:choose>
<xsl:if test="parent::t:app[@type='BL']">
<xsl:text>BL </xsl:text>
</xsl:if>
<xsl:value-of select="@resp"/>
<xsl:if test="parent::t:app[@type='SoSOL']">
<xsl:text> (via PE)</xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="$parm-leiden-style=('ddbdp','dclp')"><xsl:text> FNORD-DELIM </xsl:text></xsl:when>
<xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:choose>
<xsl:when test="parent::t:app[@type='editorial']">
<xsl:text> (</xsl:text><xsl:for-each select="following-sibling::t:rdg">
<!-- found in tpl-apparatus.xsl -->
<xsl:call-template name="app-ed-mult"/>
</xsl:for-each><xsl:text>)</xsl:text>
</xsl:when>
<xsl:when test="parent::t:app[@type='alternative']">
<xsl:text> (or </xsl:text>
<xsl:for-each select="following-sibling::t:rdg">
<xsl:apply-templates/>
<xsl:if test="position()!=last()">
<xsl:text> or </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>)</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="parent::t:app[@type='previouslyread']">
<span class="previouslyread">
<xsl:apply-templates/>
</span>
</xsl:when>
<xsl:when test="$parm-leiden-style='iospe' and $parm-edition-type='interpretive' and ../t:rdg">
<xsl:apply-templates/>
<xsl:for-each select="../t:rdg">
<xsl:text> resp. </xsl:text>
<xsl:apply-templates/>
</xsl:for-each>
</xsl:when>
<xsl:when test="$parm-leiden-style='sigidoc' and $parm-edition-type='interpretive' and ../t:rdg"><!-- added by SigiDoc -->
<xsl:apply-templates/>
<xsl:for-each select="../t:rdg">
<i><xsl:text> vel </xsl:text></i>
<xsl:apply-templates/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>