This repository has been archived by the owner on Feb 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMARC21slim2OAIDC.xsl
200 lines (199 loc) · 8.65 KB
/
MARC21slim2OAIDC.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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="marc">
<xsl:import href="http://www.loc.gov/standards/marcxml/xslt/MARC21slimUtils.xsl"/>
<xsl:output method="xml" indent="yes"/>
<!--
Fixed 530 Removed type="original" from dc:relation 2010-11-19 tmee
Fixed 500 fields. 2006-12-11 ntra
Added ISBN and deleted attributes 6/04 jer
-->
<xsl:template match="/">
<xsl:if test="marc:collection">
<oai_dc:dcCollection xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<xsl:for-each select="marc:collection">
<xsl:for-each select="marc:record">
<oai_dc:dc>
<xsl:apply-templates select="."/>
</oai_dc:dc>
</xsl:for-each>
</xsl:for-each>
</oai_dc:dcCollection>
</xsl:if>
<xsl:if test="marc:record">
<oai_dc:dc xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<xsl:apply-templates/>
</oai_dc:dc>
</xsl:if>
</xsl:template>
<xsl:template match="marc:record">
<xsl:variable name="leader" select="marc:leader"/>
<xsl:variable name="leader6" select="substring($leader,7,1)"/>
<xsl:variable name="leader7" select="substring($leader,8,1)"/>
<xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
<xsl:for-each select="marc:datafield[@tag=245]">
<dc:title>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">abfghk</xsl:with-param>
</xsl:call-template>
</dc:title>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=100]|marc:datafield[@tag=110]|marc:datafield[@tag=111]|marc:datafield[@tag=700]|marc:datafield[@tag=710]|marc:datafield[@tag=711]|marc:datafield[@tag=720]">
<dc:creator>
<xsl:value-of select="."/>
</dc:creator>
</xsl:for-each>
<dc:type>
<xsl:if test="$leader7='c'">
<!--Remove attribute 6/04 jer-->
<!--<xsl:attribute name="collection">yes</xsl:attribute>-->
<xsl:text>collection</xsl:text>
</xsl:if>
<xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'">
<!--Remove attribute 6/04 jer-->
<!--<xsl:attribute name="manuscript">yes</xsl:attribute>-->
<xsl:text>manuscript</xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="$leader6='a' or $leader6='t'">text</xsl:when>
<xsl:when test="$leader6='e' or $leader6='f'">cartographic</xsl:when>
<xsl:when test="$leader6='c' or $leader6='d'">notated music</xsl:when>
<xsl:when test="$leader6='i' or $leader6='j'">sound recording</xsl:when>
<xsl:when test="$leader6='k'">still image</xsl:when>
<xsl:when test="$leader6='g'">moving image</xsl:when>
<xsl:when test="$leader6='r'">three dimensional object</xsl:when>
<xsl:when test="$leader6='m'">software, multimedia</xsl:when>
<xsl:when test="$leader6='p'">mixed material</xsl:when>
</xsl:choose>
</dc:type>
<xsl:for-each select="marc:datafield[@tag=655]">
<dc:type>
<xsl:value-of select="."/>
</dc:type>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=260]">
<dc:publisher>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">ab</xsl:with-param>
</xsl:call-template>
</dc:publisher>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='c']">
<dc:date>
<xsl:value-of select="."/>
</dc:date>
</xsl:for-each>
<dc:language>
<xsl:value-of select="substring($controlField008,36,3)"/>
</dc:language>
<xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='q']">
<dc:format>
<xsl:value-of select="."/>
</dc:format>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=520]">
<dc:description>
<xsl:value-of select="marc:subfield[@code='a']"/>
</dc:description>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=521]">
<dc:description>
<xsl:value-of select="marc:subfield[@code='a']"/>
</dc:description>
</xsl:for-each>
<xsl:for-each select="marc:datafield[500<= @tag and @tag<= 599 ][not(@tag=506 or @tag=530 or @tag=540 or @tag=546)]">
<dc:description>
<xsl:value-of select="marc:subfield[@code='a']"/>
</dc:description>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=600]">
<dc:subject>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">abcdq</xsl:with-param>
</xsl:call-template>
</dc:subject>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=610]">
<dc:subject>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">abcdq</xsl:with-param>
</xsl:call-template>
</dc:subject>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=611]">
<dc:subject>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">abcdq</xsl:with-param>
</xsl:call-template>
</dc:subject>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=630]">
<dc:subject>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">abcdq</xsl:with-param>
</xsl:call-template>
</dc:subject>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=650]">
<dc:subject>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">abcdq</xsl:with-param>
</xsl:call-template>
</dc:subject>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=653]">
<dc:subject>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">abcdq</xsl:with-param>
</xsl:call-template>
</dc:subject>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=752]">
<dc:coverage>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">abcd</xsl:with-param>
</xsl:call-template>
</dc:coverage>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=530]">
<dc:relation>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">abcdu</xsl:with-param>
</xsl:call-template>
</dc:relation>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=760]|marc:datafield[@tag=762]|marc:datafield[@tag=765]|marc:datafield[@tag=767]|marc:datafield[@tag=770]|marc:datafield[@tag=772]|marc:datafield[@tag=773]|marc:datafield[@tag=774]|marc:datafield[@tag=775]|marc:datafield[@tag=776]|marc:datafield[@tag=777]|marc:datafield[@tag=780]|marc:datafield[@tag=785]|marc:datafield[@tag=786]|marc:datafield[@tag=787]">
<dc:relation>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">ot</xsl:with-param>
</xsl:call-template>
</dc:relation>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=856]">
<dc:identifier>
<xsl:value-of select="marc:subfield[@code='u']"/>
</dc:identifier>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=020]">
<dc:identifier>
<xsl:text>URN:ISBN:</xsl:text>
<xsl:value-of select="marc:subfield[@code='a']"/>
</dc:identifier>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=506]">
<dc:rights>
<xsl:value-of select="marc:subfield[@code='a']"/>
</dc:rights>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=540]">
<dc:rights>
<xsl:value-of select="marc:subfield[@code='a']"/>
</dc:rights>
</xsl:for-each>
<!--</oai_dc:dc>-->
</xsl:template>
</xsl:stylesheet>
<!-- Stylus Studio meta-information - (c) 2004-2005. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="Scenario1" userelativepaths="yes" externalpreview="no" url="..\..\..\..\..\..\..\..\..\..\javadev4\testsets\diacriticu8.xml" htmlbaseurl="" outputurl="" processortype="internal" useresolver="yes" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext="" validateoutput="no" validator="internal" customvalidator=""/></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/><MapperBlockPosition></MapperBlockPosition><TemplateContext></TemplateContext><MapperFilter side="source"></MapperFilter></MapperMetaTag>
</metaInformation>
-->