-
Notifications
You must be signed in to change notification settings - Fork 11
/
htm-tpl-struct-iospe.xsl
292 lines (282 loc) · 13.9 KB
/
htm-tpl-struct-iospe.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
<?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 IOSPE file structure (aka "metadata" aka "supporting data") -->
<!-- Called from htm-tpl-structure.xsl -->
<xsl:template name="iospe-body-structure">
<div id="stone">
<h3 class="iospe"><i18n:text i18n:key="epidoc-xslt-iospe-monument">Monument</i18n:text></h3>
<dl class="iospe">
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-iospe-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-iospe-not-specified">Not specified</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-iospe-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-iospe-not-specified">Not specified</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-iospe-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-iospe-not-specified">Not specified</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
</dl>
<dl class="iospe">
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-iospe-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-iospe-unknown">Unknown</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-iospe-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-iospe-unknown">Unknown</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-iospe-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-iospe-unknown">Unknown</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-iospe-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-iospe-unknown">Unknown</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-iospe-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-iospe-unknown">Unknown</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-iospe-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-iospe-unknown">Unknown</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
</dl>
</div>
<div id="text-field">
<h3 class="iospe"><i18n:text i18n:key="epidoc-xslt-iospe-inscribed-field">Inscribed field</i18n:text></h3>
<dl class="iospe">
<xsl:if test="//t:layout/@ana">
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-iospe-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-iospe-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-iospe-not-specified">Not specified</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-iospe-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-iospe-not-specified">Not specified</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt width="150" align="left"><i18n:text i18n:key="epidoc-xslt-iospe-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-iospe-not-specified">Not specified</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
</dl>
</div>
<div id="text">
<h3 class="iospe"><i18n:text i18n:key="epidoc-xslt-iospe-text">Text</i18n:text></h3>
<dl class="iospe">
<dt><i18n:text i18n:key="epidoc-xslt-iospe-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-iospe-not-specified">Not specified</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt><i18n:text i18n:key="epidoc-xslt-iospe-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-iospe-not-specified">Not specified</i18n:text></xsl:otherwise>
</xsl:choose>
</dd>
<dt><i18n:text i18n:key="epidoc-xslt-iospe-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-iospe-not-specified">Not specified</i18n:text></xsl:otherwise>
</xsl:choose></dd>
<dt><i18n:text i18n:key="epidoc-xslt-iospe-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-iospe-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-iospe-unpublished">Unpublished</i18n:text></xsl:otherwise>
</xsl:choose></dd>
</dl>
<div id="edition" class="iospe">
<!-- Edited text output -->
<xsl:variable name="edtxt">
<xsl:apply-templates select="//t:div[@type='edition']"/>
</xsl:variable>
<!-- Moded templates found in htm-tpl-sqbrackets.xsl -->
<xsl:apply-templates select="$edtxt" mode="sqbrackets"/>
</div>
<div id="apparatus" class="iospe">
<h4 class="iospe"><i18n:text i18n:key="epidoc-xslt-iospe-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="iospe">
<h4 class="iospe"><i18n:text i18n:key="epidoc-xslt-iospe-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="iospe">
<h4 class="iospe"><i18n:text i18n:key="epidoc-xslt-iospe-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>
</xsl:template>
<xsl:template name="iospe-structure">
<xsl:variable name="title">
<xsl:call-template name="iospe-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="iospe-body-structure" />
</body>
</html>
</xsl:template>
<xsl:template name="iospe-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, IOSPE style</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>