Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<!-- $Id: htm-tpl-struct-inslib.xsl 1434 2011-05-31 18:23:56Z gabrielbodard $ -->
3
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
                xmlns:t="http://www.tei-c.org/ns/1.0" exclude-result-prefixes="t" 
5
                version="2.0">
6
  <!-- Contains named templates for InsLib file structure (aka "metadata" aka "supporting data") -->  
7
   
8
   <!-- Called from htm-tpl-structure.xsl -->
9
   
10
   <xsl:template name="inslib-structure">
11
      <xsl:variable name="title">
12
         <xsl:choose>
13
            <xsl:when test="//t:titleStmt/t:title/text()">
14
               <xsl:if test="//t:publicationStmt/t:idno[@type='filename']/text()">
15
                  <xsl:value-of select="substring(//t:publicationStmt/t:idno[@type='filename'],1,1)"/> 
16
                  <xsl:text>. </xsl:text>
17
                  <xsl:value-of select="number(substring(//t:publicationStmt/t:idno[@type='filename'],2,5)) div 100"/> 
18
                  <xsl:text>. </xsl:text>
19
               </xsl:if>
20
               <xsl:value-of select="//t:titleStmt/t:title"/>
21
            </xsl:when>
22
            <xsl:when test="//t:sourceDesc//t:bibl/text()">
23
               <xsl:value-of select="//t:sourceDesc//t:bibl"/>
24
            </xsl:when>
25
            <xsl:when test="//t:idno[@type='filename']/text()">
26
               <xsl:value-of select="//t:idno[@type='filename']"/>
27
            </xsl:when>
28
            <xsl:otherwise>
29
               <xsl:text>EpiDoc example output, InsLib style</xsl:text>
30
            </xsl:otherwise>
31
         </xsl:choose>
32
      </xsl:variable>
33
      
34
      <html>
35
         <head>
36
            <title>
37
               <xsl:value-of select="$title"/>
38
            </title>
39
            <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
40
            <!-- Found in htm-tpl-cssandscripts.xsl -->
41
            <xsl:call-template name="css-script"/>
42
         </head>
43
         
44
         <body>
45
            <h1>
46
               <xsl:value-of select="$title"/>
47
            </h1>
48
              
49
               <p><b>Description: </b>
50
               <xsl:choose>
51
                     <xsl:when test="//t:support/t:p/text()">
52
                        <xsl:apply-templates select="//t:support/t:p" mode="inslib-dimensions"/>
53
                     </xsl:when>
54
                     <xsl:otherwise>Unknown</xsl:otherwise>
55
                  </xsl:choose>
56
                  
57
                  
58
               <br />
59
                  <b>Text: </b>
60
               <xsl:choose>
61
                  <xsl:when test="//t:layoutDesc/t:layout//text()">
62
                        <xsl:value-of select="//t:layoutDesc/t:layout"/>
63
                  </xsl:when>
64
                  <xsl:otherwise>Unknown.</xsl:otherwise>
65
               </xsl:choose>
66
                  <br />
67
                  <b>Letters: </b>
68
                     <xsl:if test="//t:handDesc/t:handNote/text()">
69
                        <xsl:value-of select="//t:handDesc/t:handNote"/>
70
                     </xsl:if>
71
               </p>
72
               
73
               <p><b>Date: </b>
74
               <xsl:choose>
75
                  <xsl:when test="//t:origin/t:origDate/text()">
76
                     <xsl:value-of select="//t:origin/t:origDate"/>
77
                     <xsl:if test="//t:origin/t:origDate[@type='evidence']">
78
                        <xsl:text>(</xsl:text>
79
                           <xsl:for-each select="tokenize(//t:origin/t:origDate[@evidence],' ')">
80
                              <xsl:value-of select="translate(.,'-',' ')"/>
81
                              <xsl:if test="position()!=last()">
82
                                 <xsl:text>, </xsl:text>
83
                              </xsl:if>
84
                           </xsl:for-each>
85
                        <xsl:text>)</xsl:text>
86
                     </xsl:if>
87
                  </xsl:when>
88
                  <xsl:otherwise>Unknown.</xsl:otherwise>
89
               </xsl:choose>
90
               </p>
91
               
92
               <p><b>Findspot: </b>
93
               <xsl:choose>
94
                  <xsl:when test="//t:provenance[@type='found'][string(translate(normalize-space(.),' ',''))]">
95
                        <xsl:apply-templates select="//t:provenance[@type='found']" mode="inslib-placename"/>
96
                  </xsl:when>
97
                  <xsl:otherwise>Unknown</xsl:otherwise>
98
               </xsl:choose>
99
                  <br/>
100
                  <b>Original location: </b>
101
                  <xsl:choose>
102
                     <xsl:when test="//t:origin/t:origPlace/text()">
103
                        <xsl:apply-templates select="//t:origin/t:origPlace" mode="inslib-placename"/>
104
                     </xsl:when>
105
                     <xsl:otherwise>Unknown</xsl:otherwise>
106
                  </xsl:choose>
107
                  <br/>
108
                  <b>Last recorded location: </b>
109
                  <xsl:choose>
110
                     <xsl:when test="//t:provenance[@type='observed'][string(translate(normalize-space(.),' ',''))]">
