Project

General

Profile

aDryadItemSummary.xsl.xml

Rob Nahf, 2011-02-14 21:09

Download (16.4 KB)

 
1
<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:text>xxxxx</xsl:text>
17
                <xsl:variable name="datafiles" select=".//dim:field[@element='relation'][@qualifier='haspart']"/>
18

    
19
                <!-- my_doi and my_uri go together; there is a my_uri if no my_doi -->
20
                <xsl:variable name="my_doi"
21
                        select=".//dim:field[@element='identifier'][not(@qualifier)][starts-with(., 'doi:')]"/>
22
                <xsl:variable name="my_uri"
23
                        select=".//dim:field[@element='identifier'][@qualifier='uri'][not(starts-with(., 'doi'))]"/>
24

    
25
                <!-- Obtain an identifier if the item is harvested from KNB.
26
                           But we have to munge the URL to link to LTER instead of the raw XML. -->
27
                <xsl:variable name="knb_url_raw"
28
                        select=".//dim:field[@element='identifier'][starts-with(.,'http://metacat')]"/>
29
                <xsl:variable name="knb_url">
30
                        <xsl:if test="$knb_url_raw!=''">
31
                                <xsl:value-of select="substring($knb_url_raw,0,string-length($knb_url_raw)-2)"/>lter
32
                        </xsl:if>
33
                </xsl:variable>
34
                
35
                <!-- Obtain an identifier if the item is harvested from TreeBASE.
36
                But we have to munge the URL to link to TreeBASE instead of raw XML. -->
37
                <xsl:variable name="treebase_url_raw"
38
                        select=".//dim:field[@element='identifier'][contains(., 'purl.org/phylo/treebase/')]"/>
39
                <xsl:variable name="treebase_url">
40
                        <xsl:if test="$treebase_url_raw != ''">
41
                                <xsl:choose>
42
                                        <xsl:when test="starts-with(., 'http:')">
43
                                                <xsl:value-of select="concat($treebase_url_raw, '?format=html')"/>
44
                                        </xsl:when>
45
                                        <xsl:otherwise>
46
                                                <xsl:value-of select="concat('http://', $treebase_url_raw, '?format=html')"/>
47
                                        </xsl:otherwise>
48
                                </xsl:choose>
49
                        </xsl:if>
50
                </xsl:variable>
51

    
52
                <!-- CITATION FOR DATA FILE -->
53
                <xsl:if
54
                        test="$meta[@element='xhtml_head_item'][contains(., 'DCTERMS.isPartOf')]
55
                                and $meta[@element='request'][@qualifier='queryString'][not(contains(., 'show=full'))]
56
                                and $meta[@element='authors'][@qualifier='package']">
57

    
58
                        <xsl:variable name="article_doi"
59
                                select="$meta[@element='identifier'][@qualifier='article'][. != '']"/>
60

    
61
                        <div class="citation-view">
62
                                <p class="ds-paragraph">When using this data, please cite the original article:</p>
63
                                <blockquote>
64
                                        <xsl:variable name="citation" select="$meta[@element='citation'][@qualifier='article']"/>
65
                                        <xsl:choose>
66
                                                <xsl:when test="$citation != ''">
67
                                                        <xsl:choose>
68
                                                                <xsl:when test="$article_doi and not(contains($citation, $article_doi))">
69
                                                                        <xsl:copy-of select="$citation"/>
70
                                                                        <a>
71
                                                                                <xsl:attribute name="href">
72
                                                                                        <xsl:choose>
73
                                                                                                <xsl:when test="starts-with($article_doi, 'http')">
74
                                                                                                        <xsl:value-of select="$article_doi"/>
75
                                                                                                </xsl:when>
76
                                                                                                <xsl:when test="starts-with($article_doi, 'doi:')">
77
                                                                                                        <xsl:value-of
78
                                                                                                                select="concat('http://dx.doi.org/', substring-after($article_doi, 'doi:'))"
