8c9572dcf7a208f7ed77e2e8f93cacc44b77ee08
[metaproxy-moved-to-github.git] / xml / xslt / MARC21slim2DC.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- $Id: MARC21slim2DC.xsl,v 1.1 2006-10-04 11:21:48 marc Exp $ -->
3 <xsl:stylesheet version="1.0"
4   xmlns:marc="http://www.loc.gov/MARC21/slim"
5   xmlns:dc="http://purl.org/dc/elements/1.1/"
6   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7   exclude-result-prefixes="marc">
8         <xsl:import href="MARC21slimUtils.xsl"/>
9         <xsl:output method="xml" indent="yes"/>
10         
11         <xsl:template match="/">
12                         <xsl:apply-templates/>
13         </xsl:template>
14
15         <xsl:template match="marc:record">
16                 <xsl:variable name="leader" select="marc:leader"/>
17                 <xsl:variable name="leader6" select="substring($leader,7,1)"/>
18                 <xsl:variable name="leader7" select="substring($leader,8,1)"/>
19                 <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
20
21           <dc:dc>
22                         <xsl:for-each select="marc:datafield[@tag=245]">
23                                 <dc:title>
24                                         <xsl:call-template name="subfieldSelect">
25                                                 <xsl:with-param name="codes">abfghk</xsl:with-param>
26                                         </xsl:call-template>
27                                 </dc:title>
28                         </xsl:for-each>
29
30         
31                         <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]">
32                                 <dc:creator>
33                                         <xsl:value-of select="."/>
34                                 </dc:creator>
35                         </xsl:for-each>
36
37                         <dc:type>               
38                                 <xsl:if test="$leader7='c'">
39                                         <xsl:attribute name="collection">yes</xsl:attribute>
40                                 </xsl:if>
41
42                                 <xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'">
43                                         <xsl:attribute name="manuscript">yes</xsl:attribute>
44                                 </xsl:if>
45
46                                 <xsl:choose>
47                                         <xsl:when test="$leader6='a' or $leader6='t'">text</xsl:when>
48                                         <xsl:when test="$leader6='e' or $leader6='f'">cartographic</xsl:when>
49                                         <xsl:when test="$leader6='c' or $leader6='d'">notated music</xsl:when>
50                                         <xsl:when test="$leader6='i' or $leader6='j'">sound recording</xsl:when>
51                                         <xsl:when test="$leader6='k'">still image</xsl:when>
52                                         <xsl:when test="$leader6='g'">moving image</xsl:when>
53                                         <xsl:when test="$leader6='r'">three dimensional object</xsl:when>
54                                         <xsl:when test="$leader6='m'">software, multimedia</xsl:when>
55                                         <xsl:when test="$leader6='p'">mixed material</xsl:when>
56                                 </xsl:choose>
57                         </dc:type>
58
59                         <xsl:for-each select="marc:datafield[@tag=655]">
60                                 <dc:type>
61                                         <xsl:value-of select="."/>
62                                 </dc:type>
63                         </xsl:for-each>
64
65                         <xsl:for-each select="marc:datafield[@tag=260]">
66                                 <dc:publisher>
67                                         <xsl:call-template name="subfieldSelect">
68                                                 <xsl:with-param name="codes">ab</xsl:with-param>
69                                         </xsl:call-template>
70                                 </dc:publisher>
71                         </xsl:for-each>
72
73                         <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='c']">
74                                 <dc:date>
75                                         <xsl:value-of select="."/>
76                                 </dc:date>                              
77                         </xsl:for-each>
78
79                         <dc:language>
80                                 <xsl:value-of select="substring($controlField008,36,3)"/>
81                         </dc:language>
82
83                         <xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='q']">
84                                 <dc:format>
85                                         <xsl:value-of select="."/>
86                                 </dc:format>
87                         </xsl:for-each>
88
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
95                         <xsl:for-each select="marc:datafield[@tag=521]">
96                                 <dc:description>
97                                         <xsl:value-of select="marc:subfield[@code='a']"/>
98                                 </dc:description>
99                         </xsl:for-each>
100
101                         <xsl:for-each select="marc:datafield[500&lt;@tag][@tag&lt;=599][not(@tag=506 or @tag=530 or @tag=540 or @tag=546)]">
102                                 <dc:description>
103                                         <xsl:value-of select="marc:subfield[@code='a']"/>
104                                 </dc:description>
105                         </xsl:for-each>
106
107                         <xsl:for-each select="marc:datafield[@tag=600]">
108                                 <dc:subject>
109                                         <xsl:call-template name="subfieldSelect">
110                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
111                                         </xsl:call-template>
112                                 </dc:subject>
113                         </xsl:for-each>
114
115                         <xsl:for-each select="marc:datafield[@tag=610]">
116                                 <dc:subject>
117                                         <xsl:call-template name="subfieldSelect">
118                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
119                                         </xsl:call-template>
120                                 </dc:subject>
121                         </xsl:for-each>
122
123                         <xsl:for-each select="marc:datafield[@tag=611]">
124                                 <dc:subject>
125                                         <xsl:call-template name="subfieldSelect">
126                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
127                                         </xsl:call-template>
128                                 </dc:subject>
129                         </xsl:for-each>
130                 
131                         <xsl:for-each select="marc:datafield[@tag=630]">
132                                 <dc:subject>
133                                         <xsl:call-template name="subfieldSelect">
134                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
135                                         </xsl:call-template>
136                                 </dc:subject>
137                         </xsl:for-each>
138
139                         <xsl:for-each select="marc:datafield[@tag=650]">
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
147                         <xsl:for-each select="marc:datafield[@tag=653]">
148                                 <dc:subject>
149                                         <xsl:call-template name="subfieldSelect">
150                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
151                                         </xsl:call-template>
152                                 </dc:subject>
153                         </xsl:for-each>
154
155                         <xsl:for-each select="marc:datafield[@tag=752]">
156                                 <dc:coverage>
157                                         <xsl:call-template name="subfieldSelect">
158                                                 <xsl:with-param name="codes">abcd</xsl:with-param>
159                                         </xsl:call-template>
160                                 </dc:coverage>
161                         </xsl:for-each>
162
163                         <xsl:for-each select="marc:datafield[@tag=530]">
164                                 <dc:relation type="original">
165                                         <xsl:call-template name="subfieldSelect">
166                                                 <xsl:with-param name="codes">abcdu</xsl:with-param>
167                                         </xsl:call-template>
168                                 </dc:relation>  
169                         </xsl:for-each>
170
171                         <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]">
172                                 <dc:relation>
173                                         <xsl:call-template name="subfieldSelect">
174                                                 <xsl:with-param name="codes">ot</xsl:with-param>
175                                         </xsl:call-template>
176                                 </dc:relation>  
177                         </xsl:for-each>
178
179                         <xsl:for-each select="marc:datafield[@tag=856]">
180                                 <dc:identifier>
181                                         <xsl:value-of select="marc:subfield[@code='u']"/>
182                                 </dc:identifier>
183                         </xsl:for-each>
184
185                         <xsl:for-each select="marc:datafield[@tag=506]">
186                                 <dc:rights>
187                                         <xsl:value-of select="marc:subfield[@code='a']"/>
188                                 </dc:rights>
189                         </xsl:for-each>
190
191                         <xsl:for-each select="marc:datafield[@tag=540]">
192                                 <dc:rights>
193                                         <xsl:value-of select="marc:subfield[@code='a']"/>
194                                 </dc:rights>
195                         </xsl:for-each>
196                 </dc:dc>
197         </xsl:template>
198 </xsl:stylesheet>