111
                        <xsl:apply-templates select="//t:provenance[@type='observed']" mode="inslib-placename"/> 
112
                        <!-- Named template found below. -->
113
                        <xsl:call-template name="inslib-invno"/> 
114
                     </xsl:when>
115
                     <xsl:when test="//t:msIdentifier//t:repository[string(translate(normalize-space(.),' ',''))]">
116
                        <xsl:value-of select="//t:msIdentifier//t:repository[1]"/>
117
                        <!-- Named template found below. -->
118
                        <xsl:call-template name="inslib-invno"/>
119
                     </xsl:when>
120
                     <xsl:otherwise>Unknown</xsl:otherwise>
121
                  </xsl:choose> 
122
               </p>
123
            
124
               <div id="edition">
125
                  <p><b>Edition:</b></p>
126
                  <!-- Edited text output -->
127
               <xsl:variable name="edtxt">
128
                  <xsl:apply-templates select="//t:div[@type='edition']"/>
129
               </xsl:variable>
130
               <!-- Moded templates found in htm-tpl-sqbrackets.xsl -->
131
               <xsl:apply-templates select="$edtxt" mode="sqbrackets"/>
132
               </div>
133
            
134
            
135
            <div id="apparatus">
136
               <!-- Apparatus text output -->
137
               <xsl:variable name="apptxt">
138
                  <xsl:apply-templates select="//t:div[@type='apparatus']"/>
139
               </xsl:variable>
140
               <!-- Moded templates found in htm-tpl-sqbrackets.xsl -->
141
               <xsl:apply-templates select="$apptxt" mode="sqbrackets"/>
142
            </div>
143
            
144
            <div id="translation">
145
               <h4 class="slimmer">Translation:</h4>
146
               <!-- Translation text output -->
147
               <xsl:variable name="transtxt">
148
                  <xsl:apply-templates select="//t:div[@type='translation']//t:p"/>
149
               </xsl:variable>
150
               <!-- Moded templates found in htm-tpl-sqbrackets.xsl -->
151
               <xsl:apply-templates select="$transtxt" mode="sqbrackets"/>
152
            </div>
153
            
154
            <div id="commentary">
155
               <h4 class="slimmer">Commentary:</h4>
156
               <!-- Commentary text output -->
157
               <xsl:variable name="commtxt">
158
                  <xsl:apply-templates select="//t:div[@type='commentary']//t:p"/>
159
               </xsl:variable>
160
               <!-- Moded templates found in htm-tpl-sqbrackets.xsl -->
161
               <xsl:apply-templates select="$commtxt" mode="sqbrackets"/>
162
            </div>
163
            
164
               <p><b>Bibliography: </b>
165
               <xsl:apply-templates select="//t:div[@type='bibliography']/t:p/node()"/> 
166
                  <br/>
167
                 <b>Text constituted from: </b>
168
                  <xsl:apply-templates select="//t:creation"/>
169
               </p>            
170
               
171
         </body>
172
      </html>
173
   </xsl:template>
174
   
175
   <xsl:template match="t:dimensions" mode="inslib-dimensions">
176
      <xsl:if test="text()">
177
         <xsl:if test="t:width/text()">w: 
178
            <xsl:value-of select="t:width"/>
179
            <xsl:if test="t:height/text()">
180
               <xsl:text> x </xsl:text>
181
            </xsl:if>
182
         </xsl:if>
183
         <xsl:if test="t:height/text()">h: 
184
            <xsl:value-of select="t:height"/>
185
         </xsl:if>
186
         <xsl:if test="t:depth/text()">x d:
187
            <xsl:value-of select="t:depth"/>
188
         </xsl:if>
189
         <xsl:if test="t:dim[@type='diameter']/text()">x diam.:
190
            <xsl:value-of select="t:dim[@type='diameter']"/>
191
         </xsl:if>
192
      </xsl:if>
193
   </xsl:template>
194
   
195
   <xsl:template match="t:placeName|t:rs" mode="inslib-placename">
196
      <xsl:choose>
197
         <xsl:when test="contains(@ref,'pleiades.stoa.org') or contains(@ref,'geonames.org')">
198
            <a>
199
               <xsl:attribute name="href">
200
                  <xsl:value-of select="@ref"/>
201
               </xsl:attribute>
202
               <xsl:apply-templates/>
203
            </a>
204
      </xsl:when>
205
         <xsl:otherwise>
206
            <xsl:apply-templates/>
207
         </xsl:otherwise>
208
      </xsl:choose>
209
   </xsl:template>
210
   
211
   <xsl:template name="inslib-invno">
212
      <xsl:if test="//t:idno[@type='invNo'][string(translate(normalize-space(.),' ',''))]">
213
         <xsl:text> (Inv. no. </xsl:text>
214
         <xsl:for-each select="//t:idno[@type='invNo'][string(translate(normalize-space(.),' ',''))]">
215
            <xsl:value-of select="."/>
216
            <xsl:if test="position()!=last()">
217
               <xsl:text>, </xsl:text>
218
            </xsl:if>
219
         </xsl:for-each>
220
         <xsl:text>)</xsl:text>
221
      </xsl:if>
222
   </xsl:template>
223
   
224
   </xsl:stylesheet>
(39-39/95)