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