Project

General

Profile

1 5965 berkley
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
2
	xmlns:dri="http://di.tamu.edu/DRI/1.0/" xmlns:mets="http://www.loc.gov/METS/"
3
	xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dim="http://www.dspace.org/xmlns/dspace/dim"
4
	xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xlink="http://www.w3.org/TR/xlink/"
5
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xalan"
6
	xmlns:datetime="http://exslt.org/dates-and-times" xmlns:encoder="xalan://java.net.URLEncoder"
7
	exclude-result-prefixes="xalan strings encoder datetime" version="1.0"
8
	xmlns:strings="http://exslt.org/strings">
9
10
	<xsl:import href="DryadUtils.xsl"/>
11
12
	<xsl:variable name="meta" select="/dri:document/dri:meta/dri:pageMeta/dri:metadata"/>
13
	<xsl:variable name="localize" select="$meta[@element='dryad'][@qualifier='localize'][.='true']"/>
14
15
	<xsl:template match="/">
16
		<xsl:variable name="datafiles" select=".//dim:field[@element='relation'][@qualifier='haspart']"/>
17
18
		<!-- my_doi and my_uri go together; there is a my_uri if no my_doi -->
19
		<xsl:variable name="my_doi"
20
			select=".//dim:field[@element='identifier'][not(@qualifier)][starts-with(., 'doi:')]"/>
21
		<xsl:variable name="my_uri"
22
			select=".//dim:field[@element='identifier'][@qualifier='uri'][not(starts-with(., 'doi'))]"/>
23
24
		<!-- Obtain an identifier if the item is harvested from KNB.
25
			   But we have to munge the URL to link to LTER instead of the raw XML. -->
26
		<xsl:variable name="knb_url_raw"
27
			select=".//dim:field[@element='identifier'][starts-with(.,'http://metacat')]"/>
28
		<xsl:variable name="knb_url">
29
			<xsl:if test="$knb_url_raw!=''">
30
				<xsl:value-of select="substring($knb_url_raw,0,string-length($knb_url_raw)-2)"/>lter
31
			</xsl:if>
32
		</xsl:variable>
33
34
		<!-- Obtain an identifier if the item is harvested from TreeBASE.
35
		But we have to munge the URL to link to TreeBASE instead of raw XML. -->
36
		<xsl:variable name="treebase_url_raw"
37
			select=".//dim:field[@element='identifier'][contains(., 'purl.org/phylo/treebase/')]"/>
38
		<xsl:variable name="treebase_url">
39
			<xsl:if test="$treebase_url_raw != ''">
40
				<xsl:choose>
41
					<xsl:when test="starts-with(., 'http:')">
42
						<xsl:value-of select="concat($treebase_url_raw, '?format=html')"/>
43
					</xsl:when>
44
					<xsl:otherwise>
45
						<xsl:value-of select="concat('http://', $treebase_url_raw, '?format=html')"/>
46
					</xsl:otherwise>
47
				</xsl:choose>
48
			</xsl:if>
49
		</xsl:variable>
50
51
		<!-- CITATION FOR DATA FILE -->
52
		<xsl:if
53
			test="$meta[@element='xhtml_head_item'][contains(., 'DCTERMS.isPartOf')]
54
				and $meta[@element='request'][@qualifier='queryString'][not(contains(., 'show=full'))]
55
				and $meta[@element='authors'][@qualifier='package']">
56
57
			<xsl:variable name="article_doi"
58
				select="$meta[@element='identifier'][@qualifier='article'][. != '']"/>
59
60
			<div class="citation-view">
61
				<p class="ds-paragraph">When using this data, please cite the original article:</p>
62
				<blockquote>
63
					<xsl:variable name="citation" select="$meta[@element='citation'][@qualifier='article']"/>
64
					<xsl:choose>
65
						<xsl:when test="$citation != ''">
66
							<xsl:choose>
67
								<xsl:when test="$article_doi and not(contains($citation, $article_doi))">
68
									<xsl:copy-of select="$citation"/>
69
									<a>
70
										<xsl:attribute name="href">
71
											<xsl:choose>
72
												<xsl:when test="starts-with($article_doi, 'http')">
73
													<xsl:value-of select="$article_doi"/>
74
												</xsl:when>
75
												<xsl:when test="starts-with($article_doi, 'doi:')">