79
                                                                                                        />
80
                                                                                                </xsl:when>
81
                                                                                        </xsl:choose>
82
                                                                                </xsl:attribute>
83
                                                                                <xsl:value-of select="$article_doi"/>
84
                                                                        </a>
85
                                                                </xsl:when>
86
                                                                <xsl:when test="$article_doi">
87
                                                                        <xsl:copy-of select="substring-before($citation, $article_doi)"/>
88
                                                                        <a>
89
                                                                                <xsl:attribute name="href">
90
                                                                                        <xsl:value-of
91
                                                                                                select="concat('http://dx.doi.org/', substring-after($article_doi, 'doi:'))"
92
                                                                                        />
93
                                                                                </xsl:attribute>
94
                                                                                <xsl:value-of select="$article_doi"/>
95
                                                                        </a>
96
                                                                </xsl:when>
97
                                                                <xsl:otherwise>
98
                                                                        <xsl:value-of select="$citation"/>
99
                                                                </xsl:otherwise>
100
                                                        </xsl:choose>
101
                                                </xsl:when>
102
                                                <xsl:otherwise>
103
                                                        <xsl:variable name="journal" select="$meta[@element='publicationName']"/>
104
                                                        <xsl:choose>
105
                                                                <xsl:when test="$journal">
106
                                                                        <span style="font-style: italic;">Citation is not yet available for this article
107
                                                                                from <xsl:value-of select="$journal"/>. It will become available shortly after
108
                                                                                the article is published. <xsl:if test="$article_doi">
109
                                                                                        <a>
110
                                                                                                <xsl:attribute name="href">
111
                                                                                                        <xsl:choose>
112
                                                                                                                <xsl:when test="starts-with($article_doi, 'http')">
113
                                                                                                                        <xsl:value-of select="$article_doi"/>
114
                                                                                                                </xsl:when>
115
                                                                                                                <xsl:when test="starts-with($article_doi, 'doi:')">
116
                                                                                                                        <xsl:value-of
117
                                                                                                                                select="concat('http://dx.doi.org/', substring-after($article_doi, 'doi:'))"
118
                                                                                                                        />
119
                                                                                                                </xsl:when>
120
                                                                                                        </xsl:choose>
121
                                                                                                </xsl:attribute>
122
                                                                                                <xsl:value-of select="$article_doi"/>
123
                                                                                        </a>
124
                                                                                </xsl:if>
125
                                                                        </span>
126
                                                                </xsl:when>
127
                                                                <xsl:otherwise>
128
                                                                        <span style="font-style: italic;">Citation not yet available.</span>
129
                                                                </xsl:otherwise>
130
                                                        </xsl:choose>
131
                                                </xsl:otherwise>
132
                                        </xsl:choose>
133
                                </blockquote>
134
                        </div>
135
                </xsl:if>
136

    
137
                
138
                <!-- General, non-citation, metadata display-->
139

    
140
                <table class="ds-includeSet-table">
141
                        <tr class="ds-table-row">
142
                                <td>
143
                                        <xsl:choose>
144
                                                <xsl:when test="$treebase_url != ''">
145
                                                        <span class="bold">View Full Content in TreeBASE</span>
146
                                                </xsl:when>
147
                                                <xsl:when test="$knb_url!=''">
148
                                                        <span class="bold">View Full Content in KNB</span>
149
                                                </xsl:when>
150
                                                <xsl:when test="$datafiles!=''">
151
                                                        <span class="bold">Dryad Package Identifier</span>
152
                                                </xsl:when>
153
                                                <xsl:otherwise>
154
                                                        <span class="bold">Dryad File Identifier</span>
155
                                                </xsl:otherwise>
156
                                        </xsl:choose>
157
                                </td>
158
                                <td>
159
                                        <xsl:choose>
160
                                                <xsl:when test="$my_doi">
161
                                                        <a>
162
                                                                <xsl:attribute name="href">
