forked from EpiDoc/Stylesheets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
htm-tpl-struct-dol.xsl
240 lines (223 loc) · 9.09 KB
/
htm-tpl-struct-dol.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
<?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 named templates for the DOL file structure -->
<xsl:template name="dol-body-structure">
<p><b>Tablet: </b>
<xsl:choose>
<xsl:when test="//t:support/t:p/text()">
<xsl:apply-templates select="//t:support/t:p" mode="dol-dimensions"/>
</xsl:when>
<xsl:when test="//t:support//text()">
<xsl:apply-templates select="//t:support" mode="dol-dimensions"/>
</xsl:when>
<xsl:otherwise>Unknown</xsl:otherwise>
</xsl:choose>
<br />
<b>Dialect: </b>
<xsl:choose>
<xsl:when test="//t:layoutDesc/t:layout//text()">
<xsl:value-of select="//t:layoutDesc/t:layout"/>
</xsl:when>
<xsl:otherwise>Unknown.</xsl:otherwise>
</xsl:choose>
<br />
<b>Alphabet: </b>
<xsl:if test="//t:handDesc/t:handNote/text()">
<xsl:value-of select="//t:handDesc/t:handNote"/>
</xsl:if>
</p>
<p><b>Date: </b>
<xsl:choose>
<xsl:when test="//t:origin/t:origDate/text()">
<xsl:value-of select="//t:origin/t:origDate"/>
<xsl:if test="//t:origin/t:origDate[@type='evidence']">
<xsl:text>(</xsl:text>
<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:text>)</xsl:text>
</xsl:if>
</xsl:when>
<xsl:otherwise>Unknown.</xsl:otherwise>
</xsl:choose>
</p>
<p><b>Findspot: </b>
<xsl:choose>
<xsl:when test="//t:provenance[@type='found'][string(translate(normalize-space(.),' ',''))]">
<xsl:apply-templates select="//t:provenance[@type='found']" mode="dol-placename"/>
</xsl:when>
<xsl:otherwise>Unknown</xsl:otherwise>
</xsl:choose>
<br/>
<b>Original location: </b>
<xsl:choose>
<xsl:when test="//t:origin/t:origPlace/text()">
<xsl:apply-templates select="//t:origin/t:origPlace" mode="dol-placename"/>
</xsl:when>
<xsl:otherwise>Unknown</xsl:otherwise>
</xsl:choose>
<br/>
<b>Current location: </b>
<xsl:choose>
<xsl:when test="//t:provenance[@type='observed'][string(translate(normalize-space(.),' ',''))]">
<xsl:apply-templates select="//t:provenance[@type='observed']" mode="dol-placename"/>
<!-- Named template found below. -->
<xsl:call-template name="dol-invno"/>
</xsl:when>
<xsl:when test="//t:msIdentifier//t:repository[string(translate(normalize-space(.),' ',''))]">
<xsl:value-of select="//t:msIdentifier//t:repository[1]"/>
<!-- Named template found below. -->
<xsl:call-template name="dol-invno"/>
</xsl:when>
<xsl:otherwise>Unknown</xsl:otherwise>
</xsl:choose>
</p>
<p>
<b>Bibliography: </b>
<xsl:apply-templates select="//t:div[@type='bibliography']/t:p/node()"/>
<br/>
<b>Editor: </b>
<xsl:apply-templates select="//t:editor"/>
<br/>
<b>Text constituted from: </b>
<xsl:apply-templates select="//t:creation"/>
</p>
<div id="edition">
<!-- 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">
<h4 class="slimmer">Apparatus:</h4>
<!-- Apparatus text output -->
<xsl:variable name="apptxt">
<xsl:apply-templates select="//t:div[@type='apparatus']//t:p"/>
</xsl:variable>
<!-- Moded templates found in htm-tpl-sqbrackets.xsl -->
<xsl:apply-templates select="$apptxt" mode="sqbrackets"/>
</div>
<div id="translation">
<h4 class="slimmer">Translation:</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">
<h4 class="slimmer">Commentary:</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>
<p><b>Themes / Keywords: </b>
<xsl:if test="//t:textClass/t:keywords/t:list/t:item/text()">
<xsl:value-of select="//t:textClass/t:keywords/t:list/t:item"/>
</xsl:if>
</p>
</xsl:template>
<!-- Called from htm-tpl-structure.xsl -->
<xsl:template name="dol-structure">
<xsl:variable name="title">
<xsl:call-template name="dol-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="dol-body-structure" />
</body>
</html>
</xsl:template>
<xsl:template match="t:dimensions" mode="dol-dimensions">
<xsl:if test="text()">
<xsl:if test="t:width/text()">w:
<xsl:value-of select="t:width"/>
<xsl:if test="t:height/text()">
<xsl:text> x </xsl:text>
</xsl:if>
</xsl:if>
<xsl:if test="t:height/text()">h:
<xsl:value-of select="t:height"/>
</xsl:if>
<xsl:if test="t:depth/text()">x d:
<xsl:value-of select="t:depth"/>
</xsl:if>
<xsl:if test="t:dim[@type='diameter']/text()">x diam.:
<xsl:value-of select="t:dim[@type='diameter']"/>
</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template match="t:placeName|t:rs" mode="dol-placename">
<xsl:choose>
<xsl:when test="contains(@ref,'pleiades.stoa.org') or contains(@ref,'geonames.org')">
<a>
<xsl:attribute name="href">
<xsl:value-of select="@ref"/>
</xsl:attribute>
<xsl:apply-templates/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="dol-invno">
<xsl:if test="//t:idno[@type='invNo'][string(translate(normalize-space(.),' ',''))]">
<xsl:text> (Inv. no. </xsl:text>
<xsl:for-each select="//t:idno[@type='invNo'][string(translate(normalize-space(.),' ',''))]">
<xsl:value-of select="."/>
<xsl:if test="position()!=last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>)</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template name="dol-title">
<xsl:choose>
<xsl:when test="//t:titleStmt/t:title/text() and number(substring(//t:publicationStmt/t:idno[@type='filename']/text(),2,5))">
<xsl:value-of select="substring(//t:publicationStmt/t:idno[@type='filename'],1,1)"/>
<xsl:text>. </xsl:text>
<xsl:value-of select="number(substring(//t:publicationStmt/t:idno[@type='filename'],2,5)) div 100"/>
<xsl:text>. </xsl:text>
<xsl:value-of select="//t:titleStmt/t:title"/>
</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, Dodone Online style</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>