76
													<xsl:value-of
77
														select="concat('http://dx.doi.org/', substring-after($article_doi, 'doi:'))"
78
													/>
79
												</xsl:when>
80
											</xsl:choose>
81
										</xsl:attribute>
82
										<xsl:value-of select="$article_doi"/>
83
									</a>
84
								</xsl:when>
85
								<xsl:when test="$article_doi">
86
									<xsl:copy-of select="substring-before($citation, $article_doi)"/>
87
									<a>
88
										<xsl:attribute name="href">
89
											<xsl:value-of
90
												select="concat('http://dx.doi.org/', substring-after($article_doi, 'doi:'))"
91
											/>
92
										</xsl:attribute>
93
										<xsl:value-of select="$article_doi"/>
94
									</a>
95
								</xsl:when>
96
								<xsl:otherwise>
97
									<xsl:value-of select="$citation"/>
98
								</xsl:otherwise>
99
							</xsl:choose>
100
						</xsl:when>
101
						<xsl:otherwise>
102
							<xsl:variable name="journal" select="$meta[@element='publicationName']"/>
103
							<xsl:choose>
104
								<xsl:when test="$journal">
105
									<span style="font-style: italic;">Citation is not yet available for this article
106
										from <xsl:value-of select="$journal"/>. It will become available shortly after
107
										the article is published. <xsl:if test="$article_doi">
108
											<a>
109
												<xsl:attribute name="href">
110
													<xsl:choose>
111
														<xsl:when test="starts-with($article_doi, 'http')">
112
															<xsl:value-of select="$article_doi"/>
113
														</xsl:when>
114
														<xsl:when test="starts-with($article_doi, 'doi:')">
115
															<xsl:value-of
116
																select="concat('http://dx.doi.org/', substring-after($article_doi, 'doi:'))"
117
															/>
118
														</xsl:when>
119
													</xsl:choose>
120
												</xsl:attribute>
121
												<xsl:value-of select="$article_doi"/>
122
											</a>
123
										</xsl:if>
124
									</span>
125
								</xsl:when>
126
								<xsl:otherwise>
127
									<span style="font-style: italic;">Citation not yet available.</span>
128
								</xsl:otherwise>
129
							</xsl:choose>
130
						</xsl:otherwise>
131
					</xsl:choose>
132
				</blockquote>
133
			</div>
134
		</xsl:if>
135
136
137
		<!-- General, non-citation, metadata display-->
138
139
		<table class="ds-includeSet-table">
140
			<tr class="ds-table-row">
141
				<td>
142
					<xsl:choose>
143
						<xsl:when test="$treebase_url != ''">
144
							<span class="bold">View Full Content in TreeBASE</span>
145
						</xsl:when>
146
						<xsl:when test="$knb_url!=''">
147
							<span class="bold">View Full Content in KNB</span>
148
						</xsl:when>
149
						<xsl:when test="$datafiles!=''">
150
							<span class="bold">Dryad Package Identifier</span>
151
						</xsl:when>
152
						<xsl:otherwise>
153
							<span class="bold">Dryad File Identifier</span>
154
						</xsl:otherwise>
155
					</xsl:choose>
156
				</td>
157
				<td>
158
					<xsl:choose>
159
						<xsl:when test="$my_doi">
160
							<a>
161
								<xsl:attribute name="href">
162
									<xsl:call-template name="checkURL">
163
										<xsl:with-param name="url"
164
											select="concat('http://dx.doi.org/', substring-after($my_doi, 'doi:'))"/>
165
										<xsl:with-param name="localize" select="$localize"/>
166
									</xsl:call-template>
167
								</xsl:attribute>
168
								<xsl:value-of select="$my_doi"/>
169
							</a>
170
						</xsl:when>
171
						<xsl:when test="$my_uri">
172
							<a>
173
								<xsl:attribute name="href">
174
									<xsl:call-template name="checkURL">
175
										<xsl:with-param name="url" select="$my_uri"/>
176
										<xsl:with-param name="localize" select="$localize"/>
177
									</xsl:call-template>
178
								</xsl:attribute>
179
								<xsl:value-of select="$my_uri"/>
180
							</a>
181
						</xsl:when>
182
					</xsl:choose>
183
				</td>
184
			</tr>
185
186
			<xsl:if