163
                                                                        <xsl:call-template name="checkURL">
164
                                                                                <xsl:with-param name="url"
165
                                                                                        select="concat('http://dx.doi.org/', substring-after($my_doi, 'doi:'))"/>
166
                                                                                <xsl:with-param name="localize" select="$localize"/>
167
                                                                        </xsl:call-template>
168
                                                                </xsl:attribute>
169
                                                                <xsl:value-of select="$my_doi"/>
170
                                                        </a>
171
                                                </xsl:when>
172
                                                <xsl:when test="$my_uri">
173
                                                        <a>
174
                                                                <xsl:attribute name="href">
175
                                                                        <xsl:call-template name="checkURL">
176
                                                                                <xsl:with-param name="url" select="$my_uri"/>
177
                                                                                <xsl:with-param name="localize" select="$localize"/>
178
                                                                        </xsl:call-template>
179
                                                                </xsl:attribute>
180
                                                                <xsl:value-of select="$my_uri"/>
181
                                                        </a>
182
                                                </xsl:when>
183
                                        </xsl:choose>
184
                                </td>
185
                        </tr>
186

    
187
                        <xsl:if
188
                                test=".//dim:field[@element='identifier'][not(@qualifier)][not(contains(., 'dryad.'))]">
189
                                
190
                                <xsl:variable name="dc-creators" select=".//dim:field[@element='creator'][@mdschema='dc']"/>
191

    
192
                                <xsl:if test="$dc-creators != ''">
193
                                        <tr class="ds-table-row">
194
                                                <td>
195
                                                        <xsl:choose>
196
                                                                <xsl:when test="count($dc-creators) &gt; 1">
197
                                                                        <span class="bold">Authors</span>
198
                                                                </xsl:when>
199
                                                                <xsl:otherwise>
200
                                                                        <span class="bold">Author</span>
201
                                                                </xsl:otherwise>
202
                                                        </xsl:choose>
203
                                                </td>
204
                                                <td>
205
                                                        <xsl:for-each select="$dc-creators">
206
                                                                <xsl:value-of select="."/><br/>
207
                                                        </xsl:for-each>
208
                                                </td>
209
                                        </tr>
210
                                </xsl:if>
211
                                
212
                                <xsl:variable name="dc-publishers"
213
                                        select=".//dim:field[@element='publisher'][@mdschema='dc']"/>
214
                                
215
                                <xsl:if test="$dc-publishers != ''">
216
                                        <tr class="ds-table-row">
217
                                                <td>
218
                                                        <xsl:choose>
219
                                                                <xsl:when test="count($dc-publishers) &gt; 1">
220
                                                                        <span class="bold">Publishers</span>
221
                                                                </xsl:when>
222
                                                                <xsl:otherwise>
223
                                                                        <span class="bold">Publisher</span>
224
                                                                </xsl:otherwise>
225
                                                        </xsl:choose>
226
                                                </td>
227
                                                <td>
228
                                                        <xsl:for-each select="$dc-publishers">
229
                                                                <xsl:value-of select="."/><br/>
230
                                                        </xsl:for-each>
231
                                                </td>
232
                                        </tr>
233
                                </xsl:if>
234
                                
235
                                <xsl:variable name="dc-date"
236
                                        select=".//dim:field[@element='date'][not(@qualifier)][@mdschema='dc']"/>
237
                                
238
                                <xsl:if test="$dc-date != ''">
239
                                        <tr class="ds-table-row">
240
                                                <td>
241
                                                                <span class="bold">Published</span>
242
                                                </td>
243
                                                <td>
244
                                                        <xsl:value-of select="$dc-date[1]"/>
245
                                                </td>
246
                                        </tr>
247
                                </xsl:if>
248
                        </xsl:if>
249

    
250
                        <xsl:variable name="description">
251
                                <xsl:for-each select=".//dim:field[@element='description'][not(@qualifier='provenance')]">
