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
		<div class="control-group">
83
			<label class="control-label">Abstract</label>
84
			<div class="controls controls-well">
85
				<div class="sectionText">
86
					<p>
87
						<xsl:value-of select="normalize-space(dcx:dcTerms/dct:abstract|dcx:simpleDc/dct:description)" />
88
					</p>
89
				</div>
90
			</div>
91
		</div>
92
	</xsl:template>
93

    
94
	<xsl:template name="keywords">
95
		<div class="row-fluid">
96
			<div class="control-group">
97
				<label class="control-label">Keywords (Dublin Core Terms subject)</label>
98
				<div class="controls controls-well">
99
					<table class="table table-striped table-condensed">
100
						<thead>
101
							<tr>
102
								<th>Keyword</th>
103
								<th>Type</th>
104
							</tr>
105
						</thead>
106
						<xsl:apply-templates select="dcx:simpleDc/dct:subject" />
107
					</table>
108
				</div>
109

    
110
			</div>
111
		</div>
112
	</xsl:template>
113

    
114
	<xsl:template name="keyword" match="dct:subject">
115
		<tr>
116
			<td>
117
				<xsl:value-of select="." />
118
			</td>
119
			<td></td>
120
		</tr>
121
	</xsl:template>
122

    
123
	<xsl:template name="people">
124
		<h4>Creators</h4>
125
		<div class="controls">
126
			<xsl:for-each select="dcx:simpleDc/dct:creator">
127
				<div class="controls-well">
128
					<xsl:value-of select="." />
129
				</div>
130
			</xsl:for-each>
131
		</div>
132
		<xsl:if test="dcx:simpleDc/dct:contributor!=''">
133
			<label class="control-label">Contributors</label>
134
			<xsl:for-each select="dcx:simpleDc/dct:contributor">
135
				<div class="controls controls-well">
136
					<xsl:value-of select="." />
137
				</div>
138
			</xsl:for-each>
139
		</xsl:if>
140
	</xsl:template>
141

    
142
	<xsl:template name="geography">
143
		<xsl:if test="//dcx:dcTerms/dct:spatial!=''">
144
			<div class="row-fluid">
145
				<div data-content="geographicCoverage" class="row-fluid geographicCoverage">
146
					<h4>Geographic Region</h4>
147
					
148
					<xsl:if test="//dcx:dcTerms/dct:spatial[not(contains(@xsi:type, 'Box'))]!=''">
149
						<div data-content="geographicDescription" class="control-group geographicDescription">
150
							<label class="control-label">Geographic Description</label>
151
							<div class="controls">
152
								<xsl:for-each select="//dcx:dcTerms/dct:spatial[not(contains(@xsi:type, 'Box'))]">
153
									<div class="controls-well">
154
										<xsl:value-of select="." />
155
									</div>
156
								</xsl:for-each>
157
							</div>
158
						</div>
159
					</xsl:if>
160
					
161
					<div data-content="boundingCoordinates" class="control-group boundingCoordinates">
162
						<label class="control-label">Bounding Coordinates</label>
163
						<div class="controls controls-well">					
164
							<xsl:for-each select="//dcx:dcTerms/dct:spatial[contains(@xsi:type, 'Box')]">
165
								<xsl:call-template name="extract-coordinates" />
166
							</xsl:for-each>
167
						</div>	
168
					</div>
169
	
170
				</div>
171
			</div>
172
		</xsl:if>
173
	</xsl:template>
174

    
175
	<xsl:template name="extract-coordinates">
176
		<xsl:call-template name="show-coordinate">
177
			<xsl:with-param name="data" select="." />
178
			<xsl:with-param name="corner" select="'northlimit'" />
179
			<xsl:with-param name="label" select="'North'" />
180
			<xsl:with-param name="bound" select="'northBoundingCoordinate'" />
181
		</xsl:call-template>
182
		<xsl:call-template name="show-coordinate">
183
			<xsl:with-param name="data" select="." />
184
			<xsl:with-param name="corner" select="'southlimit'" />
185
			<xsl:with-param name="label" select="'South'" />
186
			<xsl:with-param name="bound" select="'southBoundingCoordinate'" />
187
		</xsl:call-template>
188
		<xsl:call-template name="show-coordinate">
