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