Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0" xmlns:dct="http://purl.org/dc/terms/"
3
	xmlns:dcx="http://ns.dataone.org/metadata/schema/onedcx/v1.0"
4
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
	xmlns="http://purl.org/dc/terms/">
6

    
7

    
8
	<xsl:template name="onedcx">
9
		<article class="container" id="Metadata">
10
			<form class="form-horizontal">
11
				<xsl:for-each select="*">
12
	
13
					<xsl:call-template name="citation" />
14
					<xsl:call-template name="general" />
15
					<xsl:call-template name="keywords" />
16
					<xsl:call-template name="people" />
17
					<xsl:call-template name="geography" />
18
					<xsl:call-template name="temporal" />
19
	
20
				</xsl:for-each>
21
			</form>
22
			
23

    
24
		</article>
25
	</xsl:template>
26

    
27
	<xsl:template name="citation">
28
		<cite class="citation">
29
			<xsl:value-of
30
				select="normalize-space(dcx:dcTerms/dct:bibliographicCitation)" />
31
		</cite>
32
	</xsl:template>
33

    
34
	<xsl:template name="general">
35
		<h4>General Content</h4>
36
		
37
		<div class="control-group">
38
			<label class="control-label">Title</label>
39
			<div class="controls controls-well">
40
				<strong>
41
					<xsl:value-of select="normalize-space(dcx:simpleDc/dct:title)" />
42
				</strong>
43
			</div>
44
		</div>
45
		
46
		<div class="control-group">
47
			<label class="control-label">Identifier</label>
48
			<div class="controls">
49
				<div class="controls-well">
50
					<xsl:value-of select="$pid" />
51
				</div>
52
			</div>
53
		</div>
54
		
55
		<xsl:if test="dcx:simpleDc/dct:identifier!=''">
56
			<div class="control-group">
57
				<label class="control-label">Alternate Identifier</label>
58
				<div class="controls">
59
					<div class="controls-well">
60
						<xsl:value-of select="normalize-space(dcx:simpleDc/dct:identifier)" />
61
					</div>
62
				</div>
63
			</div>
64
		</xsl:if>
65
		
66
		<xsl:if test="dcx:dcTerms/dct:references!=''">
67
			<div class="control-group">
68
				<label class="control-label">Online Access</label>
69
				<div class="controls controls-well">
70
					<xsl:for-each select="dcx:dcTerms/dct:references">
71
						<a>
72
							<xsl:attribute name="href">
73
								<xsl:value-of select="." />
74
							</xsl:attribute>
75
							<xsl:value-of select="." />
76
						</a>
77
					</xsl:for-each>
78
				</div>
79
			</div>
80
		</xsl:if>
81
		
82
		<xsl:if test="dcx:simpleDc/dct:source!=''">
83
			<div class="control-group">
84
				<label class="control-label">Online Access</label>
85
				<div class="controls controls-well">
86
					<xsl:for-each select="dcx:simpleDc/dct:source">
87
						<a>
88
							<xsl:attribute name="href">
89
								<xsl:value-of select="." />
90
							</xsl:attribute>
91
							<xsl:value-of select="." />
92
						</a>
93
					</xsl:for-each>
94
				</div>
95
			</div>
96
		</xsl:if>
97
		
98
		<div class="control-group">
99
			<label class="control-label">Abstract</label>
100
			<div class="controls controls-well">
101
				<div class="sectionText">
102
					<p>
103
						<xsl:value-of select="normalize-space(dcx:dcTerms/dct:abstract|dcx:simpleDc/dct:description)" />
104
					</p>
105
				</div>
106
			</div>
107
		</div>
108
	</xsl:template>
109

    
110
	<xsl:template name="keywords">
111
		<div class="row-fluid">
112
			<div class="control-group">
113
				<label class="control-label">Keywords (Dublin Core Terms subject)</label>
114
				<div class="controls controls-well">
115
					<table class="table table-striped table-condensed">
