-
Notifications
You must be signed in to change notification settings - Fork 11
/
htm-tpl-struct-ecg.xsl
332 lines (315 loc) · 15.1 KB
/
htm-tpl-struct-ecg.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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id$ -->
<xsl:stylesheet xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
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 named templates for ecg file structure (aka "metadata" aka "supporting data") -->
<!-- Called from htm-tpl-structure.xsl -->
<xsl:template name="ecg-body-structure">
<div id="stone">
<h3 class="ecg"><i18n:text i18n:key="epidoc-xslt-ecg-monument">Monument</i18n:text></h3>
<dl class="ecg">
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-ecg-monument-type">Type of monument</i18n:text></dt>
<dd>
<xsl:choose>
<xsl:when test="//t:support//t:objectType//text()">
<xsl:value-of select="//t:support//t:objectType"/>
</xsl:when>
<xsl:otherwise><i18n:text i18n:key="epidoc-xslt-ecg-not-specified">Not specified</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-ecg-material">Material</i18n:text></dt>
<dd>
<xsl:choose>
<xsl:when test="//t:support//t:material//text()">
<xsl:value-of select="//t:support//t:material"/>
</xsl:when>
<xsl:otherwise><i18n:text i18n:key="epidoc-xslt-ecg-not-specified">Not specified</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-ecg-description">Description and condition</i18n:text></dt>
<dd>
<xsl:choose>
<xsl:when test="//t:support//t:p//text()">
<xsl:value-of select="//t:support//t:p"/>
</xsl:when>
<xsl:otherwise><i18n:text i18n:key="epidoc-xslt-ecg-not-specified">Not specified</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
</dl>
<dl class="ecg">
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-ecg-find-place">Find place</i18n:text></dt>
<dd>
<xsl:choose>
<xsl:when test="//t:provenance[@type='found']//t:placeName[@type='ancientFindspot']//text()">
<xsl:value-of select="//t:provenance[@type='found']//t:placeName[@type='ancientFindspot']"/>
</xsl:when>
<xsl:otherwise><i18n:text i18n:key="epidoc-xslt-ecg-unknown">Unknown</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-ecg-find-circumstances">Find circumstances</i18n:text></dt>
<dd>
<xsl:choose>
<xsl:when test="//t:provenance[@type='found']//t:rs[@type='circumstances']//text()">
<xsl:value-of select="//t:provenance[@type='found']//t:rs[@type='circumstances']"/>
</xsl:when>
<xsl:otherwise><i18n:text i18n:key="epidoc-xslt-ecg-unknown">Unknown</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-ecg-find-context">Find context</i18n:text></dt>
<dd>
<xsl:choose>
<xsl:when test="//t:provenance[@type='found']//t:rs[@type='context']//text()">
<xsl:value-of select="//t:provenance[@type='found']//t:rs[@type='context']"/>
</xsl:when>
<xsl:otherwise><i18n:text i18n:key="epidoc-xslt-ecg-unknown">Unknown</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-ecg-modern-location">Modern location</i18n:text></dt>
<dd>
<xsl:choose>
<xsl:when test="//t:provenance[@type='observed']//text()">
<xsl:value-of select="//t:provenance[@type='observed']"/>
</xsl:when>
<xsl:otherwise><i18n:text i18n:key="epidoc-xslt-ecg-unknown">Unknown</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-ecg-dimensions">Dimensions</i18n:text></dt>
<dd>
<xsl:choose>
<xsl:when test="//t:support/t:dimensions//text()[not(normalize-space(.)=' ')]">
<xsl:if test="//t:support/t:dimensions/t:height/text()[not(normalize-space(.)=' ')]">H. <xsl:value-of select="//t:support/t:dimensions/t:height"/>,</xsl:if>
<xsl:if test="//t:support/t:dimensions/t:width/text()[not(normalize-space(.)=' ')]">W. <xsl:value-of select="//t:support/t:dimensions/t:width"/>,</xsl:if>
<xsl:if test="//t:support/t:dimensions/t:depth/text()[not(normalize-space(.)=' ')]">Th. <xsl:value-of select="//t:support/t:dimensions/t:depth"/></xsl:if>
<xsl:if test="//t:support/t:dimensions/t:dim[@type='diameter']/text()[not(normalize-space(.)=' ')]">, Diam. <xsl:value-of select="//t:support/t:dimensions/t:dim[@type='diameter']"/></xsl:if>
</xsl:when>
<xsl:otherwise><i18n:text i18n:key="epidoc-xslt-ecg-unknown">Unknown</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-ecg-institution-inventory">Institution and inventory</i18n:text></dt>
<dd>
<xsl:choose>
<xsl:when test="//t:msIdentifier//t:repository/text() and //t:msIdentifier//t:idno/text()">
<xsl:value-of select="//t:msIdentifier//t:repository"/>
<xsl:value-of select="//t:msIdentifier//t:idno"/>
</xsl:when>
<xsl:when test="//t:msIdentifier//t:repository/text()">
<xsl:value-of select="//t:msIdentifier//t:repository"/>
<xsl:text>no inv. no.</xsl:text>
</xsl:when>
<xsl:otherwise><i18n:text i18n:key="epidoc-xslt-ecg-unknown">Unknown</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
</dl>
</div>
<div id="text-field">
<h3 class="ecg"><i18n:text i18n:key="epidoc-xslt-ecg-inscribed-field">Inscribed field</i18n:text></h3>
<dl class="ecg">
<xsl:if test="//t:layout/@ana">
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-ecg-faces-code">Faces code</i18n:text></dt>
<dd><xsl:value-of select="//t:layout/@ana"/></dd>
</xsl:if>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-ecg-placement-text">Placement of text</i18n:text></dt>
<dd>
<xsl:choose>
<xsl:when test="//t:layout/text()">
<xsl:value-of select="//t:layout"/>
</xsl:when>
<xsl:otherwise><i18n:text i18n:key="epidoc-xslt-ecg-not-specified">Not specified</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-ecg-style-lettering">Style of lettering</i18n:text></dt>
<dd>
<xsl:choose>
<xsl:when test="//t:handNote//text()[not(ancestor::t:height)]">
<xsl:value-of select="/t:handNote//text()[not(ancestor::t:height)]"/>
</xsl:when>
<xsl:otherwise><i18n:text i18n:key="epidoc-xslt-ecg-not-specified">Not specified</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-ecg-letterheights">Letterheights</i18n:text></dt>
<dd>
<xsl:choose>
<xsl:when test="//t:handNote//t:height/text()">
<xsl:value-of select="//t:handNote//t:height"/>
</xsl:when>
<xsl:otherwise><i18n:text i18n:key="epidoc-xslt-ecg-not-specified">Not specified</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
</dl>
</div>
<div id="text">
<h3 class="ecg"><i18n:text i18n:key="epidoc-xslt-ecg-text">Text</i18n:text></h3>
<dl class="ecg">
<dt><i18n:text i18n:key="epidoc-xslt-ecg-origin">Origin</i18n:text></dt>
<dd>
<xsl:choose>
<xsl:when test="//t:origin/t:origPlace/text()">
<xsl:value-of select="//t:origin/t:origPlace"/>
</xsl:when>
<xsl:otherwise><i18n:text i18n:key="epidoc-xslt-ecg-not-specified">Not specified</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt><i18n:text i18n:key="epidoc-xslt-ecg-category">Category</i18n:text></dt>
<dd>
<xsl:choose>
<xsl:when test="//t:msContents/t:summary/text()">
<xsl:value-of select="//t:msContents/t:summary"/>
</xsl:when>
<xsl:otherwise><i18n:text i18n:key="epidoc-xslt-ecg-not-specified">Not specified</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt><i18n:text i18n:key="epidoc-xslt-ecg-date">Date</i18n:text></dt>
<dd>
<xsl:choose>
<xsl:when test="//t:origin/t:origDate/text()">
<xsl:value-of select="//t:origin/t:origDate"/>
</xsl:when>
<xsl:otherwise><i18n:text i18n:key="epidoc-xslt-ecg-not-specified">Not specified</i18n:text></xsl:otherwise>
</xsl:choose></dd>
<dt><i18n:text i18n:key="epidoc-xslt-ecg-dating-criteria">Dating criteria</i18n:text></dt>
<dd>
<xsl:choose>
<xsl:when test="//t:origin/t:origDate/@evidence">
<xsl:for-each select="tokenize(//t:origin/t:origDate/@evidence,' ')">
<xsl:value-of select="translate(.,'-',' ')"/>
<xsl:if test="position()!=last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:text>n/a</xsl:text>
</xsl:otherwise>
</xsl:choose>
</dd>
<dt><i18n:text i18n:key="epidoc-xslt-ecg-editions">Editions</i18n:text></dt>
<dd>
<xsl:choose>
<xsl:when test="//t:body//t:div[@type='bibliography']//text()">
<xsl:apply-templates select="//t:body//t:div[@type='bibliography']"/>
</xsl:when>
<xsl:otherwise><i18n:text i18n:key="epidoc-xslt-ecg-unpublished">Unpublished</i18n:text></xsl:otherwise>
</xsl:choose></dd>
</dl>
<div id="edition" class="ecg">
<!-- Edited text output -->
<xsl:variable name="edtxt">
<xsl:apply-templates select="//t:div[@type='edition']">
<xsl:with-param name="parm-edition-type" tunnel="yes">
<xsl:text>inetrpretative</xsl:text>
</xsl:with-param>
<xsl:with-param name="parm-verse-lines" tunnel="yes">
<xsl:text>off</xsl:text>
</xsl:with-param>
</xsl:apply-templates>
</xsl:variable>
<!-- Moded templates found in htm-tpl-sqbrackets.xsl -->
<xsl:apply-templates select="$edtxt" mode="sqbrackets"/>
</div>
<div id="diplomatic">
<!-- Edited text output -->
<xsl:variable name="edtxt">
<xsl:apply-templates select="//t:div[@type='edition']">
<xsl:with-param name="parm-edition-type" tunnel="yes">
<xsl:text>diplomatic</xsl:text>
</xsl:with-param>
<xsl:with-param name="parm-verse-lines" tunnel="yes">
<xsl:text>off</xsl:text>
</xsl:with-param>
</xsl:apply-templates>
</xsl:variable>
<!-- Moded templates found in htm-tpl-sqbrackets.xsl -->
<xsl:apply-templates select="$edtxt" mode="sqbrackets"/>
</div>
<div id="apparatus" class="ecg">
<h4 class="ecg"><i18n:text i18n:key="epidoc-xslt-ecg-apparatus">Apparatus</i18n:text></h4>
<!-- Apparatus text output -->
<xsl:variable name="apptxt">
<xsl:apply-templates select="//t:div[@type='apparatus']/t:listApp"/>
</xsl:variable>
<!-- Moded templates found in htm-tpl-sqbrackets.xsl -->
<xsl:apply-templates select="$apptxt" mode="sqbrackets"/>
</div>
<div id="translation" class="ecg">
<h4 class="ecg"><i18n:text i18n:key="epidoc-xslt-ecg-translation">Translation</i18n:text></h4>
<!-- Translation text output -->
<xsl:variable name="transtxt">
<xsl:apply-templates select="//t:div[@type='translation']//t:p"/>
</xsl:variable>
<!-- Moded templates found in htm-tpl-sqbrackets.xsl -->
<xsl:apply-templates select="$transtxt" mode="sqbrackets"/>
</div>
<div id="commentary" class="ecg">
<h4 class="ecg"><i18n:text i18n:key="epidoc-xslt-ecg-commentary">Commentary</i18n:text></h4>
<!-- Commentary text output -->
<xsl:variable name="commtxt">
<xsl:apply-templates select="//t:div[@type='commentary']//t:p"/>
</xsl:variable>
<!-- Moded templates found in htm-tpl-sqbrackets.xsl -->
<xsl:apply-templates select="$commtxt" mode="sqbrackets"/>
</div>
<div id="images" class="ecg">
<h4 class="ecg"><i18n:text i18n:key="epidoc-xslt-ecg-images">Images</i18n:text></h4>
<dl>
<xsl:for-each select="//t:facsimile//t:graphic">
<dt width="150" align="left"></dt>
<dd>
<xsl:apply-templates select="." />
</dd>
</xsl:for-each>
</dl>
</div>
</div>
</xsl:template>
<xsl:template name="ecg-structure">
<xsl:variable name="title">
<xsl:call-template name="ecg-title" />
</xsl:variable>
<html>
<head>
<title>
<xsl:value-of select="$title"/>
</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<!-- Found in htm-tpl-cssandscripts.xsl -->
<xsl:call-template name="css-script"/>
</head>
<body>
<h1>
<xsl:value-of select="$title"/>
</h1>
<xsl:call-template name="ecg-body-structure" />
</body>
</html>
</xsl:template>
<xsl:template name="ecg-title">
<xsl:choose>
<xsl:when test="//t:titleStmt/t:title/text() and matches(//t:idno[@type='filename'], '^\d\.\d{1,4}$')">
<xsl:number value="substring-before(//t:idno[@type='filename'],'.')" format="I"/>
<xsl:text> </xsl:text>
<xsl:number value="substring-after(//t:idno[@type='filename'],'.')" format="1"/>
<xsl:text>. </xsl:text>
<xsl:if test="string(normalize-space(//t:origPlace[1]))"><xsl:value-of select="normalize-space(//t:origPlace[1])"/>
<xsl:text>. </xsl:text></xsl:if>
<xsl:value-of select="//t:titleStmt/t:title[child::text()][1]"/>
<xsl:if test="not(//t:titleStmt/t:title[child::text()][1][child::t:origDate])">
<xsl:text>, </xsl:text>
<xsl:value-of select="//t:origDate[1]"/>
</xsl:if>
</xsl:when>
<xsl:when test="//t:titleStmt/t:title/text()">
<xsl:value-of select="//t:titleStmt/t:title"/>
</xsl:when>
<xsl:when test="//t:sourceDesc//t:bibl/text()">
<xsl:value-of select="//t:sourceDesc//t:bibl"/>
</xsl:when>
<xsl:when test="//t:idno[@type='filename']/text()">
<xsl:value-of select="//t:idno[@type='filename']"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>EpiDoc example output, ecg style</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>