187
				test=".//dim:field[@element='identifier'][not(@qualifier)][not(contains(., 'dryad.'))]">
188
189
				<xsl:variable name="dc-creators" select=".//dim:field[@element='creator'][@mdschema='dc']"/>
190
191
				<xsl:if test="$dc-creators != ''">
192
					<tr class="ds-table-row">
193
						<td>
194
							<xsl:choose>
195
								<xsl:when test="count($dc-creators) &gt; 1">
196
									<span class="bold">Authors</span>
197
								</xsl:when>
198
								<xsl:otherwise>
199
									<span class="bold">Author</span>
200
								</xsl:otherwise>
201
							</xsl:choose>
202
						</td>
203
						<td>
204
							<xsl:for-each select="$dc-creators">
205
								<xsl:value-of select="."/><br/>
206
							</xsl:for-each>
207
						</td>
208
					</tr>
209
				</xsl:if>
210
211
				<xsl:variable name="dc-publishers"
212
					select=".//dim:field[@element='publisher'][@mdschema='dc']"/>
213
214
				<xsl:if test="$dc-publishers != ''">
215
					<tr class="ds-table-row">
216
						<td>
217
							<xsl:choose>
218
								<xsl:when test="count($dc-publishers) &gt; 1">
219
									<span class="bold">Publishers</span>
220
								</xsl:when>
221
								<xsl:otherwise>
222
									<span class="bold">Publisher</span>
223
								</xsl:otherwise>
224
							</xsl:choose>
225
						</td>
226
						<td>
227
							<xsl:for-each select="$dc-publishers">
228
								<xsl:value-of select="."/><br/>
229
							</xsl:for-each>
230
						</td>
231
					</tr>
232
				</xsl:if>
233
234
				<xsl:variable name="dc-date"
235
					select=".//dim:field[@element='date'][not(@qualifier)][@mdschema='dc']"/>
236
237
				<xsl:if test="$dc-date != ''">
238
					<tr class="ds-table-row">
239
						<td>
240
								<span class="bold">Published</span>
241
						</td>
242
						<td>
243
							<xsl:value-of select="$dc-date[1]"/>
244
						</td>
245
					</tr>
246
				</xsl:if>
247
			</xsl:if>
248
249
			<xsl:variable name="description">
250
				<xsl:for-each select=".//dim:field[@element='description'][not(@qualifier='provenance')]">
251
					<xsl:copy-of select="node()"/>
252
					<br/>
253
				</xsl:for-each>
254
			</xsl:variable>
255
256
			<xsl:if test="$description!=''">
257
				<tr class="ds-table-row">
258
					<td>
259
						<xsl:choose>
260
							<xsl:when test="//dim:field[@element='relation'][@qualifier='ispartof']">
261
								<span class="bold">Description</span>
262
							</xsl:when>
263
							<xsl:otherwise>
264
								<span class="bold">Abstract</span>
265
							</xsl:otherwise>
266
						</xsl:choose>
267
					</td>
268
					<td>
269
						<xsl:copy-of select="$description"/>
270
					</td>
271
					<td> </td>
272
				</tr>
273
			</xsl:if>
274
275
			<xsl:variable name="describedBy">
276
				<xsl:for-each select=".//dim:field[@element='relation' and @qualifier='ispartof']">
277
					<a>
278
						<xsl:attribute name="href">
279
							<xsl:call-template name="checkURL">
280
								<xsl:with-param name="url" select="."/>
281
								<xsl:with-param name="localize" select="$localize"/>
282
							</xsl:call-template>
283
						</xsl:attribute>
284
						<xsl:copy-of select="."/>
285
					</a>
286
					<br/>
287
				</xsl:for-each>
288
			</xsl:variable>
289
			<xsl:if test="$describedBy!=''">
290
				<tr class="ds-table-row">
291
					<td>
292
						<span class="bold">Contained in Data Package</span>
293
					</td>
294
					<td>
295
						<xsl:copy-of select="$describedBy"/>
296
					</td>
297
					<td> </td>
298
				</tr>
299
			</xsl:if>
300
301
			<xsl:variable name="sciNames">
302
				<xsl:for-each select=".//dim:field[@element='ScientificName']">
303
					<xsl:copy-of select="node()"/>
304
					<br/>
305
				</xsl:for-each>
306
			</xsl:variable>
