1 <?xml version="1.0" encoding="UTF-8"?>
4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5 xmlns:pz="http://www.indexdata.com/pazpar2/1.0"
6 xmlns:marc="http://www.loc.gov/MARC21/slim">
8 <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
10 <!-- Extract metadata from MARC21/USMARC
11 http://www.loc.gov/marc/bibliographic/ecbdhome.html
13 <xsl:template name="record-hook"/>
15 <xsl:template match="/">
16 <xsl:apply-templates/>
19 <xsl:template match="marc:record">
20 <xsl:variable name="title_medium" select="marc:datafield[@tag='245']/marc:subfield[@code='h']"/>
21 <xsl:variable name="journal_title" select="marc:datafield[@tag='773']/marc:subfield[@code='t']"/>
22 <xsl:variable name="electronic_location_url" select="marc:datafield[@tag='856']/marc:subfield[@code='u']"/>
23 <xsl:variable name="fulltext_a" select="marc:datafield[@tag='900']/marc:subfield[@code='a']"/>
24 <xsl:variable name="fulltext_b" select="marc:datafield[@tag='900']/marc:subfield[@code='b']"/>
25 <xsl:variable name="medium">
27 <xsl:when test="$title_medium">
28 <xsl:value-of select="translate($title_medium, ' []/', '')"/>
30 <xsl:when test="$fulltext_a">
31 <xsl:text>electronic resource</xsl:text>
33 <xsl:when test="$fulltext_b">
34 <xsl:text>electronic resource</xsl:text>
36 <xsl:when test="$journal_title">
37 <xsl:text>article</xsl:text>
40 <xsl:text>book</xsl:text>
45 <xsl:variable name="has_fulltext">
47 <xsl:when test="marc:datafield[@tag='856']/marc:subfield[@code='q']">
48 <xsl:text>yes</xsl:text>
50 <xsl:when test="marc:datafield[@tag='856']/marc:subfield[@code='i']='TEXT*'">
51 <xsl:text>yes</xsl:text>
54 <xsl:text>no</xsl:text>
60 <xsl:for-each select="marc:controlfield[@tag='001']">
61 <pz:metadata type="id">
62 <xsl:value-of select="."/>
66 <xsl:for-each select="marc:datafield[@tag='010']">
67 <pz:metadata type="lccn">
68 <xsl:value-of select="marc:subfield[@code='a']"/>
72 <xsl:for-each select="marc:datafield[@tag='020']">
73 <pz:metadata type="isbn">
74 <xsl:value-of select="marc:subfield[@code='a']"/>
78 <xsl:for-each select="marc:datafield[@tag='022']">
79 <pz:metadata type="issn">
80 <xsl:value-of select="marc:subfield[@code='a']"/>
84 <xsl:for-each select="marc:datafield[@tag='027']">
85 <pz:metadata type="tech-rep-nr">
86 <xsl:value-of select="marc:subfield[@code='a']"/>
90 <xsl:for-each select="marc:datafield[@tag='035']">
91 <pz:metadata type="system-control-nr">
93 <xsl:when test="marc:subfield[@code='a']">
94 <xsl:value-of select="marc:subfield[@code='a']"/>
97 <xsl:value-of select="marc:subfield[@code='b']"/>
103 <xsl:for-each select="marc:datafield[@tag='100']">
104 <pz:metadata type="author">
105 <xsl:value-of select="marc:subfield[@code='a']"/>
107 <pz:metadata type="author-title">
108 <xsl:value-of select="marc:subfield[@code='c']"/>
110 <pz:metadata type="author-date">
111 <xsl:value-of select="marc:subfield[@code='d']"/>
115 <xsl:for-each select="marc:datafield[@tag='110']">
116 <pz:metadata type="corporate-name">
117 <xsl:value-of select="marc:subfield[@code='a']"/>
119 <pz:metadata type="corporate-location">
120 <xsl:value-of select="marc:subfield[@code='c']"/>
122 <pz:metadata type="corporate-date">
123 <xsl:value-of select="marc:subfield[@code='d']"/>
127 <xsl:for-each select="marc:datafield[@tag='111']">
128 <pz:metadata type="meeting-name">
129 <xsl:value-of select="marc:subfield[@code='a']"/>
131 <pz:metadata type="meeting-location">
132 <xsl:value-of select="marc:subfield[@code='c']"/>
134 <pz:metadata type="meeting-date">
135 <xsl:value-of select="marc:subfield[@code='d']"/>
139 <xsl:for-each select="marc:datafield[@tag='260']">
140 <pz:metadata type="date">
141 <xsl:value-of select="marc:subfield[@code='c']"/>
145 <xsl:for-each select="marc:datafield[@tag='245']">
146 <pz:metadata type="title">
147 <xsl:value-of select="marc:subfield[@code='a']"/>
149 <pz:metadata type="title-remainder">
150 <xsl:value-of select="marc:subfield[@code='b']"/>
152 <pz:metadata type="title-responsibility">
153 <xsl:value-of select="marc:subfield[@code='c']"/>
155 <pz:metadata type="title-dates">
156 <xsl:value-of select="marc:subfield[@code='f']"/>
158 <pz:metadata type="title-medium">
159 <xsl:value-of select="marc:subfield[@code='h']"/>
161 <pz:metadata type="title-number-section">
162 <xsl:value-of select="marc:subfield[@code='n']"/>
166 <xsl:for-each select="marc:datafield[@tag='250']">
167 <pz:metadata type="edition">
168 <xsl:value-of select="marc:subfield[@code='a']"/>
172 <xsl:for-each select="marc:datafield[@tag='260']">
173 <pz:metadata type="publication-place">
174 <xsl:value-of select="marc:subfield[@code='a']"/>
176 <pz:metadata type="publication-name">
177 <xsl:value-of select="marc:subfield[@code='b']"/>
179 <pz:metadata type="publication-date">
180 <xsl:value-of select="marc:subfield[@code='c']"/>
184 <xsl:for-each select="marc:datafield[@tag='300']">
185 <pz:metadata type="physical-extent">
186 <xsl:value-of select="marc:subfield[@code='a']"/>
188 <pz:metadata type="physical-format">
189 <xsl:value-of select="marc:subfield[@code='b']"/>
191 <pz:metadata type="physical-dimensions">
192 <xsl:value-of select="marc:subfield[@code='c']"/>
194 <pz:metadata type="physical-accomp">
195 <xsl:value-of select="marc:subfield[@code='e']"/>
197 <pz:metadata type="physical-unittype">
198 <xsl:value-of select="marc:subfield[@code='f']"/>
200 <pz:metadata type="physical-unitsize">
201 <xsl:value-of select="marc:subfield[@code='g']"/>
203 <pz:metadata type="physical-specified">
204 <xsl:value-of select="marc:subfield[@code='3']"/>
208 <xsl:for-each select="marc:datafield[@tag='440']">
209 <pz:metadata type="series-title">
210 <xsl:value-of select="marc:subfield[@code='a']"/>
214 <xsl:for-each select="marc:datafield[@tag = '500' or @tag = '505' or
215 @tag = '518' or @tag = '520' or @tag = '522']">
216 <pz:metadata type="description">
217 <xsl:value-of select="*/text()"/>
221 <xsl:for-each select="marc:datafield[@tag='600' or @tag='610' or @tag='611' or @tag='630' or @tag='648' or @tag='650' or @tag='651' or @tag='653' or @tag='654' or @tag='655' or @tag='656' or @tag='657' or @tag='658' or @tag='662' or @tag='69X']">
222 <pz:metadata type="subject">
223 <xsl:value-of select="marc:subfield[@code='a']"/>
225 <pz:metadata type="subject-long">
226 <xsl:for-each select="marc:subfield">
227 <xsl:if test="position() > 1">
228 <xsl:text>, </xsl:text>
230 <xsl:value-of select="."/>
235 <xsl:for-each select="marc:datafield[@tag='856']">
236 <pz:metadata type="electronic-url">
237 <xsl:value-of select="marc:subfield[@code='u']"/>
239 <pz:metadata type="electronic-text">
240 <xsl:value-of select="marc:subfield[@code='y' or @code='3']"/>
242 <pz:metadata type="electronic-note">
243 <xsl:value-of select="marc:subfield[@code='z']"/>
245 <pz:metadata type="electronic-format-instruction">
246 <xsl:value-of select="marc:subfield[@code='i']"/>
248 <pz:metadata type="electronic-format-type">
249 <xsl:value-of select="marc:subfield[@code='q']"/>
253 <pz:metadata type="has-fulltext">
254 <xsl:value-of select="$has_fulltext"/>
257 <xsl:for-each select="marc:datafield[@tag='773']">
258 <pz:metadata type="citation">
259 <xsl:for-each select="*">
260 <xsl:value-of select="normalize-space(.)"/>
261 <xsl:text> </xsl:text>
264 <xsl:if test="marc:subfield[@code='t']">
265 <pz:metadata type="journal-title">
266 <xsl:value-of select="marc:subfield[@code='t']"/>
269 <xsl:if test="marc:subfield[@code='g']">
270 <pz:metadata type="journal-subpart">
271 <xsl:value-of select="marc:subfield[@code='g']"/>
276 <xsl:for-each select="marc:datafield[@tag='852']">
277 <xsl:if test="marc:subfield[@code='y']">
278 <pz:metadata type="publicnote">
279 <xsl:value-of select="marc:subfield[@code='y']"/>
282 <xsl:if test="marc:subfield[@code='h']">
283 <pz:metadata type="callnumber">
284 <xsl:value-of select="marc:subfield[@code='h']"/>
289 <pz:metadata type="medium">
290 <xsl:value-of select="$medium"/>
293 <xsl:for-each select="marc:datafield[@tag='900']/marc:subfield[@code='a']">
294 <pz:metadata type="fulltext">
295 <xsl:value-of select="."/>
299 <!-- <xsl:if test="$fulltext_a">
300 <pz:metadata type="fulltext">
301 <xsl:value-of select="$fulltext_a"/>
305 <xsl:for-each select="marc:datafield[@tag='900']/marc:subfield[@code='b']">
306 <pz:metadata type="fulltext">
307 <xsl:value-of select="."/>
311 <!-- <xsl:if test="$fulltext_b">
312 <pz:metadata type="fulltext">
313 <xsl:value-of select="$fulltext_b"/>
317 <xsl:for-each select="marc:datafield[@tag='907' or @tag='901']">
318 <pz:metadata type="iii-id">
319 <xsl:value-of select="marc:subfield[@code='a']"/>
323 <xsl:for-each select="marc:datafield[@tag='926']">
324 <pz:metadata type="holding">
325 <xsl:for-each select="marc:subfield">
326 <xsl:if test="position() > 1">
327 <xsl:text> </xsl:text>
329 <xsl:value-of select="."/>
334 <xsl:for-each select="marc:datafield[@tag='948']">
335 <pz:metadata type="holding">
336 <xsl:for-each select="marc:subfield">
337 <xsl:if test="position() > 1">
338 <xsl:text> </xsl:text>
340 <xsl:value-of select="."/>
345 <xsl:for-each select="marc:datafield[@tag='991']">
346 <pz:metadata type="holding">
347 <xsl:for-each select="marc:subfield">
348 <xsl:if test="position() > 1">
349 <xsl:text> </xsl:text>
351 <xsl:value-of select="."/>
356 <!-- passthrough id data -->
357 <xsl:for-each select="pz:metadata">
358 <xsl:copy-of select="."/>
361 <!-- other stylesheets importing this might want to define this -->
362 <xsl:call-template name="record-hook"/>
367 <xsl:template match="text()"/>