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="substring-after(substring-before($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>
47 <pz:metadata type="medium">
48 <xsl:value-of select="$medium"/>
51 <xsl:apply-templates/>
53 <!-- other stylesheets importing this might want to define this -->
54 <xsl:call-template name="record-hook"/>
59 <xsl:template match="marc:controlfield[@tag='001']">
60 <pz:metadata type="id">
61 <xsl:value-of select="."/>
65 <xsl:template match="marc:datafield[@tag='010']">
66 <pz:metadata type="lccn">
67 <xsl:value-of select="marc:subfield[@code='a']"/>
71 <xsl:template match="marc:datafield[@tag='020']">
72 <pz:metadata type="isbn">
73 <xsl:value-of select="marc:subfield[@code='a']"/>
77 <!-- does ANYONE need this?
78 <xsl:template match="marc:datafield[@tag='027']">
79 <pz:metadata type="tech-rep-nr">
80 <xsl:value-of select="marc:subfield[@code='a']"/>
85 <xsl:template match="marc:datafield[@tag='035']">
86 <pz:metadata type="system-control-nr">
87 <xsl:value-of select="marc:subfield[@code='a']"/>
91 <xsl:template match="marc:datafield[@tag='100' or @tag='700']">
92 <pz:metadata type="author">
93 <xsl:value-of select="marc:subfield[@code='a']"/>
95 <pz:metadata type="author-title">
96 <xsl:value-of select="marc:subfield[@code='c']"/>
98 <pz:metadata type="author-date">
99 <xsl:value-of select="marc:subfield[@code='d']"/>
103 <xsl:template match="marc:datafield[@tag='110']">
104 <pz:metadata type="corporate-name">
105 <xsl:value-of select="marc:subfield[@code='a']"/>
107 <pz:metadata type="corporate-location">
108 <xsl:value-of select="marc:subfield[@code='c']"/>
110 <pz:metadata type="corporate-date">
111 <xsl:value-of select="marc:subfield[@code='d']"/>
115 <xsl:template match="marc:datafield[@tag='111']">
116 <pz:metadata type="meeting-name">
117 <xsl:value-of select="marc:subfield[@code='a']"/>
119 <pz:metadata type="meeting-location">
120 <xsl:value-of select="marc:subfield[@code='c']"/>
122 <pz:metadata type="meeting-date">
123 <xsl:value-of select="marc:subfield[@code='d']"/>
127 <xsl:template match="marc:datafield[@tag='245']">
128 <pz:metadata type="title">
129 <xsl:value-of select="marc:subfield[@code='a']"/>
131 <pz:metadata type="title-remainder">
132 <xsl:value-of select="marc:subfield[@code='b']"/>
134 <pz:metadata type="title-responsibility">
135 <xsl:value-of select="marc:subfield[@code='c']"/>
137 <pz:metadata type="title-dates">
138 <xsl:value-of select="marc:subfield[@code='f']"/>
140 <pz:metadata type="title-medium">
141 <xsl:value-of select="marc:subfield[@code='h']"/>
143 <pz:metadata type="title-number-section">
144 <xsl:value-of select="marc:subfield[@code='n']"/>
148 <xsl:template match="marc:datafield[@tag='250']">
149 <pz:metadata type="edition">
150 <xsl:value-of select="marc:subfield[@code='a']"/>
154 <xsl:template match="marc:datafield[@tag='260']">
155 <pz:metadata type="publication-place">
156 <xsl:value-of select="marc:subfield[@code='a']"/>
158 <pz:metadata type="publication-name">
159 <xsl:value-of select="marc:subfield[@code='b']"/>
161 <pz:metadata type="publication-date">
162 <xsl:value-of select="marc:subfield[@code='c']"/>
164 <pz:metadata type="date">
165 <xsl:value-of select="marc:subfield[@code='c']"/>
169 <xsl:template match="marc:datafield[@tag='300']">
170 <pz:metadata type="physical-extent">
171 <xsl:value-of select="marc:subfield[@code='a']"/>
173 <pz:metadata type="physical-format">
174 <xsl:value-of select="marc:subfield[@code='b']"/>
176 <pz:metadata type="physical-dimensions">
177 <xsl:value-of select="marc:subfield[@code='c']"/>
179 <pz:metadata type="physical-accomp">
180 <xsl:value-of select="marc:subfield[@code='e']"/>
182 <pz:metadata type="physical-unittype">
183 <xsl:value-of select="marc:subfield[@code='f']"/>
185 <pz:metadata type="physical-unitsize">
186 <xsl:value-of select="marc:subfield[@code='g']"/>
188 <pz:metadata type="physical-specified">
189 <xsl:value-of select="marc:subfield[@code='3']"/>
193 <xsl:template match="marc:datafield[@tag='440']">
194 <pz:metadata type="series-title">
195 <xsl:value-of select="marc:subfield[@code='a']"/>
199 <xsl:template match="marc:datafield[@tag = '500' or @tag = '505' or
200 @tag = '518' or @tag = '520' or @tag = '522']">
201 <pz:metadata type="description">
202 <xsl:value-of select="*/text()"/>
206 <xsl:template match="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']">
207 <pz:metadata type="subject">
208 <xsl:value-of select="marc:subfield[@code='a']"/>
210 <pz:metadata type="subject-long">
211 <xsl:for-each select="marc:subfield">
212 <xsl:if test="position() > 1">
213 <xsl:text>, </xsl:text>
215 <xsl:value-of select="."/>
220 <xsl:template match="marc:datafield[@tag='856']">
221 <pz:metadata type="electronic-url">
222 <xsl:value-of select="marc:subfield[@code='u']"/>
224 <pz:metadata type="electronic-text">
225 <xsl:value-of select="marc:subfield[@code='y' or @code='3']"/>
227 <pz:metadata type="electronic-note">
228 <xsl:value-of select="marc:subfield[@code='z']"/>
232 <xsl:template match="marc:datafield[@tag='773']">
233 <pz:metadata type="citation">
234 <xsl:for-each select="*">
235 <xsl:value-of select="normalize-space(.)"/>
236 <xsl:text> </xsl:text>
241 <xsl:template match="marc:datafield[@tag='852']">
242 <xsl:if test="marc:subfield[@code='y']">
243 <pz:metadata type="publicnote">
244 <xsl:value-of select="marc:subfield[@code='y']"/>
247 <xsl:if test="marc:subfield[@code='h']">
248 <pz:metadata type="callnumber">
249 <xsl:value-of select="marc:subfield[@code='h']"/>
254 <xsl:template match="marc:datafield[@tag='900']/marc:subfield[@code='a']">
255 <pz:metadata type="fulltext">
256 <xsl:value-of select="."/>
260 <xsl:template match="marc:datafield[@tag='907' or @tag='901']">
261 <pz:metadata type="iii-id">
262 <xsl:value-of select="marc:subfield[@code='a']"/>
266 <xsl:template match="marc:datafield[@tag='926']">
267 <pz:metadata type="holding">
268 <xsl:for-each select="marc:subfield">
269 <xsl:if test="position() > 1">
270 <xsl:text> </xsl:text>
272 <xsl:value-of select="."/>
277 <xsl:template match="marc:datafield[@tag='948']">
278 <pz:metadata type="holding">
279 <xsl:for-each select="marc:subfield">
280 <xsl:if test="position() > 1">
281 <xsl:text> </xsl:text>
283 <xsl:value-of select="."/>
288 <xsl:template match="marc:datafield[@tag='991']">
289 <pz:metadata type="holding">
290 <xsl:for-each select="marc:subfield">
291 <xsl:if test="position() > 1">
292 <xsl:text> </xsl:text>
294 <xsl:value-of select="."/>
299 <xsl:template match="pz:metadata">
300 <xsl:copy-of select="."/>
303 <!-- other stylesheets importing this might want to define this -->
304 <xsl:template match="text()"/>