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