252
                                        <xsl:copy-of select="node()"/>
253
                                        <br/>
254
                                </xsl:for-each>
255
                        </xsl:variable>
256

    
257
                        <xsl:if test="$description!=''">
258
                                <tr class="ds-table-row">
259
                                        <td>
260
                                                <xsl:choose>
261
                                                        <xsl:when test="//dim:field[@element='relation'][@qualifier='ispartof']">
262
                                                                <span class="bold">Description</span>
263
                                                        </xsl:when>
264
                                                        <xsl:otherwise>
265
                                                                <span class="bold">Abstract</span>
266
                                                        </xsl:otherwise>
267
                                                </xsl:choose>
268
                                        </td>
269
                                        <td>
270
                                                <xsl:copy-of select="$description"/>
271
                                        </td>
272
                                        <td> </td>
273
                                </tr>
274
                        </xsl:if>
275

    
276
                        <xsl:variable name="describedBy">
277
                                <xsl:for-each select=".//dim:field[@element='relation' and @qualifier='ispartof']">
278
                                        <a>
279
                                                <xsl:attribute name="href">
280
                                                        <xsl:call-template name="checkURL">
281
                                                                <xsl:with-param name="url" select="."/>
282
                                                                <xsl:with-param name="localize" select="$localize"/>
283
                                                        </xsl:call-template>
284
                                                </xsl:attribute>
285
                                                <xsl:copy-of select="."/>
286
                                        </a>
287
                                        <br/>
288
                                </xsl:for-each>
289
                        </xsl:variable>
290
                        <xsl:if test="$describedBy!=''">
291
                                <tr class="ds-table-row">
292
                                        <td>
293
                                                <span class="bold">Contained in Data Package</span>
294
                                        </td>
295
                                        <td>
296
                                                <xsl:copy-of select="$describedBy"/>
297
                                        </td>
298
                                        <td> </td>
299
                                </tr>
300
                        </xsl:if>
301

    
302
                        <xsl:variable name="sciNames">
303
                                <xsl:for-each select=".//dim:field[@element='ScientificName']">
304
                                        <xsl:copy-of select="node()"/>
305
                                        <br/>
306
                                </xsl:for-each>
307
                        </xsl:variable>
308
                        <xsl:if test="$sciNames!=''">
309
                                <tr class="ds-table-row">
310
                                        <td>
311
                                                <span class="bold">Scientific Names</span>
312
                                        </td>
313
                                        <td>
314
                                                <xsl:copy-of select="$sciNames"/>
315
                                        </td>
316
                                        <td> </td>
317
                                </tr>
318
                        </xsl:if>
319

    
320
                        <xsl:variable name="spatialCoverage">
321
                                <xsl:for-each select=".//dim:field[@element='coverage'][@qualifier='spatial']">
322
                                        <xsl:copy-of select="node()"/>
323
                                        <br/>
324
                                </xsl:for-each>
325
                        </xsl:variable>
326
                        <xsl:if test="$spatialCoverage!=''">
327
                                <tr class="ds-table-row">
328
                                        <td>
329
                                                <span class="bold">Spatial Coverage</span>
330
                                        </td>
331
                                        <td>
332
                                                <xsl:copy-of select="$spatialCoverage"/>
333
                                        </td>
334
                                        <td> </td>
335
                                </tr>
336
                        </xsl:if>
337

    
338
                        <xsl:variable name="temporalCoverage">
339
                                <xsl:for-each select=".//dim:field[@element='coverage'][@qualifier='temporal']">
340
                                        <xsl:copy-of select="node()"/>
341
                                        <br/>
342
                                </xsl:for-each>
343
                        </xsl:variable>
344
                        <xsl:if test="$temporalCoverage!=''">
345
                                <tr class="ds-table-row">
346
                                        <td>
347
                                                <span class="bold">Temporal Coverage</span>
348
                                        </td>
349
                                        <td>
