added xml ressources - most notably the LOC marc21-toXYZ stylesheets
[metaproxy-moved-to-github.git] / xml / xslt / MARC21slim2RDFDC.xsl
1 <?xml version="1.0" encoding="UTF-8"?>\r
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">\r
3         <xsl:import href="MARC21slimUtils.xsl"/>\r
4         <xsl:output method="xml" indent="yes"/>\r
5         \r
6         <xsl:template match="/">\r
7                         <xsl:apply-templates/>\r
8         </xsl:template>\r
9 \r
10         <xsl:template match="marc:record">\r
11                 <xsl:variable name="leader" select="marc:leader"/>\r
12                 <xsl:variable name="leader6" select="substring($leader,7,1)"/>\r
13                 <xsl:variable name="leader7" select="substring($leader,8,1)"/>\r
14                 <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>\r
15 \r
16           <rdf:Description>\r
17                         <xsl:for-each select="marc:datafield[@tag=245]">\r
18                                 <dc:title>\r
19                                         <xsl:call-template name="subfieldSelect">\r
20                                                 <xsl:with-param name="codes">abfghk</xsl:with-param>\r
21                                         </xsl:call-template>\r
22                                 </dc:title>\r
23                         </xsl:for-each>\r
24 \r
25         \r
26                         <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]">\r
27                                 <dc:creator>\r
28                                         <xsl:value-of select="."/>\r
29                                 </dc:creator>\r
30                         </xsl:for-each>\r
31 \r
32                         <dc:type>               \r
33                                 <xsl:if test="$leader7='c'">\r
34                                         <xsl:attribute name="collection">yes</xsl:attribute>\r
35                                 </xsl:if>\r
36 \r
37                                 <xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'">\r
38                                         <xsl:attribute name="manuscript">yes</xsl:attribute>\r
39                                 </xsl:if>\r
40 \r
41                                 <xsl:choose>\r
42                                         <xsl:when test="$leader6='a' or $leader6='t'">text</xsl:when>\r
43                                         <xsl:when test="$leader6='e' or $leader6='f'">cartographic</xsl:when>\r
44                                         <xsl:when test="$leader6='c' or $leader6='d'">notated music</xsl:when>\r
45                                         <xsl:when test="$leader6='i' or $leader6='j'">sound recording</xsl:when>\r
46                                         <xsl:when test="$leader6='k'">still image</xsl:when>\r
47                                         <xsl:when test="$leader6='g'">moving image</xsl:when>\r
48                                         <xsl:when test="$leader6='r'">three dimensional object</xsl:when>\r
49                                         <xsl:when test="$leader6='m'">software, multimedia</xsl:when>\r
50                                         <xsl:when test="$leader6='p'">mixed material</xsl:when>\r
51                                 </xsl:choose>\r
52                         </dc:type>\r
53 \r
54                         <xsl:for-each select="marc:datafield[@tag=655]">\r
55                                 <dc:type>\r
56                                         <xsl:value-of select="."/>\r
57                                 </dc:type>\r
58                         </xsl:for-each>\r
59 \r
60                         <xsl:for-each select="marc:datafield[@tag=260]">\r
61                                 <dc:publisher>\r
62                                         <xsl:call-template name="subfieldSelect">\r
63                                                 <xsl:with-param name="codes">ab</xsl:with-param>\r
64                                         </xsl:call-template>\r
65                                 </dc:publisher>\r
66                         </xsl:for-each>\r
67 \r
68                         <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='c']">\r
69                                 <dc:date>\r
70                                         <xsl:value-of select="."/>\r
71                                 </dc:date>                              \r
72                         </xsl:for-each>\r
73 \r
74                         <dc:language>\r
75                                 <xsl:value-of select="substring($controlField008,36,3)"/>\r
76                         </dc:language>\r
77 \r
78                         <xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='q']">\r
79                                 <dc:format>\r
80                                         <xsl:value-of select="."/>\r
81                                 </dc:format>\r
82                         </xsl:for-each>\r
83 \r
84                         <xsl:for-each select="marc:datafield[@tag=520]">\r
85                                 <dc:description>\r
86                                         <xsl:value-of select="marc:subfield[@code='a']"/>\r
87                                 </dc:description>\r
88                         </xsl:for-each>\r
89 \r
90                         <xsl:for-each select="marc:datafield[@tag=521]">\r
91                                 <dc:description>\r
92                                         <xsl:value-of select="marc:subfield[@code='a']"/>\r
93                                 </dc:description>\r
94                         </xsl:for-each>\r
95 \r
96                         <xsl:for-each select="marc:datafield[500&lt;@tag][@tag&lt;=599][not(@tag=506 or @tag=530 or @tag=540 or @tag=546)]">\r
97                                 <dc:description>\r
98                                         <xsl:value-of select="marc:subfield[@code='a']"/>\r
99                                 </dc:description>\r
100                         </xsl:for-each>\r
101 \r
102                         <xsl:for-each select="marc:datafield[@tag=600]">\r
103                                 <dc:subject>\r
104                                         <xsl:call-template name="subfieldSelect">\r
105                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>\r
106                                         </xsl:call-template>\r
107                                 </dc:subject>\r
108                         </xsl:for-each>\r
109 \r
110                         <xsl:for-each select="marc:datafield[@tag=610]">\r
111                                 <dc:subject>\r
112                                         <xsl:call-template name="subfieldSelect">\r
113                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>\r
114                                         </xsl:call-template>\r
115                                 </dc:subject>\r
116                         </xsl:for-each>\r
117 \r
118                         <xsl:for-each select="marc:datafield[@tag=611]">\r
119                                 <dc:subject>\r
120                                         <xsl:call-template name="subfieldSelect">\r
121                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>\r
122                                         </xsl:call-template>\r
123                                 </dc:subject>\r
124                         </xsl:for-each>\r
125                 \r
126                         <xsl:for-each select="marc:datafield[@tag=630]">\r
127                                 <dc:subject>\r
128                                         <xsl:call-template name="subfieldSelect">\r
129                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>\r
130                                         </xsl:call-template>\r
131                                 </dc:subject>\r
132                         </xsl:for-each>\r
133 \r
134                         <xsl:for-each select="marc:datafield[@tag=650]">\r
135                                 <dc:subject>\r
136                                         <xsl:call-template name="subfieldSelect">\r
137                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>\r
138                                         </xsl:call-template>\r
139                                 </dc:subject>\r
140                         </xsl:for-each>\r
141 \r
142                         <xsl:for-each select="marc:datafield[@tag=653]">\r
143                                 <dc:subject>\r
144                                         <xsl:call-template name="subfieldSelect">\r
145                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>\r
146                                         </xsl:call-template>\r
147                                 </dc:subject>\r
148                         </xsl:for-each>\r
149 \r
150                         <xsl:for-each select="marc:datafield[@tag=752]">\r
151                                 <dc:coverage>\r
152                                         <xsl:call-template name="subfieldSelect">\r
153                                                 <xsl:with-param name="codes">abcd</xsl:with-param>\r
154                                         </xsl:call-template>\r
155                                 </dc:coverage>\r
156                         </xsl:for-each>\r
157 \r
158                         <xsl:for-each select="marc:datafield[@tag=530]">\r
159                                 <dc:relation type="original">\r
160                                         <xsl:call-template name="subfieldSelect">\r
161                                                 <xsl:with-param name="codes">abcdu</xsl:with-param>\r
162                                         </xsl:call-template>\r
163                                 </dc:relation>  \r
164                         </xsl:for-each>\r
165 \r
166                         <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]">\r
167                                 <dc:relation>\r
168                                         <xsl:call-template name="subfieldSelect">\r
169                                                 <xsl:with-param name="codes">ot</xsl:with-param>\r
170                                         </xsl:call-template>\r
171                                 </dc:relation>  \r
172                         </xsl:for-each>\r
173 \r
174                         <xsl:for-each select="marc:datafield[@tag=856]">\r
175                                 <dc:identifier>\r
176                                         <xsl:value-of select="marc:subfield[@code='u']"/>\r
177                                 </dc:identifier>\r
178                         </xsl:for-each>\r
179 \r
180                         <xsl:for-each select="marc:datafield[@tag=506]">\r
181                                 <dc:rights>\r
182                                         <xsl:value-of select="marc:subfield[@code='a']"/>\r
183                                 </dc:rights>\r
184                         </xsl:for-each>\r
185 \r
186                         <xsl:for-each select="marc:datafield[@tag=540]">\r
187                                 <dc:rights>\r
188                                         <xsl:value-of select="marc:subfield[@code='a']"/>\r
189                                 </dc:rights>\r
190                         </xsl:for-each>\r
191                 </rdf:Description>\r
192         </xsl:template>\r
193 </xsl:stylesheet><!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.\r
194 <metaInformation>\r
195 <scenarios ><scenario default="no" name="MODS Website Samples" userelativepaths="yes" externalpreview="no" url="..\xml\MARC21slim\modswebsitesamples.xml" htmlbaseurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="no" name="Ray Charles" userelativepaths="yes" externalpreview="no" url="..\xml\MARC21slim\raycharles.xml" htmlbaseurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="yes" name="s6" userelativepaths="yes" externalpreview="no" url="..\ifla\sally6.xml" htmlbaseurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="no" name="s7" userelativepaths="yes" externalpreview="no" url="..\ifla\sally7.xml" htmlbaseurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="no" name="s12" userelativepaths="yes" externalpreview="no" url="..\ifla\sally12.xml" htmlbaseurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/></scenarios><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>\r
196 </metaInformation>\r
197 -->