307
			<xsl:if test="$sciNames!=''">
308
				<tr class="ds-table-row">
309
					<td>
310
						<span class="bold">Scientific Names</span>
311
					</td>
312
					<td>
313
						<xsl:copy-of select="$sciNames"/>
314
					</td>
315
					<td> </td>
316
				</tr>
317
			</xsl:if>
318
319
			<xsl:variable name="spatialCoverage">
320
				<xsl:for-each select=".//dim:field[@element='coverage'][@qualifier='spatial']">
321
					<xsl:copy-of select="node()"/>
322
					<br/>
323
				</xsl:for-each>
324
			</xsl:variable>
325
			<xsl:if test="$spatialCoverage!=''">
326
				<tr class="ds-table-row">
327
					<td>
328
						<span class="bold">Spatial Coverage</span>
329
					</td>
330
					<td>
331
						<xsl:copy-of select="$spatialCoverage"/>
332
					</td>
333
					<td> </td>
334
				</tr>
335
			</xsl:if>
336
337
			<xsl:variable name="temporalCoverage">
338
				<xsl:for-each select=".//dim:field[@element='coverage'][@qualifier='temporal']">
339
					<xsl:copy-of select="node()"/>
340
					<br/>
341
				</xsl:for-each>
342
			</xsl:variable>
343
			<xsl:if test="$temporalCoverage!=''">
344
				<tr class="ds-table-row">
345
					<td>
346
						<span class="bold">Temporal Coverage</span>
347
					</td>
348
					<td>
349
						<xsl:copy-of select="$temporalCoverage"/>
350
					</td>
351
					<td> </td>
352
				</tr>
353
			</xsl:if>
354
355
			<xsl:variable name="keywords">
356
				<xsl:for-each select=".//dim:field[@element='subject'][@mdschema='dc'][not(@qualifier)]">
357
					<xsl:copy-of select="node()"/>
358
					<br/>
359
				</xsl:for-each>
360
			</xsl:variable>
361
			<xsl:if test="$keywords!=''">
362
				<tr class="ds-table-row">
363
					<td>
364
						<span class="bold">Keywords</span>
365
					</td>
366
					<td>
367
						<xsl:copy-of select="$keywords"/>
368
					</td>
369
					<td> </td>
370
				</tr>
371
			</xsl:if>
372
373
			<xsl:if test=".//dim:field[@element='identifier'][not(@qualifier)][contains(., 'dryad.')]">
374
				<tr class="ds-table-row">
375
					<td>
376
						<span class="bold">Date Deposited</span>
377
					</td>
378
					<td>
379
						<xsl:copy-of select=".//dim:field[@element='date' and @qualifier='accessioned']"/>
380
					</td>
381
					<td> </td>
382
				</tr>
383
			</xsl:if>
384
385
		</table>
386
387
		<!-- we only want this view from item view - not the administrative pages -->
388
		<xsl:if test="$meta[@qualifier='URI' and contains(.., 'handle')]">
389
			<div style="padding: 10px; margin-top: 5px; margin-bottom: 5px;">
390
				<a href="?show=full">Show Full Metadata</a>
391
			</div>
392
		</xsl:if>
393
394
		<xsl:variable name="embargoedDate"
395
			select=".//dim:field[@element='date' and @qualifier='embargoedUntil']"/>
396
		<xsl:variable name="embargoType">
397
			<xsl:choose>
398
				<xsl:when test=".//dim:field[@element='type' and @qualifier='embargo']">
399
					<xsl:value-of select=".//dim:field[@element='type' and @qualifier='embargo']"/>
400
				</xsl:when>
401
				<xsl:otherwise>
402
					<xsl:text>unknown</xsl:text>
403
				</xsl:otherwise>
404
			</xsl:choose>
405
		</xsl:variable>
406
		<xsl:choose>
407
			<xsl:when test="$embargoedDate!=''">
408
				<!-- this all might be overkill, need to confirm embargoedDate element disappears after time expires -->
409
				<xsl:variable name="dateDiff">
410
					<xsl:call-template name="datetime:difference">
411
						<xsl:with-param name="start" select="datetime:date()"/>
412
						<xsl:with-param name="end" select="datetime:date($embargoedDate)"/>
413
					</xsl:call-template>
414
				</xsl:variable>
415
				<xsl:choose>
