Bug 11750: (QA follow-up) Remove unconditional warn
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / xslt / UNIMARCslim2OAIDC.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE stylesheet>
4
5 <xsl:stylesheet version="1.0" 
6   xmlns:marc="http://www.loc.gov/MARC21/slim" 
7   xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" 
8   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9   xmlns:dc="http://purl.org/dc/elements/1.1/"
10   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="marc">
11   <xsl:import href="MARC21slimUtils.xsl"/>
12   <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
13   <xsl:template match="/">
14     <xsl:if test="marc:collection">
15       <oai_dc:dcCollection xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
16         <xsl:for-each select="marc:collection">
17           <xsl:for-each select="marc:record">
18             <oai_dc:dc>
19               <xsl:apply-templates select="."/>
20             </oai_dc:dc>
21           </xsl:for-each>
22         </xsl:for-each>
23       </oai_dc:dcCollection>
24     </xsl:if>
25     <xsl:if test="marc:record">
26       <oai_dc:dc
27       xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
28       xmlns:dc="http://purl.org/dc/elements/1.1/"
29       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
30       xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
31         <xsl:apply-templates/>
32       </oai_dc:dc>
33     </xsl:if>
34   </xsl:template>
35   <xsl:template match="marc:record">
36     <xsl:for-each select="marc:datafield[@tag=200]">
37       <dc:title>
38         <xsl:call-template name="subfieldSelect">
39           <xsl:with-param name="codes">a</xsl:with-param>
40         </xsl:call-template>
41       </dc:title>
42     </xsl:for-each>
43     <xsl:for-each select="marc:datafield[@tag=700]|marc:datafield[@tag=701]|marc:datafield[@tag=702]|marc:datafield[@tag=710]|marc:datafield[@tag=711]|marc:datafield[@tag=712]">
44       <dc:creator>
45       <xsl:value-of select="marc:subfield[@code='a']"/>
46       <xsl:if test="marc:subfield[@code='b']">
47          <xsl:text>, </xsl:text>
48          <xsl:value-of select="marc:subfield[@code='b']"/>
49       </xsl:if>
50       <xsl:choose>
51         <xsl:when test="marc:subfield[@code='4']='010'">, adapter</xsl:when>
52         <xsl:when test="marc:subfield[@code='4']='020'">, annotator</xsl:when>
53         <xsl:when test="marc:subfield[@code='4']='075'">, author of afterword</xsl:when>
54         <xsl:when test="marc:subfield[@code='4']='080'">, prefacer</xsl:when>
55         <xsl:when test="marc:subfield[@code='4']='100'">, bibliographic antecedent</xsl:when>
56         <xsl:when test="marc:subfield[@code='4']='205'">, collaborator</xsl:when>
57         <xsl:when test="marc:subfield[@code='4']='212'">, commentator</xsl:when>
58         <xsl:when test="marc:subfield[@code='4']='220'">, compiler</xsl:when>
59         <xsl:when test="marc:subfield[@code='4']='230'">, composer</xsl:when>
60         <xsl:when test="marc:subfield[@code='4']='245'">, conceptor</xsl:when>
61         <xsl:when test="marc:subfield[@code='4']='295'">, degree-grantor</xsl:when>
62         <xsl:when test="marc:subfield[@code='4']='340'">, editor</xsl:when>
63         <xsl:when test="marc:subfield[@code='4']='370'">, film editor</xsl:when>
64         <xsl:when test="marc:subfield[@code='4']='395'">, founder</xsl:when>
65         <xsl:when test="marc:subfield[@code='4']='440'">, illustrator</xsl:when>
66         <xsl:when test="marc:subfield[@code='4']='520'">, lyricist</xsl:when>
67         <xsl:when test="marc:subfield[@code='4']='557'">, organiser of meeting</xsl:when>
68         <xsl:when test="marc:subfield[@code='4']='570'">, other</xsl:when>
69         <xsl:when test="marc:subfield[@code='4']='600'">, photographer</xsl:when>
70         <xsl:when test="marc:subfield[@code='4']='605'">, presenter</xsl:when>
71         <xsl:when test="marc:subfield[@code='4']='650'">, publisher</xsl:when>
72         <xsl:when test="marc:subfield[@code='4']='651'">, publishing director</xsl:when>
73         <xsl:when test="marc:subfield[@code='4']='673'">, research team head</xsl:when>
74         <xsl:when test="marc:subfield[@code='4']='675'">, reviewer</xsl:when>
75         <xsl:when test="marc:subfield[@code='4']='710'">, redactor</xsl:when>
76         <xsl:when test="marc:subfield[@code='4']='723'">, sponsor</xsl:when>
77         <xsl:when test="marc:subfield[@code='4']='727'">, thesis advisor</xsl:when>
78         <xsl:when test="marc:subfield[@code='4']='730'">, translator</xsl:when>
79       </xsl:choose>
80       </dc:creator>
81     </xsl:for-each>
82     <dc:type>
83       <xsl:value-of select="marc:datafield[@tag=200]/marc:subfield[@code='b']"/>
84     </dc:type>
85     <xsl:for-each select="marc:datafield[@tag=210]/marc:subfield[@code='c']">
86       <dc:publisher>
87         <xsl:value-of select="."/>
88       </dc:publisher>
89     </xsl:for-each>
90     <xsl:for-each select="marc:datafield[@tag=210]/marc:subfield[@code='d']">
91       <dc:date>
92         <xsl:value-of select="."/>
93       </dc:date>
94     </xsl:for-each>
95     <xsl:for-each select="marc:datafield[@tag=101]/marc:subfield[@code='a']">
96       <dc:language>
97       <xsl:value-of select="."/>
98       </dc:language>
99     </xsl:for-each>
100     <xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='q']">
101       <dc:format>
102         <xsl:value-of select="."/>
103       </dc:format>
104     </xsl:for-each>
105     <xsl:for-each select="marc:datafield[@tag=520]">
106       <dc:description>
107         <xsl:value-of select="marc:subfield[@code='a']"/>
108       </dc:description>
109     </xsl:for-each>
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     <xsl:for-each select="marc:datafield[300&lt;@tag][@tag&lt;=345]">
116       <dc:description>
117         <xsl:value-of select="marc:subfield[@code='a']"/>
118       </dc:description>
119     </xsl:for-each>
120     <xsl:for-each select="marc:datafield[@tag=600]|marc:datafield[@tag=601]|marc:datafield[@tag=602]|marc:datafield[@tag=604]|marc:datafield[@tag=605]|marc:datafield[@tag=606]">
121       <dc:subject>
122         <xsl:call-template name="subfieldSelect">
123           <xsl:with-param name="codes">abcdq</xsl:with-param>
124         </xsl:call-template>
125       </dc:subject>
126     </xsl:for-each>
127     <xsl:for-each select="marc:datafield[@tag=752]">
128       <dc:coverage>
129         <xsl:call-template name="subfieldSelect">
130           <xsl:with-param name="codes">abcd</xsl:with-param>
131         </xsl:call-template>
132       </dc:coverage>
133     </xsl:for-each>
134     <xsl:for-each select="marc:datafield[@tag=530]">
135       <dc:relation type="original">
136         <xsl:call-template name="subfieldSelect">
137           <xsl:with-param name="codes">abcdu</xsl:with-param>
138         </xsl:call-template>
139       </dc:relation>
140     </xsl:for-each>
141     <xsl:for-each select="marc:datafield[@tag=461]|marc:datafield[@tag=464]">
142       <dc:relation>
143         <xsl:call-template name="subfieldSelect">
144           <xsl:with-param name="codes">t</xsl:with-param>
145         </xsl:call-template>
146       </dc:relation>
147     </xsl:for-each>
148     <xsl:for-each select="marc:datafield[@tag=856]">
149       <dc:identifier>
150         <xsl:value-of select="marc:subfield[@code='u']"/>
151       </dc:identifier>
152     </xsl:for-each>
153     <xsl:for-each select="marc:datafield[@tag=010]">
154       <dc:identifier>
155         <xsl:text>URN:ISBN:</xsl:text>
156         <xsl:value-of select="marc:subfield[@code='a']"/>
157       </dc:identifier>
158     </xsl:for-each>
159     <xsl:for-each select="marc:datafield[@tag=011]">
160       <dc:identifier>
161         <xsl:text>URN:ISSN:</xsl:text>
162         <xsl:value-of select="marc:subfield[@code='a']"/>
163       </dc:identifier>
164     </xsl:for-each>
165     <xsl:for-each select="marc:controlfield[@tag=001]">
166       <dc:identifier>
167         <xsl:value-of select="."/>
168       </dc:identifier>
169     </xsl:for-each>
170     <xsl:for-each select="marc:datafield[@tag=995]">
171        <dc:identifier>
172       <xsl:text>LOC:</xsl:text>
173       <xsl:for-each select="marc:subfield[@code='k']">
174         <xsl:text>:</xsl:text>
175         <xsl:value-of select="."/>
176       </xsl:for-each>
177       </dc:identifier>
178     </xsl:for-each>
179   </xsl:template>
180 </xsl:stylesheet>