350
                                                <xsl:copy-of select="$temporalCoverage"/>
351
                                        </td>
352
                                        <td> </td>
353
                                </tr>
354
                        </xsl:if>
355

    
356
                        <xsl:variable name="keywords">
357
                                <xsl:for-each select=".//dim:field[@element='subject'][@mdschema='dc'][not(@qualifier)]">
358
                                        <xsl:copy-of select="node()"/>
359
                                        <br/>
360
                                </xsl:for-each>
361
                        </xsl:variable>
362
                        <xsl:if test="$keywords!=''">
363
                                <tr class="ds-table-row">
364
                                        <td>
365
                                                <span class="bold">Keywords</span>
366
                                        </td>
367
                                        <td>
368
                                                <xsl:copy-of select="$keywords"/>
369
                                        </td>
370
                                        <td> </td>
371
                                </tr>
372
                        </xsl:if>
373

    
374
                        <xsl:if test=".//dim:field[@element='identifier'][not(@qualifier)][contains(., 'dryad.')]">
375
                                <tr class="ds-table-row">
376
                                        <td>
377
                                                <span class="bold">Date Deposited</span>
378
                                        </td>
379
                                        <td>
380
                                                <xsl:copy-of select=".//dim:field[@element='date' and @qualifier='accessioned']"/>
381
                                        </td>
382
                                        <td> </td>
383
                                </tr>
384
                        </xsl:if>
385

    
386
                </table>
387

    
388
                <!-- we only want this view from item view - not the administrative pages -->
389
                <xsl:if test="$meta[@qualifier='URI' and contains(.., 'handle')]">
390
                        <div style="padding: 10px; margin-top: 5px; margin-bottom: 5px;">
391
                                <a href="?show=full">Show Full Metadata</a>
392
                        </div>
393
                </xsl:if>
394

    
395
                <xsl:variable name="embargoedDate"
396
                        select=".//dim:field[@element='date' and @qualifier='embargoedUntil']"/>
397
                <xsl:variable name="embargoType">
398
                        <xsl:choose>
399
                                <xsl:when test=".//dim:field[@element='type' and @qualifier='embargo']">
400
                                        <xsl:value-of select=".//dim:field[@element='type' and @qualifier='embargo']"/>
401
                                </xsl:when>
402
                                <xsl:otherwise>
403
                                        <xsl:text>unknown</xsl:text>
404
                                </xsl:otherwise>
405
                        </xsl:choose>
406
                </xsl:variable>
407
                <xsl:choose>
408
                        <xsl:when test="$embargoedDate!=''">
409
                                <!-- this all might be overkill, need to confirm embargoedDate element disappears after time expires -->
410
                                <xsl:variable name="dateDiff">
411
                                        <xsl:call-template name="datetime:difference">
412
                                                <xsl:with-param name="start" select="datetime:date()"/>
413
                                                <xsl:with-param name="end" select="datetime:date($embargoedDate)"/>
414
                                        </xsl:call-template>
415
                                </xsl:variable>
416
                                <xsl:choose>
417
                                        <xsl:when test="$embargoedDate='9999-01-01' and $embargoType='oneyear'">
418
                                                <div id="embargo_notice">
419
                                                        <i18n:text>xmlui.ArtifactBrowser.RestrictedItem.head_resource.oneyear</i18n:text>
420
                                                </div>
421
                                        </xsl:when>
422
                                        <xsl:when
423
                                                test="$embargoedDate='9999-01-01' and ($embargoType='untilArticleAppears' or $embargoType='unknown')">
424
                                                <div id="embargo_notice">
425
                                                        <i18n:text>xmlui.ArtifactBrowser.RestrictedItem.head_resource.publication</i18n:text>
426
                                                </div>
427
                                        </xsl:when>
428
                                        <xsl:when test="not(starts-with($dateDiff, '-'))">
429
                                                <div id="embargo_notice">