189
			<xsl:with-param name="data" select="." />
190
			<xsl:with-param name="corner" select="'eastlimit'" />
191
			<xsl:with-param name="label" select="'East'" />
192
			<xsl:with-param name="bound" select="'eastBoundingCoordinate'" />
193
		</xsl:call-template>
194
		<xsl:call-template name="show-coordinate">
195
			<xsl:with-param name="data" select="." />
196
			<xsl:with-param name="corner" select="'westlimit'" />
197
			<xsl:with-param name="label" select="'West'" />
198
			<xsl:with-param name="bound" select="'westBoundingCoordinate'" />
199
		</xsl:call-template>
200
	</xsl:template>
201

    
202
	<xsl:template name="show-coordinate">
203
		<xsl:param name="data" />
204
		<xsl:param name="corner" />
205
		<xsl:param name="label" />
206
		<xsl:param name="bound" />
207
		
208
		<xsl:variable name="coord">
209
			<xsl:choose>
210
				<xsl:when test="contains(substring-after($data,concat($corner,'=')), ';')">
211
					<xsl:value-of select="substring-before(substring-after($data,concat($corner,'=')), ';')" />
212
				</xsl:when>
213
				<xsl:otherwise>
214
					<xsl:value-of select="substring-after($data,concat($corner,'='))" />
215
				</xsl:otherwise>
216
			</xsl:choose>
217
		</xsl:variable>	
218
		
219
		<div data-value="{$coord}" data-content="{$bound}" class="control-group {$bound}">
220
			<label class="control-label">
221
				<xsl:value-of select="$label" />
222
			</label>
223
			<div class="controls controls-well">
224
				<xsl:value-of select="$coord" />
225
				<xsl:text> degrees</xsl:text>
226
			</div>
227
		</div>
228
	</xsl:template>
229
	
230
	<xsl:template name="extract-period">
231
		<xsl:call-template name="show-temporal">
232
			<xsl:with-param name="data" select="." />
233
			<xsl:with-param name="field" select="'start'" />
234
			<xsl:with-param name="label" select="'Begin Date'" />
235
		</xsl:call-template>
236
		<xsl:call-template name="show-temporal">
237
			<xsl:with-param name="data" select="." />
238
			<xsl:with-param name="field" select="'end'" />
239
			<xsl:with-param name="label" select="'End Date'" />
240
		</xsl:call-template>
241
	</xsl:template>
242
	
243
	<xsl:template name="show-temporal">
244
		<xsl:param name="data" />
245
		<xsl:param name="field" />
246
		<xsl:param name="label" />
247
		<xsl:variable name="date"
248
			select="substring-before(substring-after($data,concat($field,'=')),';')" />
249
		<label class="control-label">
250
			<xsl:value-of select="$label" />
251
		</label>
252
		<div class="controls controls-well">
253
			<xsl:value-of select="$date" />
254
		</div>
255
	</xsl:template>
256

    
257
	<xsl:template name="temporal">
258
		<xsl:if test="//dcx:dcTerms/dct:temporal!=''">
259
			<div class="row-fluid">
260
				<div data-content="temporalCoverage" class="row-fluid temporalCoverage">
261
					<h4>Temporal Coverage</h4>
262
					<div class="control-group">
263
						<xsl:if test="//dcx:dcTerms/dct:temporal[@xsi:type='Period']/text() != ''">
264
							<label class="control-label">Date Range</label>
265
							<div class="controls controls-well">					
266
								<xsl:for-each select="//dcx:dcTerms/dct:temporal[@xsi:type='Period']">
267
									<xsl:call-template name="extract-period" />
268
								</xsl:for-each>
269
							</div>	
270
						</xsl:if>
271
						<xsl:if test="//dcx:dcTerms/dct:temporal[not(@xsi:type='Period')]/text() != ''">
272
							<label class="control-label">Date(s)</label>
273
							<xsl:for-each select="//dcx:dcTerms/dct:temporal[not(@xsi:type='Period')]">
274
								<div class="controls controls-well">					
275
									<xsl:value-of select="." />
276
								</div>
277
							</xsl:for-each>
278
						</xsl:if>
279
					</div>
280
				</div>
281
			</div>
282
		</xsl:if>
283
	</xsl:template>
284

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