416
					<xsl:when test="$embargoedDate='9999-01-01' and $embargoType='oneyear'">
417
						<div id="embargo_notice">
418
							<i18n:text>xmlui.ArtifactBrowser.RestrictedItem.head_resource.oneyear</i18n:text>
419
						</div>
420
					</xsl:when>
421
					<xsl:when
422
						test="$embargoedDate='9999-01-01' and ($embargoType='untilArticleAppears' or $embargoType='unknown')">
423
						<div id="embargo_notice">
424
							<i18n:text>xmlui.ArtifactBrowser.RestrictedItem.head_resource.publication</i18n:text>
425
						</div>
426
					</xsl:when>
427
					<xsl:when test="not(starts-with($dateDiff, '-'))">
428
						<div id="embargo_notice">
429
							<i18n:text>xmlui.ArtifactBrowser.RestrictedItem.head_resource</i18n:text>
430
							<xsl:value-of select="$embargoedDate"/>
431
						</div>
432
					</xsl:when>
433
					<xsl:otherwise>
434
						<xsl:call-template name="checkedAndNoEmbargo"/>
435
					</xsl:otherwise>
436
				</xsl:choose>
437
			</xsl:when>
438
			<xsl:when test="./mets:fileSec/mets:fileGrp[@USE='CONTENT']">
439
				<xsl:call-template name="checkedAndNoEmbargo"/>
440
			</xsl:when>
441
		</xsl:choose>
442
443
		<xsl:apply-templates select="./mets:fileSec/mets:fileGrp[@USE='CC-LICENSE' or @USE='LICENSE']"/>
444
445
		<xsl:if
446
			test=".//dim:field[@element='rights'][.='http://creativecommons.org/publicdomain/zero/1.0/']">
447
			<xsl:choose>
448
				<!-- this all might be overkill, need to confirm embargoedDate element disappears after time expires -->
449
				<xsl:when test="$embargoedDate!=''">
450
					<xsl:variable name="dateDiff">
451
						<xsl:call-template name="datetime:difference">
452
							<xsl:with-param name="start" select="datetime:date()"/>
453
							<xsl:with-param name="end" select="datetime:date($embargoedDate)"/>
454
						</xsl:call-template>
455
					</xsl:variable>
456
					<xsl:if test="starts-with($dateDiff, '-')">
457
						<div style="padding-top: 10px;">
458
							<i18n:text>xmlui.dri2xhtml.METS-1.0.license-cc0</i18n:text>
459
							<xsl:text> &#160; </xsl:text>
460
							<a href="http://creativecommons.org/publicdomain/zero/1.0/" target="_blank">
461
								<img src="/themes/Dryad/images/cc-zero.png"/>
462
							</a>
463
							<a href="http://opendefinition.org/">
464
								<img src="/themes/Dryad/images/opendata.png"/>
465
							</a>
466
						</div>
467
					</xsl:if>
468
				</xsl:when>
469
				<xsl:otherwise>
470
					<div style="padding-top: 10px;">
471
						<i18n:text>xmlui.dri2xhtml.METS-1.0.license-cc0</i18n:text>
472
						<xsl:text> &#160; </xsl:text>
473
						<a href="http://creativecommons.org/publicdomain/zero/1.0/" target="_blank">
474
							<img src="/themes/Dryad/images/cc-zero.png"/>
475
						</a>
476
						<a href="http://opendefinition.org/">
477
							<img src="/themes/Dryad/images/opendata.png"/>
478
						</a>
479
					</div>
480
				</xsl:otherwise>
481
			</xsl:choose>
482
		</xsl:if>
483
	</xsl:template>
484
485
	<xsl:template name="checkedAndNoEmbargo">
486
		<table class="ds-table file-list">
487
			<tr class="ds-table-header-row"> </tr>
488
			<tr>
489
				<xsl:apply-templates select="./mets:fileSec/mets:fileGrp[@USE='CONTENT']">
490
					<xsl:with-param name="context" select="."/>
491
					<xsl:with-param name="primaryBitstream"
492
						select="./mets:structMap[@TYPE='LOGICAL']/mets:div[@TYPE='DSpace Item']/mets:fptr/@FILEID"
493
					/>
494
				</xsl:apply-templates>
495
			</tr>
496
		</table>
497
	</xsl:template>
498
499
500
</xsl:stylesheet>