Bug 18720: Use exception instead of die in GetBasketAsCsv
[koha.git] / etc / pazpar2 / marc21.xsl
blobf47642cc0a47aa6c0d5830ee66cb48cf4e9d81c0
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- $Id: marc21.xsl,v 1.22 2007-10-04 12:01:15 adam Exp $ -->
3 <xsl:stylesheet
4 version="1.0"
5 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6 xmlns:pz="http://www.indexdata.com/pazpar2/1.0"
7 xmlns:marc="http://www.loc.gov/MARC21/slim">
10 <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
12 <!-- Extract metadata from MARC21/USMARC
13 http://www.loc.gov/marc/bibliographic/ecbdhome.html
14 -->
15 <xsl:include href="pz2-ourl-marc21.xsl" />
17 <xsl:template match="/marc:record">
18 <xsl:variable name="title_medium" select="marc:datafield[@tag='245']/marc:subfield[@code='h']"/>
19 <xsl:variable name="journal_title" select="marc:datafield[@tag='773']/marc:subfield[@code='t']"/>
20 <xsl:variable name="electronic_location_url" select="marc:datafield[@tag='856']/marc:subfield[@code='u']"/>
21 <xsl:variable name="fulltext_a" select="marc:datafield[@tag='900']/marc:subfield[@code='a']"/>
22 <xsl:variable name="fulltext_b" select="marc:datafield[@tag='900']/marc:subfield[@code='b']"/>
23 <xsl:variable name="medium">
24 <xsl:choose>
25 <xsl:when test="$title_medium">
26 <xsl:value-of select="substring-after(substring-before($title_medium,']'),'[')"/>
27 </xsl:when>
28 <xsl:when test="$fulltext_a">
29 <xsl:text>electronic resource</xsl:text>
30 </xsl:when>
31 <xsl:when test="$fulltext_b">
32 <xsl:text>electronic resource</xsl:text>
33 </xsl:when>
34 <xsl:when test="$electronic_location_url">
35 <xsl:text>electronic resource</xsl:text>
36 </xsl:when>
37 <xsl:when test="$journal_title">
38 <xsl:text>article</xsl:text>
39 </xsl:when>
40 <xsl:otherwise>
41 <xsl:text>book</xsl:text>
42 </xsl:otherwise>
43 </xsl:choose>
44 </xsl:variable>
46 <xsl:variable name="mergekey">
47 <xsl:text>title </xsl:text>
48 <xsl:choose>
49 <xsl:when test="marc:datafield[@tag='240']">
50 <xsl:value-of select="marc:datafield[@tag='240']/marc:subfield[@code='a']"/>
51 </xsl:when>
52 <xsl:otherwise>
53 <xsl:value-of select="marc:datafield[@tag='245']/marc:subfield[@code='a']"/>
54 </xsl:otherwise>
55 </xsl:choose>
56 <xsl:text> author </xsl:text>
57 <xsl:value-of select="marc:datafield[@tag='100']/marc:subfield[@code='a']"/>
58 <!--
59 <xsl:text> medium </xsl:text>
60 <xsl:value-of select="$medium"/>
61 -->
62 </xsl:variable>
64 <pz:record>
65 <xsl:attribute name="mergekey">
66 <xsl:value-of select="$mergekey"/>
67 </xsl:attribute>
70 <xsl:for-each select="marc:controlfield[@tag='001']">
71 <pz:metadata type="id">
72 <xsl:value-of select="."/>
73 </pz:metadata>
74 </xsl:for-each>
76 <xsl:for-each select="marc:datafield[@tag='010']">
77 <pz:metadata type="lccn">
78 <xsl:value-of select="marc:subfield[@code='a']"/>
79 </pz:metadata>
80 </xsl:for-each>
82 <xsl:for-each select="marc:datafield[@tag='999']">
83 <pz:metadata type="kohaid">
84 <xsl:value-of select="marc:subfield[@code='c']"/>
85 </pz:metadata>
86 </xsl:for-each>
89 <xsl:for-each select="marc:datafield[@tag='020']">
90 <pz:metadata type="isbn">
91 <xsl:value-of select="marc:subfield[@code='a']"/>
92 </pz:metadata>
93 </xsl:for-each>
95 <xsl:for-each select="marc:datafield[@tag='022']">
96 <pz:metadata type="issn">
97 <xsl:value-of select="marc:subfield[@code='a']"/>
98 </pz:metadata>
99 </xsl:for-each>
101 <xsl:for-each select="marc:datafield[@tag='027']">
102 <pz:metadata type="tech-rep-nr">
103 <xsl:value-of select="marc:subfield[@code='a']"/>
104 </pz:metadata>
105 </xsl:for-each>
107 <xsl:for-each select="marc:datafield[@tag='100']">
108 <pz:metadata type="author">
109 <xsl:value-of select="marc:subfield[@code='a']"/>
110 </pz:metadata>
111 <pz:metadata type="author-title">
112 <xsl:value-of select="marc:subfield[@code='c']"/>
113 </pz:metadata>
114 <pz:metadata type="author-date">
115 <xsl:value-of select="marc:subfield[@code='d']"/>
116 </pz:metadata>
117 </xsl:for-each>
119 <xsl:for-each select="marc:datafield[@tag='110']">
120 <pz:metadata type="corporate-name">
121 <xsl:value-of select="marc:subfield[@code='a']"/>
122 </pz:metadata>
123 <pz:metadata type="corporate-location">
124 <xsl:value-of select="marc:subfield[@code='c']"/>
125 </pz:metadata>
126 <pz:metadata type="corporate-date">
127 <xsl:value-of select="marc:subfield[@code='d']"/>
128 </pz:metadata>
129 </xsl:for-each>
131 <xsl:for-each select="marc:datafield[@tag='111']">
132 <pz:metadata type="meeting-name">
133 <xsl:value-of select="marc:subfield[@code='a']"/>
134 </pz:metadata>
135 <pz:metadata type="meeting-location">
136 <xsl:value-of select="marc:subfield[@code='c']"/>
137 </pz:metadata>
138 <pz:metadata type="meeting-date">
139 <xsl:value-of select="marc:subfield[@code='d']"/>
140 </pz:metadata>
141 </xsl:for-each>
143 <xsl:for-each select="marc:datafield[@tag='260']">
144 <pz:metadata type="date">
145 <xsl:value-of select="marc:subfield[@code='c']"/>
146 </pz:metadata>
147 </xsl:for-each>
149 <xsl:for-each select="marc:datafield[@tag='245']">
150 <pz:metadata type="title">
151 <xsl:value-of select="marc:subfield[@code='a']"/>
152 </pz:metadata>
153 <pz:metadata type="title-remainder">
154 <xsl:value-of select="marc:subfield[@code='b']"/>
155 </pz:metadata>
156 <pz:metadata type="title-responsibility">
157 <xsl:value-of select="marc:subfield[@code='c']"/>
158 </pz:metadata>
159 <pz:metadata type="title-dates">
160 <xsl:value-of select="marc:subfield[@code='f']"/>
161 </pz:metadata>
162 <pz:metadata type="title-medium">
163 <xsl:value-of select="marc:subfield[@code='h']"/>
164 </pz:metadata>
165 <pz:metadata type="title-number-section">
166 <xsl:value-of select="marc:subfield[@code='n']"/>
167 </pz:metadata>
168 </xsl:for-each>
170 <xsl:for-each select="marc:datafield[@tag='250']">
171 <pz:metadata type="edition">
172 <xsl:value-of select="marc:subfield[@code='a']"/>
173 </pz:metadata>
174 </xsl:for-each>
176 <xsl:for-each select="marc:datafield[@tag='260']">
177 <pz:metadata type="publication-place">
178 <xsl:value-of select="marc:subfield[@code='a']"/>
179 </pz:metadata>
180 <pz:metadata type="publication-name">
181 <xsl:value-of select="marc:subfield[@code='b']"/>
182 </pz:metadata>
183 <pz:metadata type="publication-date">
184 <xsl:value-of select="marc:subfield[@code='c']"/>
185 </pz:metadata>
186 </xsl:for-each>
188 <xsl:for-each select="marc:datafield[@tag='300']">
189 <pz:metadata type="physical-extent">
190 <xsl:value-of select="marc:subfield[@code='a']"/>
191 </pz:metadata>
192 <pz:metadata type="physical-format">
193 <xsl:value-of select="marc:subfield[@code='b']"/>
194 </pz:metadata>
195 <pz:metadata type="physical-dimensions">
196 <xsl:value-of select="marc:subfield[@code='c']"/>
197 </pz:metadata>
198 <pz:metadata type="physical-accomp">
199 <xsl:value-of select="marc:subfield[@code='e']"/>
200 </pz:metadata>
201 <pz:metadata type="physical-unittype">
202 <xsl:value-of select="marc:subfield[@code='f']"/>
203 </pz:metadata>
204 <pz:metadata type="physical-unitsize">
205 <xsl:value-of select="marc:subfield[@code='g']"/>
206 </pz:metadata>
207 <pz:metadata type="physical-specified">
208 <xsl:value-of select="marc:subfield[@code='3']"/>
209 </pz:metadata>
210 </xsl:for-each>
212 <xsl:for-each select="marc:datafield[@tag='440']">
213 <pz:metadata type="series-title">
214 <xsl:value-of select="marc:subfield[@code='a']"/>
215 </pz:metadata>
216 </xsl:for-each>
218 <xsl:for-each select="marc:datafield[@tag &gt;= 500 and @tag &lt;= 599]
219 [@tag != '506' and @tag != '530' and
220 @tag != '540' and @tag != '546'
221 and @tag != '522']">
222 <pz:metadata type="description">
223 <xsl:value-of select="*/text()"/>
224 </pz:metadata>
225 </xsl:for-each>
227 <xsl:for-each select="marc:datafield[@tag='650' or @tag='653']">
228 <pz:metadata type="subject">
229 <xsl:value-of select="marc:subfield[@code='a']"/>
230 </pz:metadata>
231 <pz:metadata type="subject-long">
232 <xsl:for-each select="marc:subfield">
233 <xsl:if test="position() > 1">
234 <xsl:text>, </xsl:text>
235 </xsl:if>
236 <xsl:value-of select="."/>
237 </xsl:for-each>
238 </pz:metadata>
239 </xsl:for-each>
241 <xsl:for-each select="marc:datafield[@tag='856']">
242 <pz:metadata type="electronic-url">
243 <xsl:value-of select="marc:subfield[@code='u']"/>
244 </pz:metadata>
245 <pz:metadata type="electronic-text">
246 <xsl:value-of select="marc:subfield[@code='y']"/>
247 </pz:metadata>
248 <pz:metadata type="electronic-note">
249 <xsl:value-of select="marc:subfield[@code='z']"/>
250 </pz:metadata>
251 </xsl:for-each>
253 <xsl:for-each select="marc:datafield[@tag='773']">
254 <pz:metadata type="citation">
255 <xsl:for-each select="*">
256 <xsl:value-of select="normalize-space(.)"/>
257 <xsl:text> </xsl:text>
258 </xsl:for-each>
259 </pz:metadata>
260 </xsl:for-each>
262 <pz:metadata type="medium">
263 <xsl:value-of select="$medium"/>
264 </pz:metadata>
266 <xsl:if test="$fulltext_a">
267 <pz:metadata type="fulltext">
268 <xsl:value-of select="$fulltext_a"/>
269 </pz:metadata>
270 </xsl:if>
272 <xsl:if test="$fulltext_b">
273 <pz:metadata type="fulltext">
274 <xsl:value-of select="$fulltext_b"/>
275 </pz:metadata>
276 </xsl:if>
278 <xsl:if test="$open_url_resolver">
279 <pz:metadata type="open-url">
280 <xsl:call-template name="insert-md-openurl" />
281 </pz:metadata>
282 </xsl:if>
284 </pz:record>
286 </xsl:template>
288 </xsl:stylesheet>