-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvault_mods_2_oai_dc.xsl
358 lines (322 loc) · 16.2 KB
/
vault_mods_2_oai_dc.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<!-- NOTE: we cannot start at /xml/mods because we use certain pieces of the
/xml/item system-generated metadata -->
<xsl:template match="/xml">
<oai_dc:dc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dcterms="http://purl.org/dc/terms/" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<!-- NOTE reference mapping here:
https://www.loc.gov/standards/mods/mods-dcsimple.html -->
<xsl:if test="mods/titleInfo/title != ''">
<dc:title>
<xsl:value-of select="mods/titleInfo/title"/>
</dc:title>
</xsl:if>
<xsl:if test="mods/abstract != ''">
<dc:description>
<xsl:value-of select="mods/abstract" />
</dc:description>
</xsl:if>
<xsl:if test="mods/tableOfContents != ''">
<dcterms:tableOfContents>
<xsl:value-of select="mods/tableOfContents" />
</dcterms:tableOfContents>
</xsl:if>
<!-- use item's URL as identifier, seems to be best practice
magical EQUELLA hack: version 0 redirects to latest live version -->
<dc:identifier>
<xsl:text>https://vault.cca.edu/items/</xsl:text>
<xsl:value-of select="item/@id" />
<xsl:text>/0/</xsl:text>
</dc:identifier>
<!-- Libraries collection -->
<xsl:if test="mods/origininfo/dateCreatedWrapper/dateCreated != ''">
<dc:date>
<xsl:value-of select="mods/origininfo/dateCreatedWrapper/dateCreated" />
</dc:date>
</xsl:if>
<xsl:if test="mods/origininfo/dateOtherWrapper/dateOther != ''">
<dc:date>
<xsl:value-of select="mods/origininfo/dateOtherWrapper/dateOther" />
</dc:date>
</xsl:if>
<!-- date range, use only pointStart, see issue#5 -->
<xsl:if test="mods/origininfo/dateCreatedWrapper/pointStart != ''">
<dc:date>
<xsl:value-of select="mods/origininfo/dateCreatedWrapper/pointStart" />
</dc:date>
</xsl:if>
<!-- Faculty Research -->
<xsl:if test="mods/relatedItem/part/date != ''">
<dc:date>
<xsl:value-of select="mods/relatedItem/part/date" />
</dc:date>
</xsl:if>
<!-- separate creator from contributor -->
<xsl:for-each select="mods/name[@usage='primary']">
<xsl:if test="namePart != ''">
<dc:creator>
<xsl:value-of select="namePart" />
</dc:creator>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="mods/name[@usage='secondary']">
<xsl:if test="namePart != ''">
<dc:contributor>
<xsl:value-of select="namePart" />
</dc:contributor>
</xsl:if>
</xsl:for-each>
<!-- for Faculty Research collection, which follows MODS more closely -->
<xsl:for-each select="mods/name">
<xsl:if test="contains(role/roleTerm, 'author')">
<dc:creator>
<xsl:value-of select="namePart" />
</dc:creator>
</xsl:if>
<xsl:if test="contains(role/roleTerm, 'editor')">
<dc:contributor>
<xsl:value-of select="namePart" />
</dc:contributor>
</xsl:if>
</xsl:for-each>
<!-- MODS subject/name & subject/topic => dc:subject
we don't use subject/occupation -->
<xsl:for-each select="mods/subject">
<xsl:for-each select="name">
<dc:subject>
<xsl:value-of select="text()" />
</dc:subject>
</xsl:for-each>
<xsl:for-each select="topic">
<dc:subject>
<xsl:value-of select="text()" />
</dc:subject>
</xsl:for-each>
</xsl:for-each>
<!-- we also map mods/genreWrapper/genre to subject
so that we can reserve dc:type (where genre would normally go)
for DCMI Type terms to comply with Calisphere standards
-->
<xsl:for-each select="mods/genreWrapper">
<xsl:for-each select="genre">
<xsl:if test="text() != ''">
<dc:subject>
<xsl:value-of select="text()" />
</dc:subject>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
<!-- Libraries collection -->
<xsl:if test="mods/originInfo/publisher != ''">
<dc:publisher>
<xsl:value-of select="mods/originInfo/publisher" />
</dc:publisher>
</xsl:if>
<!-- typeOfResource maps to dc:type
We convert our vocabulary to DCMI Type terms, see
sites.google.com/a/cca.edu/libraries/home/vault/calisphere-dcmi-types -->
<xsl:for-each select="mods/typeOfResourceWrapper">
<xsl:for-each select="typeOfResource">
<!-- caching text in variable makes this faster -->
<xsl:variable name="text" select="text()" />
<xsl:choose>
<xsl:when test="$text = 'cartographic'">
<dc:type>Image</dc:type>
</xsl:when>
<xsl:when test="$text = 'notated music'">
<dc:type>Image</dc:type>
</xsl:when>
<xsl:when test="$text = 'mixed material'">
<dc:type>Image</dc:type>
</xsl:when>
<xsl:when test="$text = 'moving image'">
<dc:type>MovingImage</dc:type>
</xsl:when>
<xsl:when test="$text = 'software, multimedia'">
<dc:type>Software</dc:type>
</xsl:when>
<xsl:when test="$text = 'still image'">
<dc:type>Image</dc:type>
</xsl:when>
<!-- this covers 3 values:
sound recording, sound recording-musical, sound recording-nonmusical -->
<xsl:when test="starts-with($text, 'sound recording')">
<dc:type>Sound</dc:type>
</xsl:when>
<xsl:when test="$text = 'text'">
<dc:type>Text</dc:type>
</xsl:when>
<xsl:when test="$text = 'three dimensional object'">
<dc:type>Image</dc:type>
</xsl:when>
<!-- we do not supply an xsl:otherwise fallback -->
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
<!-- matches() function didn't work, don't know if there's an easier
way to do a case-insensitive match of plural & singular -->
<xsl:if test="local/courseWorkWrapper/courseWorkType = 'Thesis' or local/courseWorkWrapper/courseWorkType = 'thesis' or local/courseWorkWrapper/courseWorkType = 'Theses' or local/courseWorkWrapper/courseWorkType = 'theses'">
<dc:type>Dissertation/Thesis</dc:type>
</xsl:if>
<!-- for our more strictly MODS-adherent collections like Open Access
Journal Articles. See also mods/genreWrapper/genre -> dc:subject above.
MODS genre-> dc:type, NOT subject -->
<xsl:for-each select="mods/genre">
<xsl:if test="text() != ''">
<dc:type>
<xsl:value-of select="text()" />
</dc:type>
</xsl:if>
</xsl:for-each>
<!-- for Artists' Books collection, Calisphere wants everything to have a "type"
working around apostrophe in string, have to use entities for both the wrapping
quotes and the apos in the string -->
<xsl:if test="mods/physicalDescription/formBroad = "artists' books (books)"">
<dc:type>Image</dc:type>
</xsl:if>
<!-- specifically for Communications collection
which sets local/communicationsWrapper/submissionType to one of
press image, publication, or document -->
<xsl:for-each select="local/communicationsWrapper">
<xsl:if test="submissionType != ''">
<xsl:variable name="type" select="submissionType" />
<xsl:choose>
<xsl:when test="$type = 'document'">
<dc:type>Text</dc:type>
</xsl:when>
<xsl:when test="$type = 'press image'">
<dc:type>Image</dc:type>
</xsl:when>
<xsl:when test="$type = 'publication'">
<dc:type>Text</dc:type>
</xsl:when>
</xsl:choose>
</xsl:if>
<xsl:for-each select="photographer">
<dc:creator>
<xsl:value-of select="text()" />
</dc:creator>
</xsl:for-each>
</xsl:for-each>
<!-- regardless of the physicalDescription child node, put it in format -->
<xsl:for-each select="mods/physicalDescription/*">
<xsl:if test="text() != ''">
<dc:format>
<xsl:value-of select="text()" />
</dc:format>
</xsl:if>
</xsl:for-each>
<xsl:if test="mods/language != ''">
<dc:language>
<xsl:value-of select="mods/language" />
</dc:language>
</xsl:if>
<!-- MODS subject/geographic & subject/temporal => dc:coverage
& we don't use cartographics or hierarchicalGeographic -->
<xsl:for-each select="mods/subject">
<xsl:for-each select="temporal">
<dc:coverage>
<xsl:value-of select="text()" />
</dc:coverage>
</xsl:for-each>
<xsl:for-each select="geographic">
<dc:coverage>
<xsl:value-of select="text()" />
</dc:coverage>
</xsl:for-each>
</xsl:for-each>
<!-- for Faculty Research collection
must expose the host publication, especially for inclusion in Worldcat
Libraries collection also uses relatedItem[type=host]
so we need to check for an ISSN or ISBN -->
<xsl:for-each select="mods/relatedItem[@type='host']">
<xsl:if test="identifier/@type = 'issn'">
<xsl:if test="identifier != ''">
<dcterms:isPartOf>
<xsl:text>urn:ISSN:</xsl:text>
<xsl:value-of select="identifier" />
</dcterms:isPartOf>
</xsl:if>
<!-- fully formatted citation along the lines of
Library and Information Science Research 22(3), 311-338. (2000)
for some reason xsl:text is necessary to make the 1st space appear-->
<dcterms:bibliographicCitation>
<!-- we'll always have at least a title in one of these
2 fields (1st Faculty Research, 2nd OA Articles) -->
<xsl:value-of select="title" />
<xsl:value-of select="titleInfo/title" />
<xsl:variable name="volume" select="part/detail[@type='volume']/number" />
<xsl:if test="$volume != ''">
<xsl:text> vol. </xsl:text>
<xsl:value-of select="$volume" />
</xsl:if>
<xsl:variable name="issue" select="part/detail[@type='number']/number" />
<xsl:if test="$issue != ''">
<xsl:variable name="issueCaption" select="part/detail[@type='number']/caption" />
<xsl:choose>
<xsl:when test="$issueCaption != ''">
<xsl:text> </xsl:text>
<xsl:value-of select="$issueCaption" />
<xsl:text> </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> no. </xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$issue" />
</xsl:if>
<!-- only show comma if we have at least volume & start pg -->
<xsl:variable name="start" select="part/extent/start" />
<xsl:if test="($volume != '' or $issue != '') and $start != ''">
<xsl:text>, p. </xsl:text>
</xsl:if>
<xsl:if test="$start != ''">
<xsl:value-of select="$start" />
</xsl:if>
<xsl:if test="part/extent/end != ''">
<xsl:text>-</xsl:text><xsl:value-of select="part/extent/end" />
</xsl:if>
<xsl:text>.</xsl:text>
<xsl:if test="part/date != ''">
<xsl:text> (</xsl:text>
<xsl:value-of select="part/date" />
<xsl:text>)</xsl:text>
</xsl:if>
</dcterms:bibliographicCitation>
</xsl:if>
<!-- similar but for book chapters with associated ISBNs -->
<xsl:if test="identifier/@type = 'isbn' and identifier !=''">
<dcterms:isPartOf>
<xsl:text>urn:ISBN:</xsl:text>
<xsl:value-of select="identifier" />
</dcterms:isPartOf>
</xsl:if>
<!-- per Summon Support adding journal or book title to dc:source
is helpful, is translated to PublicationTitle field. -->
<xsl:if test="title != '' or titleInfo/title != ''">
<dc:source>
<xsl:value-of select="title" />
<xsl:value-of select="titleInfo/title" />
</dc:source>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="local/department">
<dc:subject>
<xsl:value-of select="text()" />
</dc:subject>
</xsl:for-each>
<xsl:if test="mods/accessCondition != ''">
<dc:rights>
<xsl:value-of select="mods/accessCondition" />
</dc:rights>
</xsl:if>
<xsl:if test="mods/accessCondition/@href != ''">
<dc:rights>
<xsl:value-of select="mods/accessCondition/@href" />
</dc:rights>
</xsl:if>
</oai_dc:dc>
</xsl:template>
</xsl:transform>