/
item-list.xsl
164 lines (150 loc) · 7.66 KB
/
item-list.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<!--
The contents of this file are subject to the license and copyright
detailed in the LICENSE and NOTICE files at the root of the source
tree and available online at
http://www.dspace.org/license/
-->
<!--
Rendering of a list of items (e.g. in a search or
browse results page)
Author: art.lowel at atmire.com
Author: lieven.droogmans at atmire.com
Author: ben at atmire.com
Author: Alexey Maslov
-->
<xsl:stylesheet
xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
xmlns:dri="http://di.tamu.edu/DRI/1.0/"
xmlns:mets="http://www.loc.gov/METS/"
xmlns:dim="http://www.dspace.org/xmlns/dspace/dim"
xmlns:xlink="http://www.w3.org/TR/xlink/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:ore="http://www.openarchives.org/ore/terms/"
xmlns:oreatom="http://www.openarchives.org/ore/atom/"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:encoder="xalan://java.net.URLEncoder"
exclude-result-prefixes="xalan encoder i18n dri mets dim xlink xsl">
<xsl:output indent="yes"/>
<!-- An item rendered in the summaryList pattern. Commonly encountered in various browse-by pages
and search results. -->
<xsl:template name="itemSummaryList-DIM">
<!-- Generate the info about the item from the metadata section -->
<xsl:apply-templates select="./mets:dmdSec/mets:mdWrap[@OTHERMDTYPE='DIM']/mets:xmlData/dim:dim"
mode="itemSummaryList-DIM"/>
<!-- Generate the thunbnail, if present, from the file section -->
<xsl:apply-templates select="./mets:fileSec" mode="artifact-preview"/>
</xsl:template>
<!-- Generate the info about the item from the metadata section -->
<xsl:template match="dim:dim" mode="itemSummaryList-DIM">
<xsl:variable name="itemWithdrawn" select="@withdrawn" />
<div class="artifact-description">
<div class="artifact-title">
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="$itemWithdrawn">
<xsl:value-of select="ancestor::mets:METS/@OBJEDIT" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="ancestor::mets:METS/@OBJID" />
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:choose>
<xsl:when test="dim:field[@element='title']">
<xsl:value-of select="dim:field[@element='title'][1]/node()"/>
</xsl:when>
<xsl:otherwise>
<i18n:text>xmlui.dri2xhtml.METS-1.0.no-title</i18n:text>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</div>
<span class="Z3988">
<xsl:attribute name="title">
<xsl:call-template name="renderCOinS"/>
</xsl:attribute>
 <!-- non-breaking space to force separating the end tag -->
</span>
<div class="artifact-info">
<span class="author">
<xsl:choose>
<xsl:when test="dim:field[@element='contributor'][@qualifier='author']">
<xsl:for-each select="dim:field[@element='contributor'][@qualifier='author']">
<span>
<xsl:if test="@authority">
<xsl:attribute name="class"><xsl:text>ds-dc_contributor_author-authority</xsl:text></xsl:attribute>
</xsl:if>
<xsl:copy-of select="node()"/>
</span>
<xsl:if test="count(following-sibling::dim:field[@element='contributor'][@qualifier='author']) != 0">
<xsl:text>; </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:when test="dim:field[@element='creator']">
<xsl:for-each select="dim:field[@element='creator']">
<xsl:copy-of select="node()"/>
<xsl:if test="count(following-sibling::dim:field[@element='creator']) != 0">
<xsl:text>; </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:when test="dim:field[@element='contributor']">
<xsl:for-each select="dim:field[@element='contributor']">
<xsl:copy-of select="node()"/>
<xsl:if test="count(following-sibling::dim:field[@element='contributor']) != 0">
<xsl:text>; </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<i18n:text>xmlui.dri2xhtml.METS-1.0.no-author</i18n:text>
</xsl:otherwise>
</xsl:choose>
</span>
<xsl:text> </xsl:text>
<xsl:if test="dim:field[@element='date' and @qualifier='issued'] or dim:field[@element='publisher']">
<span class="publisher-date">
<xsl:text>(</xsl:text>
<xsl:if test="dim:field[@element='publisher']">
<span class="publisher">
<xsl:copy-of select="dim:field[@element='publisher']/node()"/>
</span>
<xsl:text>, </xsl:text>
</xsl:if>
<span class="date">
<xsl:value-of select="substring(dim:field[@element='date' and @qualifier='issued']/node(),1,10)"/>
</span>
<xsl:text>)</xsl:text>
</span>
</xsl:if>
</div>
</div>
</xsl:template>
<!-- An item rendered in the detailList pattern. Currently Manakin does not have a separate use for
detailList on items, so the logic of summaryList is used in its place. -->
<xsl:template name="itemDetailList-DIM">
<!-- Generate the info about the item from the metadata section -->
<xsl:apply-templates select="./mets:dmdSec/mets:mdWrap[@OTHERMDTYPE='DIM']/mets:xmlData/dim:dim"
mode="itemSummaryList-DIM"/>
<!-- Generate the thunbnail, if present, from the file section -->
<xsl:apply-templates select="./mets:fileSec" mode="artifact-preview"/>
</xsl:template>
<!-- Generate the thunbnail, if present, from the file section -->
<xsl:template match="mets:fileSec" mode="artifact-preview">
<xsl:if test="mets:fileGrp[@USE='THUMBNAIL']">
<div class="artifact-preview">
<a href="{ancestor::mets:METS/@OBJID}">
<img alt="Thumbnail">
<xsl:attribute name="src">
<xsl:value-of select="mets:fileGrp[@USE='THUMBNAIL']/mets:file/mets:FLocat[@LOCTYPE='URL']/@xlink:href" />
</xsl:attribute>
</img>
</a>
</div>
</xsl:if>
</xsl:template>
</xsl:stylesheet>