430
                                                        <i18n:text>xmlui.ArtifactBrowser.RestrictedItem.head_resource</i18n:text>
431
                                                        <xsl:value-of select="$embargoedDate"/>
432
                                                </div>
433
                                        </xsl:when>
434
                                        <xsl:otherwise>
435
                                                <xsl:call-template name="checkedAndNoEmbargo"/>
436
                                        </xsl:otherwise>
437
                                </xsl:choose>
438
                        </xsl:when>
439
                        <xsl:when test="./mets:fileSec/mets:fileGrp[@USE='CONTENT']">
440
                                <xsl:call-template name="checkedAndNoEmbargo"/>
441
                        </xsl:when>
442
                </xsl:choose>
443

    
444
                <xsl:apply-templates select="./mets:fileSec/mets:fileGrp[@USE='CC-LICENSE' or @USE='LICENSE']"/>
445

    
446
                <xsl:if
447
                        test=".//dim:field[@element='rights'][.='http://creativecommons.org/publicdomain/zero/1.0/']">
448
                        <xsl:choose>
449
                                <!-- this all might be overkill, need to confirm embargoedDate element disappears after time expires -->
450
                                <xsl:when test="$embargoedDate!=''">
451
                                        <xsl:variable name="dateDiff">
452
                                                <xsl:call-template name="datetime:difference">
453
                                                        <xsl:with-param name="start" select="datetime:date()"/>
454
                                                        <xsl:with-param name="end" select="datetime:date($embargoedDate)"/>
455
                                                </xsl:call-template>
456
                                        </xsl:variable>
457
                                        <xsl:if test="starts-with($dateDiff, '-')">
458
                                                <div style="padding-top: 10px;">
459
                                                        <i18n:text>xmlui.dri2xhtml.METS-1.0.license-cc0</i18n:text>
460
                                                        <xsl:text> &#160; </xsl:text>
461
                                                        <a href="http://creativecommons.org/publicdomain/zero/1.0/" target="_blank">
462
                                                                <img src="/themes/Dryad/images/cc-zero.png"/>
463
                                                        </a>
464
                                                        <a href="http://opendefinition.org/">
465
                                                                <img src="/themes/Dryad/images/opendata.png"/>
466
                                                        </a>
467
                                                </div>
468
                                        </xsl:if>
469
                                </xsl:when>
470
                                <xsl:otherwise>
471
                                        <div style="padding-top: 10px;">
472
                                                <i18n:text>xmlui.dri2xhtml.METS-1.0.license-cc0</i18n:text>
473
                                                <xsl:text> &#160; </xsl:text>
474
                                                <a href="http://creativecommons.org/publicdomain/zero/1.0/" target="_blank">
475
                                                        <img src="/themes/Dryad/images/cc-zero.png"/>
476
                                                </a>
477
                                                <a href="http://opendefinition.org/">
478
                                                        <img src="/themes/Dryad/images/opendata.png"/>
479
                                                </a>
480
                                        </div>
481
                                </xsl:otherwise>
482
                        </xsl:choose>
483
                </xsl:if>
484
        </xsl:template>
485

    
486
        <xsl:template name="checkedAndNoEmbargo">
487
                <table class="ds-table file-list">
488
                        <tr class="ds-table-header-row"> </tr>
489
                        <tr>
490
                                <xsl:apply-templates select="./mets:fileSec/mets:fileGrp[@USE='CONTENT']">
491
                                        <xsl:with-param name="context" select="."/>
492
                                        <xsl:with-param name="primaryBitstream"
493
                                                select="./mets:structMap[@TYPE='LOGICAL']/mets:div[@TYPE='DSpace Item']/mets:fptr/@FILEID"
494
                                        />
495
                                </xsl:apply-templates>
496
                        </tr>
497
                </table>
498
        </xsl:template>
499

    
500

    
501
</xsl:stylesheet>
Add picture from clipboard (Maximum size: 14.8 MB)