116
						<thead>
117
							<tr>
118
								<th>Keyword</th>
119
								<th>Type</th>
120
							</tr>
121
						</thead>
122
						<xsl:apply-templates select="dcx:simpleDc/dct:subject" />
123
					</table>
124
				</div>
125

    
126
			</div>
127
		</div>
128
	</xsl:template>
129

    
130
	<xsl:template name="keyword" match="dct:subject">
131
		<tr>
132
			<td>
133
				<xsl:value-of select="." />
134
			</td>
135
			<td></td>
136
		</tr>
137
	</xsl:template>
138

    
139
	<xsl:template name="people">
140
		<h4>Creators</h4>
141
		<div class="controls">
142
			<xsl:for-each select="dcx:simpleDc/dct:creator">
143
				<div class="controls-well">
144
					<xsl:value-of select="." />
145
				</div>
146
			</xsl:for-each>
147
		</div>
148
		<xsl:if test="dcx:simpleDc/dct:contributor!=''">
149
			<label class="control-label">Contributors</label>
150
			<xsl:for-each select="dcx:simpleDc/dct:contributor">
151
				<div class="controls controls-well">
152
					<xsl:value-of select="." />
153
				</div>
154
			</xsl:for-each>
155
		</xsl:if>
156
	</xsl:template>
157

    
158
	<xsl:template name="geography">
159
		<xsl:if test="//dcx:dcTerms/dct:spatial!=''">
160
			<div class="row-fluid">
161
				<div data-content="geographicCoverage" class="row-fluid geographicCoverage">
162
					<h4>Geographic Region</h4>
163
					
164
					<xsl:if test="//dcx:dcTerms/dct:spatial[not(contains(@xsi:type, 'Box'))]!=''">
165
						<div data-content="geographicDescription" class="control-group geographicDescription">
166
							<label class="control-label">Geographic Description</label>
167
							<div class="controls">
168
								<xsl:for-each select="//dcx:dcTerms/dct:spatial[not(contains(@xsi:type, 'Box'))]">
169
									<div class="controls-well">
170
										<xsl:value-of select="." />
171
									</div>
172
								</xsl:for-each>
173
							</div>
174
						</div>
175
					</xsl:if>
176
					
177
					<div data-content="boundingCoordinates" class="control-group boundingCoordinates">
178
						<label class="control-label">Bounding Coordinates</label>
179
						<div class="controls controls-well">					
180
							<xsl:for-each select="//dcx:dcTerms/dct:spatial[contains(@xsi:type, 'Box')]">
181
								<xsl:call-template name="extract-coordinates" />
182
							</xsl:for-each>
183
						</div>	
184
					</div>
185
	
186
				</div>
187
			</div>
188
		</xsl:if>
189
	</xsl:template>
190

    
191
	<xsl:template name="extract-coordinates">
192
		<xsl:call-template name="show-coordinate">
193
			<xsl:with-param name="data" select="." />
194
			<xsl:with-param name="corner" select="'northlimit'" />
195
			<xsl:with-param name="label" select="'North'" />
196
			<xsl:with-param name="bound" select="'northBoundingCoordinate'" />
197
		</xsl:call-template>
198
		<xsl:call-template name="show-coordinate">
199
			<xsl:with-param name="data" select="." />
200
			<xsl:with-param name="corner" select="'southlimit'" />
201
			<xsl:with-param name="label" select="'South'" />
202
			<xsl:with-param name="bound" select="'southBoundingCoordinate'" />
203
		</xsl:call-template>
204
		<xsl:call-template name="show-coordinate">
205
			<xsl:with-param name="data" select="." />
206
			<xsl:with-param name="corner" select="'eastlimit'" />
207
			<xsl:with-param name="label" select="'East'" />
208
			<xsl:with-param name="bound" select="'eastBoundingCoordinate'" />
209
		</xsl:call-template>
210
		<xsl:call-template name="show-coordinate">
