Merge branch 'master' of git.evergreen-ils.org:Evergreen into template-toolkit-opac
[working/Evergreen.git] / Open-ILS / xsl / MARC21slim2OAIDC.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <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">
3         <xsl:import href="MARC21slimUtils.xsl"/>
4         <xsl:output method="xml" indent="yes"/>
5         <!--Added ISBN and deleted attributes 6/04 jer-->
6         <xsl:template match="/">
7                 <xsl:if test="marc:collection">
8                         <oai_dc:dcCollection xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
9                                 <xsl:for-each select="marc:collection">
10                                         <xsl:for-each select="marc:record">
11                                                 <oai_dc:dc>
12                                                         <xsl:apply-templates select="."/>
13                                                 </oai_dc:dc>
14                                         </xsl:for-each>
15                                 </xsl:for-each>
16                         </oai_dc:dcCollection>
17                 </xsl:if>
18                 <xsl:if test="marc:record">
19                         <oai_dc:dc xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
20                                 <xsl:apply-templates/>
21                         </oai_dc:dc>
22                 </xsl:if>
23         </xsl:template>
24         <xsl:template match="marc:record">
25                 <xsl:variable name="leader" select="marc:leader"/>
26                 <xsl:variable name="leader6" select="substring($leader,7,1)"/>
27                 <xsl:variable name="leader7" select="substring($leader,8,1)"/>
28                 <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
29                 <xsl:for-each select="marc:datafield[@tag=245]">
30                         <dc:title>
31                                 <xsl:call-template name="subfieldSelect">
32                                         <xsl:with-param name="codes">abfghk</xsl:with-param>
33                                 </xsl:call-template>
34                         </dc:title>
35                 </xsl:for-each>
36                 <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]">
37                         <dc:creator>
38                                 <xsl:value-of select="."/>
39                         </dc:creator>
40                 </xsl:for-each>
41                 <dc:type>
42                         <xsl:if test="$leader7='c'">
43                                 <!--Remove attribute 6/04 jer-->
44                                 <!--<xsl:attribute name="collection">yes</xsl:attribute>-->
45                                 <xsl:text>collection</xsl:text>
46                         </xsl:if>
47                         <xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'">
48                                 <!--Remove attribute 6/04 jer-->
49                                 <!--<xsl:attribute name="manuscript">yes</xsl:attribute>-->
50                                 <xsl:text>manuscript</xsl:text>
51                         </xsl:if>
52                         <xsl:choose>
53                                 <xsl:when test="$leader6='a' or $leader6='t'">text</xsl:when>
54                                 <xsl:when test="$leader6='e' or $leader6='f'">cartographic</xsl:when>
55                                 <xsl:when test="$leader6='c' or $leader6='d'">notated music</xsl:when>
56                                 <xsl:when test="$leader6='i' or $leader6='j'">sound recording</xsl:when>
57                                 <xsl:when test="$leader6='k'">still image</xsl:when>
58                                 <xsl:when test="$leader6='g'">moving image</xsl:when>
59                                 <xsl:when test="$leader6='r'">three dimensional object</xsl:when>
60                                 <xsl:when test="$leader6='m'">software, multimedia</xsl:when>
61                                 <xsl:when test="$leader6='p'">mixed material</xsl:when>
62                         </xsl:choose>
63                 </dc:type>
64                 <xsl:for-each select="marc:datafield[@tag=655]">
65                         <dc:type>
66                                 <xsl:value-of select="."/>
67                         </dc:type>
68                 </xsl:for-each>
69                 <xsl:for-each select="marc:datafield[@tag=260]">
70                         <dc:publisher>
71                                 <xsl:call-template name="subfieldSelect">
72                                         <xsl:with-param name="codes">ab</xsl:with-param>
73                                 </xsl:call-template>
74                         </dc:publisher>
75                 </xsl:for-each>
76                 <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='c']">
77                         <dc:date>
78                                 <xsl:value-of select="."/>
79                         </dc:date>
80                 </xsl:for-each>
81                 <dc:language>
82                         <xsl:value-of select="substring($controlField008,36,3)"/>
83                 </dc:language>
84                 <xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='q']">
85                         <dc:format>
86                                 <xsl:value-of select="."/>
87                         </dc:format>
88                 </xsl:for-each>
89                 <xsl:for-each select="marc:datafield[@tag=520]">
90                         <dc:description>
91                                 <xsl:value-of select="marc:subfield[@code='a']"/>
92                         </dc:description>
93                 </xsl:for-each>
94                 <xsl:for-each select="marc:datafield[@tag=521]">
95                         <dc:description>
96                                 <xsl:value-of select="marc:subfield[@code='a']"/>
97                         </dc:description>
98                 </xsl:for-each>
99                 <xsl:for-each select="marc:datafield[500&lt;@tag][@tag&lt;=599][not(@tag=506 or @tag=530 or @tag=540 or @tag=546)]">
100                         <dc:description>
101                                 <xsl:value-of select="marc:subfield[@code='a']"/>
102                         </dc:description>
103                 </xsl:for-each>
104                 <xsl:for-each select="marc:datafield[@tag=600]">
105                         <dc:subject>
106                                 <xsl:call-template name="subfieldSelect">
107                                         <xsl:with-param name="codes">abcdq</xsl:with-param>
108                                 </xsl:call-template>
109                         </dc:subject>
110                 </xsl:for-each>
111                 <xsl:for-each select="marc:datafield[@tag=610]">
112                         <dc:subject>
113                                 <xsl:call-template name="subfieldSelect">
114                                         <xsl:with-param name="codes">abcdq</xsl:with-param>
115                                 </xsl:call-template>
116                         </dc:subject>
117                 </xsl:for-each>
118                 <xsl:for-each select="marc:datafield[@tag=611]">
119                         <dc:subject>
120                                 <xsl:call-template name="subfieldSelect">
121                                         <xsl:with-param name="codes">abcdq</xsl:with-param>
122                                 </xsl:call-template>
123                         </dc:subject>
124                 </xsl:for-each>
125                 <xsl:for-each select="marc:datafield[@tag=630]">
126                         <dc:subject>
127                                 <xsl:call-template name="subfieldSelect">
128                                         <xsl:with-param name="codes">abcdq</xsl:with-param>
129                                 </xsl:call-template>
130                         </dc:subject>
131                 </xsl:for-each>
132                 <xsl:for-each select="marc:datafield[@tag=650]">
133                         <dc:subject>
134                                 <xsl:call-template name="subfieldSelect">
135                                         <xsl:with-param name="codes">abcdq</xsl:with-param>
136                                 </xsl:call-template>
137                         </dc:subject>
138                 </xsl:for-each>
139                 <xsl:for-each select="marc:datafield[@tag=653]">
140                         <dc:subject>
141                                 <xsl:call-template name="subfieldSelect">
142                                         <xsl:with-param name="codes">abcdq</xsl:with-param>
143                                 </xsl:call-template>
144                         </dc:subject>
145                 </xsl:for-each>
146                 <xsl:for-each select="marc:datafield[@tag=752]">
147                         <dc:coverage>
148                                 <xsl:call-template name="subfieldSelect">
149                                         <xsl:with-param name="codes">abcd</xsl:with-param>
150                                 </xsl:call-template>
151                         </dc:coverage>
152                 </xsl:for-each>
153                 <xsl:for-each select="marc:datafield[@tag=530]">
154                         <dc:relation type="original">
155                                 <xsl:call-template name="subfieldSelect">
156                                         <xsl:with-param name="codes">abcdu</xsl:with-param>
157                                 </xsl:call-template>
158                         </dc:relation>
159                 </xsl:for-each>
160                 <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]">
161                         <dc:relation>
162                                 <xsl:call-template name="subfieldSelect">
163                                         <xsl:with-param name="codes">ot</xsl:with-param>
164                                 </xsl:call-template>
165                         </dc:relation>
166                 </xsl:for-each>
167                 <xsl:for-each select="marc:datafield[@tag=856]">
168                         <dc:identifier>
169                                 <xsl:value-of select="marc:subfield[@code='u']"/>
170                         </dc:identifier>
171                 </xsl:for-each>
172                 <xsl:for-each select="marc:datafield[@tag=020]">
173                         <dc:identifier>
174                                 <xsl:text>URN:ISBN:</xsl:text>
175                                 <xsl:value-of select="marc:subfield[@code='a']"/>
176                         </dc:identifier>
177                 </xsl:for-each>
178                 <xsl:for-each select="marc:datafield[@tag=506]">
179                         <dc:rights>
180                                 <xsl:value-of select="marc:subfield[@code='a']"/>
181                         </dc:rights>
182                 </xsl:for-each>
183                 <xsl:for-each select="marc:datafield[@tag=540]">
184                         <dc:rights>
185                                 <xsl:value-of select="marc:subfield[@code='a']"/>
186                         </dc:rights>
187                 </xsl:for-each>
188                 <!--</oai_dc:dc>-->
189         </xsl:template>
190 </xsl:stylesheet>
191
192 <!-- Stylus Studio meta-information - (c)1998-2003 Copyright Sonic Software Corporation. All rights reserved.
193 <metaInformation>
194 <scenarios/><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
195 </metaInformation>
196 -->