211
			<xsl:with-param name="data" select="." />
212
			<xsl:with-param name="corner" select="'westlimit'" />
213
			<xsl:with-param name="label" select="'West'" />
214
			<xsl:with-param name="bound" select="'westBoundingCoordinate'" />
215
		</xsl:call-template>
216
	</xsl:template>
217

    
218
	<xsl:template name="show-coordinate">
219
		<xsl:param name="data" />
220
		<xsl:param name="corner" />
221
		<xsl:param name="label" />
222
		<xsl:param name="bound" />
223
		
224
		<xsl:variable name="coord">
225
			<xsl:choose>
226
				<xsl:when test="contains(substring-after($data,concat($corner,'=')), ';')">
227
					<xsl:value-of select="substring-before(substring-after($data,concat($corner,'=')), ';')" />
228
				</xsl:when>
229
				<xsl:otherwise>
230
					<xsl:value-of select="substring-after($data,concat($corner,'='))" />
231
				</xsl:otherwise>
232
			</xsl:choose>
233
		</xsl:variable>	
234
		
235
		<div data-value="{$coord}" data-content="{$bound}" class="control-group {$bound}">
236
			<label class="control-label">
237
				<xsl:value-of select="$label" />
238
			</label>
239
			<div class="controls controls-well">
240
				<xsl:value-of select="$coord" />
241
				<xsl:text> degrees</xsl:text>
242
			</div>
243
		</div>
244
	</xsl:template>
245
	
246
	<xsl:template name="extract-period">
247
		<xsl:call-template name="show-temporal">
248
			<xsl:with-param name="data" select="." />
249
			<xsl:with-param name="field" select="'start'" />
250
			<xsl:with-param name="label" select="'Begin Date'" />
251
		</xsl:call-template>
252
		<xsl:call-template name="show-temporal">
253
			<xsl:with-param name="data" select="." />
254
			<xsl:with-param name="field" select="'end'" />
255
			<xsl:with-param name="label" select="'End Date'" />
256
		</xsl:call-template>
257
	</xsl:template>
258
	
259
	<xsl:template name="show-temporal">
260
		<xsl:param name="data" />
261
		<xsl:param name="field" />
262
		<xsl:param name="label" />
263
		<xsl:variable name="date"
264
			select="substring-before(substring-after($data,concat($field,'=')),';')" />
265
		<label class="control-label">
266
			<xsl:value-of select="$label" />
267
		</label>
268
		<div class="controls controls-well">
269
			<xsl:value-of select="$date" />
270
		</div>
271
	</xsl:template>
272

    
273
	<xsl:template name="temporal">
274
		<xsl:if test="//dcx:dcTerms/dct:temporal!=''">
275
			<div class="row-fluid">
276
				<div data-content="temporalCoverage" class="row-fluid temporalCoverage">
277
					<h4>Temporal Coverage</h4>
278
					<div class="control-group">
279
						<xsl:if test="//dcx:dcTerms/dct:temporal[@xsi:type='Period']/text() != ''">
280
							<label class="control-label">Date Range</label>
281
							<div class="controls controls-well">					
282
								<xsl:for-each select="//dcx:dcTerms/dct:temporal[@xsi:type='Period']">
283
									<xsl:call-template name="extract-period" />
284
								</xsl:for-each>
285
							</div>	
286
						</xsl:if>
287
						<xsl:if test="//dcx:dcTerms/dct:temporal[not(@xsi:type='Period')]/text() != ''">
288
							<label class="control-label">Date(s)</label>
289
							<xsl:for-each select="//dcx:dcTerms/dct:temporal[not(@xsi:type='Period')]">
290
								<div class="controls controls-well">					
291
									<xsl:value-of select="." />
292
								</div>
293
							</xsl:for-each>
294
						</xsl:if>
295
					</div>
296
				</div>
297
			</div>
298
		</xsl:if>
299
	</xsl:template>
300

    
301
</xsl:stylesheet>
(2-2/2)