Fix check for yaz-config
[pazpar2-moved-to-github.git] / test / tmarc.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0"
3   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pz="http://www.indexdata.com/pazpar2/1.0"
4   xmlns:tmarc="http://www.indexdata.com/turbomarc">
5
6   <xsl:output indent="yes" method="xml" version="1.0"
7     encoding="UTF-8" />
8
9   <!-- Extract metadata from MARC21/USMARC from streamlined marcxml format 
10     http://www.loc.gov/marc/bibliographic/ecbdhome.html -->
11   <xsl:template name="record-hook" />
12
13
14   <xsl:template match="/">
15       <xsl:apply-templates />
16   </xsl:template>
17
18   <xsl:template match="tmarc:collection">
19     <collection>
20       <xsl:apply-templates />
21     </collection>
22   </xsl:template>
23
24   <xsl:template match="tmarc:r">
25     <xsl:variable name="title_medium" select="tmarc:d245/tmarc:sh" />
26     <xsl:variable name="journal_title" select="tmarc:d773/tmarc:st" />
27     <xsl:variable name="electronic_location_url" select="tmarc:d856/tmarc:su" />
28     <xsl:variable name="fulltext_a" select="tmarc:d900/tmarc:sa" />
29     <xsl:variable name="fulltext_b" select="tmarc:d900/tmarc:sb" />
30     <!-- Does not always hit the right substring. The field is not always fixed-width? -->
31     <xsl:variable name="control_lang" select="substring(tmarc:c008, 36, 3)" />
32     <xsl:variable name="contains110" select="tmarc:d110" />
33     <xsl:variable name="hasAuthorFields" select="tmarc:d100 or tmarc:d111" />
34     <xsl:variable name="typeofrec" select="substring(tmarc:l, 7, 1)"/>
35     <xsl:variable name="typeofvm" select="substring(tmarc:c008, 34, 1)"/>
36     <xsl:variable name="biblevel" select="substring(tmarc:l, 8, 1)"/>
37     <xsl:variable name="physdes" select="substring(tmarc:c007, 1, 1)"/>
38     <xsl:variable name="form1" select="substring(tmarc:c008, 24, 1)"/>
39     <xsl:variable name="form2" select="substring(tmarc:c008, 30, 1)"/>
40     <xsl:variable name="oclca" select="substring(tmarc:c007, 1, 1)"/>
41     <xsl:variable name="oclcb" select="substring(tmarc:c007, 2, 1)"/>
42     <xsl:variable name="oclcd" select="substring(tmarc:c007, 4, 1)"/>
43     <xsl:variable name="oclce" select="substring(tmarc:c007, 5, 1)"/>
44     <xsl:variable name="typeofserial" select="substring(tmarc:c008, 22, 1)"/>
45
46     <xsl:variable name="electronic">
47       <xsl:choose>
48         <xsl:when test="$form1='s' or $form1='q' or $form1='o' or
49            $form2='s' or $form2='q' or $form2='o'">
50            <xsl:text>yes</xsl:text>
51         </xsl:when>
52         <xsl:otherwise/>
53       </xsl:choose>
54     </xsl:variable>
55
56     <xsl:variable name="medium">
57       <xsl:choose>
58         <xsl:when test="($typeofrec='a' or $typeofrec='t') and $biblevel='m'">book</xsl:when>
59         <xsl:when test="$typeofrec='j' or $typeofrec='i'">
60           <xsl:text>recording</xsl:text>
61           <xsl:choose>
62             <xsl:when test="$oclcb='d' and $oclcd='f'">-cd</xsl:when>
63             <xsl:when test="$oclcb='s'">-cassette</xsl:when>
64             <xsl:when test="$oclcb='d' and $oclcd='a' or $oclcd='b' or
65               $oclcd='c' or $oclcd='d' or $oclcd='e'">-vinyl</xsl:when>
66           </xsl:choose>
67         </xsl:when>
68         <xsl:when test="$typeofrec='g'">
69           <xsl:choose>
70             <xsl:when test="$typeofvm='m' or $typeofvm='v'">
71               <xsl:text>video</xsl:text>
72               <xsl:choose>
73                 <xsl:when test="$oclca='v' and $oclcb='d' and $oclce='v'">-dvd</xsl:when>
74                 <xsl:when test="$oclca='v' and $oclcb='d' and $oclce='s'">-blu-ray</xsl:when>
75                 <xsl:when test="$oclca='v' and $oclcb='f' and $oclce='b'">-vhs</xsl:when>
76               </xsl:choose>
77             </xsl:when>
78             <xsl:otherwise>audio-visual</xsl:otherwise>
79           </xsl:choose>
80         </xsl:when>
81         <xsl:when test="$typeofrec='a' and $biblevel='s'">
82           <xsl:choose>
83             <xsl:when test="$typeofserial='n'">newspaper</xsl:when>
84             <xsl:otherwise>journal</xsl:otherwise>
85           </xsl:choose>
86         </xsl:when>
87         <xsl:when test="$typeofrec='e' or $typeofrec='f'">map</xsl:when>
88         <xsl:when test="$typeofrec='c' or $typeofrec='d'">music-score</xsl:when>
89         <xsl:when test="$form1='a' or $form1='b' or $form1='c'">microform</xsl:when>
90         <xsl:when test="$typeofrec='t'">thesis</xsl:when>
91         <!-- <xsl:when test="$journal_title">article</xsl:when> -->
92         <xsl:when test="$typeofrec='a' or $typeofrec='i' and
93             ($typeofserial='d' or $typeofserial='w')">web</xsl:when>
94         <xsl:when test="$typeofrec='a' and $biblevel='b'">article</xsl:when>
95         <xsl:when test="$typeofrec='m'">electronic</xsl:when>
96         <xsl:when test="$title_medium">
97           <xsl:value-of select="translate($title_medium, ' []/:', '')" />
98         </xsl:when>
99         <xsl:otherwise>
100           <xsl:text>other</xsl:text>
101         </xsl:otherwise>
102       </xsl:choose>
103     </xsl:variable>
104
105     <pz:record>
106 <!--
107       <xsl:attribute name="mergekey">
108     <xsl:text>title </xsl:text>
109   <xsl:value-of select="tmarc:d245/tmarc:sa" />
110   <xsl:text> author </xsl:text>
111   <xsl:value-of select="tmarc:d100/tmarc:sa" />
112   <xsl:text> medium </xsl:text>
113   <xsl:value-of select="$medium" />
114     </xsl:attribute>
115   -->
116
117       <xsl:for-each select="tmarc:c001">
118         <pz:metadata type="id">
119           <xsl:value-of select="." />
120         </pz:metadata>
121       </xsl:for-each>
122
123       <xsl:for-each select="tmarc:d010">
124         <pz:metadata type="lccn">
125           <xsl:value-of select="tmarc:sa" />
126         </pz:metadata>
127       </xsl:for-each>
128
129       <xsl:for-each select="tmarc:d020">
130         <pz:metadata type="isbn">
131           <xsl:value-of select="tmarc:sa" />
132         </pz:metadata>
133       </xsl:for-each>
134
135       <xsl:for-each select="tmarc:d022">
136         <pz:metadata type="issn">
137           <xsl:value-of select="tmarc:sa" />
138         </pz:metadata>
139       </xsl:for-each>
140
141       <xsl:for-each select="tmarc:d027">
142         <pz:metadata type="tech-rep-nr">
143           <xsl:value-of select="tmarc:sa" />
144         </pz:metadata>
145       </xsl:for-each>
146
147       <xsl:for-each select="tmarc:d035"> 
148         <pz:metadata type="system-control-nr">
149           <xsl:choose>
150             <xsl:when test="tmarc:sa">
151               <xsl:value-of select="tmarc:sa"/>
152             </xsl:when>
153             <xsl:otherwise>
154               <xsl:value-of select="tmarc:sb"/>
155             </xsl:otherwise>
156           </xsl:choose>
157         </pz:metadata>
158       </xsl:for-each>
159
160       <xsl:for-each select="tmarc:d100">
161         <pz:metadata type="author">
162           <xsl:value-of select="tmarc:sa" />
163         </pz:metadata>
164         <pz:metadata type="author-title">
165           <xsl:value-of select="tmarc:sc" />
166         </pz:metadata>
167         <pz:metadata type="author-date">
168           <xsl:value-of select="tmarc:sd" />
169         </pz:metadata>
170       </xsl:for-each>
171
172       <xsl:for-each select="tmarc:d110">
173         <pz:metadata type="corporate-name">
174           <xsl:value-of select="tmarc:sa" />
175         </pz:metadata>
176         <pz:metadata type="corporate-location">
177           <xsl:value-of select="tmarc:sc" />
178         </pz:metadata>
179         <pz:metadata type="corporate-date">
180           <xsl:value-of select="tmarc:sd" />
181         </pz:metadata>
182       </xsl:for-each>
183
184       <xsl:for-each select="tmarc:d111">
185         <pz:metadata type="meeting-name">
186           <xsl:value-of select="tmarc:sa" />
187         </pz:metadata>
188         <pz:metadata type="meeting-location">
189           <xsl:value-of select="tmarc:sc" />
190         </pz:metadata>
191         <pz:metadata type="meeting-date">
192           <xsl:value-of select="tmarc:sd" />
193         </pz:metadata>
194       </xsl:for-each>
195
196       <xsl:for-each select="tmarc:d260">
197         <pz:metadata type="date">
198           <xsl:value-of select="translate(tmarc:sc, 'cp[].', '')" />
199         </pz:metadata>
200       </xsl:for-each>
201
202       <xsl:for-each select="tmarc:d130">
203         <pz:metadata type="title-uniform">
204           <xsl:value-of select="tmarc:sa" />
205         </pz:metadata>
206         <pz:metadata type="title-uniform-media">
207           <xsl:value-of select="tmarc:sm" />
208         </pz:metadata>
209         <pz:metadata type="title-uniform-parts">
210           <xsl:value-of select="tmarc:sn" />
211         </pz:metadata>
212         <pz:metadata type="title-uniform-partname">
213           <xsl:value-of select="tmarc:sp" />
214         </pz:metadata>
215         <pz:metadata type="title-uniform-key">
216           <xsl:value-of select="tmarc:sr" />
217         </pz:metadata>
218       </xsl:for-each>
219
220       <xsl:for-each select="tmarc:d245">
221         <pz:metadata type="title">
222           <xsl:value-of select="tmarc:sa" />
223         </pz:metadata>
224         <pz:metadata type="title-remainder">
225           <xsl:value-of select="tmarc:sb" />
226         </pz:metadata>
227         <pz:metadata type="title-responsibility">
228           <xsl:value-of select="tmarc:sc" />
229         </pz:metadata>
230         <pz:metadata type="title-dates">
231           <xsl:value-of select="tmarc:sf" />
232         </pz:metadata>
233         <pz:metadata type="title-medium">
234           <xsl:value-of select="tmarc:sh" />
235         </pz:metadata>
236         <pz:metadata type="title-number-section">
237           <xsl:value-of select="tmarc:sn" />
238         </pz:metadata>
239         <pz:metadata type="title-complete">
240           <xsl:value-of select="tmarc:sa" />
241           <xsl:if test="tmarc:sb" ><xsl:value-of select="concat(' ', tmarc:sb)" /></xsl:if>
242         </pz:metadata>
243       </xsl:for-each>
244
245       <xsl:for-each select="tmarc:d250">
246         <pz:metadata type="edition">
247           <xsl:value-of select="tmarc:sa" />
248         </pz:metadata>
249       </xsl:for-each>
250
251       <xsl:for-each select="tmarc:d260">
252         <pz:metadata type="publication-place">
253           <xsl:value-of select="tmarc:sa" />
254         </pz:metadata>
255         <pz:metadata type="publication-name">
256           <xsl:value-of select="tmarc:sb" />
257         </pz:metadata>
258         <pz:metadata type="publication-date">
259           <xsl:value-of select="tmarc:sc" />
260         </pz:metadata>
261       </xsl:for-each>
262
263       <xsl:for-each select="tmarc:d300">
264         <pz:metadata type="physical-extent">
265           <xsl:value-of select="tmarc:sa" />
266         </pz:metadata>
267         <pz:metadata type="physical-format">
268           <xsl:value-of select="tmarc:sb" />
269         </pz:metadata>
270         <pz:metadata type="physical-dimensions">
271           <xsl:value-of select="tmarc:sc" />
272         </pz:metadata>
273         <pz:metadata type="physical-accomp">
274           <xsl:value-of select="tmarc:se" />
275         </pz:metadata>
276         <pz:metadata type="physical-unittype">
277           <xsl:value-of select="tmarc:sf" />
278         </pz:metadata>
279         <pz:metadata type="physical-unitsize">
280           <xsl:value-of select="tmarc:sg" />
281         </pz:metadata>
282         <pz:metadata type="physical-specified">
283           <xsl:value-of select="tmarc:s3" />
284         </pz:metadata>
285       </xsl:for-each>
286
287       <xsl:for-each select="tmarc:d440">
288         <pz:metadata type="series-title">
289           <xsl:value-of select="tmarc:sa" />
290         </pz:metadata>
291       </xsl:for-each>
292
293       <xsl:for-each select="tmarc:d500">
294         <pz:metadata type="description">
295           <xsl:for-each select="node()">
296             <xsl:value-of select="text()" />
297           </xsl:for-each>
298         </pz:metadata>
299       </xsl:for-each>
300
301       <xsl:for-each select="tmarc:d505">
302         <pz:metadata type="description">
303           <xsl:for-each select="node()">
304             <xsl:value-of select="text()" />
305           </xsl:for-each>
306         </pz:metadata>
307       </xsl:for-each>
308
309       <xsl:for-each select="tmarc:d518">
310         <pz:metadata type="description">
311           <xsl:for-each select="node()">
312             <xsl:value-of select="text()" />
313           </xsl:for-each>
314         </pz:metadata>
315       </xsl:for-each>
316
317       <xsl:for-each select="tmarc:d520">
318         <pz:metadata type="description">
319           <xsl:for-each select="node()">
320             <xsl:value-of select="text()" />
321           </xsl:for-each>
322         </pz:metadata>
323       </xsl:for-each>
324
325       <xsl:for-each select="tmarc:d522">
326         <pz:metadata type="description">
327           <xsl:for-each select="node()">
328             <xsl:value-of select="text()" />
329           </xsl:for-each>
330         </pz:metadata>
331       </xsl:for-each>
332
333       <xsl:for-each select="tmarc:d600">
334         <pz:metadata type="subject">
335           <xsl:value-of select="tmarc:sa" />
336         </pz:metadata>
337         <pz:metadata type="subject-long">
338           <xsl:for-each select="node()/text()">
339             <xsl:if test="position() > 1">
340               <xsl:text>, </xsl:text>
341             </xsl:if>
342             <xsl:value-of select="." />
343           </xsl:for-each>
344         </pz:metadata>
345       </xsl:for-each>
346
347       <xsl:for-each select="tmarc:d610">
348         <pz:metadata type="subject">
349           <xsl:value-of select="tmarc:sa" />
350         </pz:metadata>
351         <pz:metadata type="subject-long">
352           <xsl:for-each select="node()/text()">
353             <xsl:if test="position() > 1">
354               <xsl:text>, </xsl:text>
355             </xsl:if>
356             <xsl:value-of select="." />
357           </xsl:for-each>
358         </pz:metadata>
359       </xsl:for-each>
360
361       <xsl:for-each select="tmarc:d611">
362         <pz:metadata type="subject">
363           <xsl:value-of select="tmarc:sa" />
364         </pz:metadata>
365         <pz:metadata type="subject-long">
366           <xsl:for-each select="node()/text()">
367             <xsl:if test="position() > 1">
368               <xsl:text>, </xsl:text>
369             </xsl:if>
370             <xsl:value-of select="." />
371           </xsl:for-each>
372         </pz:metadata>
373       </xsl:for-each>
374
375       <xsl:for-each select="tmarc:d630">
376         <pz:metadata type="subject">
377           <xsl:value-of select="tmarc:sa" />
378         </pz:metadata>
379         <pz:metadata type="subject-long">
380           <xsl:for-each select="node()/text()">
381             <xsl:if test="position() > 1">
382               <xsl:text>, </xsl:text>
383             </xsl:if>
384             <xsl:value-of select="." />
385           </xsl:for-each>
386         </pz:metadata>
387       </xsl:for-each>
388
389       <xsl:for-each select="tmarc:d648">
390         <pz:metadata type="subject">
391           <xsl:value-of select="tmarc:sa" />
392         </pz:metadata>
393         <pz:metadata type="subject-long">
394           <xsl:for-each select="node()/text()">
395             <xsl:if test="position() > 1">
396               <xsl:text>, </xsl:text>
397             </xsl:if>
398             <xsl:value-of select="." />
399           </xsl:for-each>
400         </pz:metadata>
401       </xsl:for-each>
402
403       <xsl:for-each select="tmarc:d650">
404         <pz:metadata type="subject">
405           <xsl:value-of select="tmarc:sa" />
406         </pz:metadata>
407         <pz:metadata type="subject-long">
408           <xsl:for-each select="node()/text()">
409             <xsl:if test="position() > 1">
410               <xsl:text>, </xsl:text>
411             </xsl:if>
412             <xsl:value-of select="." />
413           </xsl:for-each>
414         </pz:metadata>
415       </xsl:for-each>
416
417       <xsl:for-each select="tmarc:d651">
418         <pz:metadata type="subject">
419           <xsl:value-of select="tmarc:sa" />
420         </pz:metadata>
421         <pz:metadata type="subject-long">
422           <xsl:for-each select="node()/text()">
423             <xsl:if test="position() > 1">
424               <xsl:text>, </xsl:text>
425             </xsl:if>
426             <xsl:value-of select="." />
427           </xsl:for-each>
428         </pz:metadata>
429       </xsl:for-each>
430
431       <xsl:for-each select="tmarc:d653">
432         <pz:metadata type="subject">
433           <xsl:value-of select="tmarc:sa" />
434         </pz:metadata>
435         <pz:metadata type="subject-long">
436           <xsl:for-each select="node()/text()">
437             <xsl:if test="position() > 1">
438               <xsl:text>, </xsl:text>
439             </xsl:if>
440             <xsl:value-of select="." />
441           </xsl:for-each>
442         </pz:metadata>
443       </xsl:for-each>
444
445       <xsl:for-each select="tmarc:d654">
446         <pz:metadata type="subject">
447           <xsl:value-of select="tmarc:sa" />
448         </pz:metadata>
449         <pz:metadata type="subject-long">
450           <xsl:for-each select="node()/text()">
451             <xsl:if test="position() > 1">
452               <xsl:text>, </xsl:text>
453             </xsl:if>
454             <xsl:value-of select="." />
455           </xsl:for-each>
456         </pz:metadata>
457       </xsl:for-each>
458
459       <xsl:for-each select="tmarc:d655">
460         <pz:metadata type="subject">
461           <xsl:value-of select="tmarc:sa" />
462         </pz:metadata>
463         <pz:metadata type="subject-long">
464           <xsl:for-each select="node()/text()">
465             <xsl:if test="position() > 1">
466               <xsl:text>, </xsl:text>
467             </xsl:if>
468             <xsl:value-of select="." />
469           </xsl:for-each>
470         </pz:metadata>
471       </xsl:for-each>
472
473       <xsl:for-each select="tmarc:d656">
474         <pz:metadata type="subject">
475           <xsl:value-of select="tmarc:sa" />
476         </pz:metadata>
477         <pz:metadata type="subject-long">
478           <xsl:for-each select="node()/text()">
479             <xsl:if test="position() > 1">
480               <xsl:text>, </xsl:text>
481             </xsl:if>
482             <xsl:value-of select="." />
483           </xsl:for-each>
484         </pz:metadata>
485       </xsl:for-each>
486
487       <xsl:for-each select="tmarc:d657">
488         <pz:metadata type="subject">
489           <xsl:value-of select="tmarc:sa" />
490         </pz:metadata>
491         <pz:metadata type="subject-long">
492           <xsl:for-each select="node()/text()">
493             <xsl:if test="position() > 1">
494               <xsl:text>, </xsl:text>
495             </xsl:if>
496             <xsl:value-of select="." />
497           </xsl:for-each>
498         </pz:metadata>
499       </xsl:for-each>
500
501       <xsl:for-each select="tmarc:d658">
502         <pz:metadata type="subject">
503           <xsl:value-of select="tmarc:sa" />
504         </pz:metadata>
505         <pz:metadata type="subject-long">
506           <xsl:for-each select="node()/text()">
507             <xsl:if test="position() > 1">
508               <xsl:text>, </xsl:text>
509             </xsl:if>
510             <xsl:value-of select="." />
511           </xsl:for-each>
512         </pz:metadata>
513       </xsl:for-each>
514
515       <xsl:for-each select="tmarc:d662">
516         <pz:metadata type="subject">
517           <xsl:value-of select="tmarc:sa" />
518         </pz:metadata>
519         <pz:metadata type="subject-long">
520           <xsl:for-each select="node()/text()">
521             <xsl:if test="position() > 1">
522               <xsl:text>, </xsl:text>
523             </xsl:if>
524             <xsl:value-of select="." />
525           </xsl:for-each>
526         </pz:metadata>
527       </xsl:for-each>
528
529       <xsl:for-each select="tmarc:d69X">
530         <pz:metadata type="subject">
531           <xsl:value-of select="tmarc:sa" />
532         </pz:metadata>
533         <pz:metadata type="subject-long">
534           <xsl:for-each select="node()/text()">
535             <xsl:if test="position() > 1">
536               <xsl:text>, </xsl:text>
537             </xsl:if>
538             <xsl:value-of select="." />
539           </xsl:for-each>
540         </pz:metadata>
541       </xsl:for-each>
542
543       <!-- or tmarc:d651 or tmarc:d653 or tmarc:d654 or tmarc:d655 or tmarc:d656 
544         or tmarc:d657 or tmarc:d658 or tmarc:d662 or tmarc:d69X"> -->
545
546       <!-- <xsl:for-each select="tmarc:d600" > <pz:metadata type="subject"> 
547         <xsl:value-of select="tmarc:sa"/> </pz:metadata> <pz:metadata type="subject-long"> 
548         <xsl:for-each select="tmarc:sa tmarc:sb tmarc:sc tmarc:sd "> <xsl:if test="position() 
549         > 1"> <xsl:text>, </xsl:text> </xsl:if> <xsl:value-of select="."/> </xsl:for-each> 
550         </pz:metadata> </xsl:for-each> -->
551
552       <xsl:for-each select="tmarc:d856">
553         <pz:metadata type="electronic-url">
554           <xsl:value-of select="tmarc:su" />
555         </pz:metadata>
556         <pz:metadata type="electronic-text">
557           <xsl:if test="tmarc:sy">
558             <xsl:value-of select="tmarc:sy/text()" />
559           </xsl:if>
560           <xsl:if test="tmarc:s3">
561             <xsl:value-of select="tmarc:s3/text()" />
562           </xsl:if>
563         </pz:metadata>
564         <pz:metadata type="electronic-note">
565           <xsl:value-of select="tmarc:sz" />
566         </pz:metadata>
567         <pz:metadata type="electronic-format-instruction">
568           <xsl:value-of select="tmarc:si" />
569         </pz:metadata>
570         <pz:metadata type="electronic-format-type">
571           <xsl:value-of select="tmarc:sq" />
572         </pz:metadata>
573       </xsl:for-each>
574
575       <xsl:for-each select="tmarc:d773">
576         <pz:metadata type="citation">
577           <xsl:for-each select="*">
578             <xsl:value-of select="normalize-space(.)" />
579             <xsl:text> </xsl:text>
580           </xsl:for-each>
581         </pz:metadata>
582       </xsl:for-each>
583
584       <xsl:for-each select="tmarc:d852">
585         <xsl:if test="tmarc:sy">
586           <pz:metadata type="publicnote">
587             <xsl:value-of select="tmarc:sy" />
588           </pz:metadata>
589         </xsl:if>
590         <xsl:if test="tmarc:sh">
591           <pz:metadata type="callnumber">
592             <xsl:value-of select="tmarc:sh" />
593           </pz:metadata>
594         </xsl:if>
595       </xsl:for-each>
596
597       <pz:metadata type="medium">
598         <xsl:value-of select="$medium" />
599         <xsl:if test="string-length($electronic) and $medium != 'electronic'">
600           <xsl:text> (electronic)</xsl:text>
601         </xsl:if>
602       </pz:metadata>
603
604       <xsl:for-each select="tmarc:d900/tmarc:sa">
605         <pz:metadata type="fulltext">
606           <xsl:value-of select="." />
607         </pz:metadata>
608       </xsl:for-each>
609
610       <!-- <xsl:if test="$fulltext_a"> <pz:metadata type="fulltext"> <xsl:value-of 
611         select="$fulltext_a"/> </pz:metadata> </xsl:if> -->
612
613       <xsl:for-each select="tmarc:d900/tmarc:sb">
614         <pz:metadata type="fulltext">
615           <xsl:value-of select="." />
616         </pz:metadata>
617       </xsl:for-each>
618
619       <!-- <xsl:if test="$fulltext_b"> <pz:metadata type="fulltext"> <xsl:value-of 
620         select="$fulltext_b"/> </pz:metadata> </xsl:if> -->
621
622       <xsl:for-each select="tmarc:d907">
623         <!-- or tmarc:d901"> -->
624         <pz:metadata type="iii-id">
625           <xsl:value-of select="tmarc:sa" />
626         </pz:metadata>
627       </xsl:for-each>
628
629       <xsl:for-each select="tmarc:d926">
630         <pz:metadata type="locallocation">
631           <xsl:choose><xsl:when test="tmarc:sa">
632             <xsl:value-of select="tmarc:sa"/>
633           </xsl:when><xsl:otherwise>
634             <xsl:text>PAZPAR2_NULL_VALUE</xsl:text>
635           </xsl:otherwise></xsl:choose>
636         </pz:metadata>
637         <pz:metadata type="callnumber">
638           <xsl:choose><xsl:when test="tmarc:sc">
639             <xsl:value-of select="tmarc:sc"/>
640           </xsl:when><xsl:otherwise>
641             <xsl:text>PAZPAR2_NULL_VALUE</xsl:text>
642           </xsl:otherwise></xsl:choose>
643         </pz:metadata>
644         <pz:metadata type="available">
645           <xsl:choose><xsl:when test="tmarc:se">
646             <xsl:value-of select="tmarc:se"/>
647           </xsl:when><xsl:otherwise>
648             <xsl:text>PAZPAR2_NULL_VALUE</xsl:text>
649           </xsl:otherwise></xsl:choose>
650         </pz:metadata>
651       </xsl:for-each>
652
653       <xsl:for-each select="tmarc:d948">
654         <pz:metadata type="holding">
655           <xsl:for-each select="tmarc:s">
656             <xsl:if test="position() > 1">
657               <xsl:text> </xsl:text>
658             </xsl:if>
659             <xsl:value-of select="." />
660           </xsl:for-each>
661         </pz:metadata>
662       </xsl:for-each>
663
664       <xsl:for-each select="tmarc:d991">
665         <pz:metadata type="holding">
666           <xsl:for-each select="tmarc:s">
667             <xsl:if test="position() > 1">
668               <xsl:text> </xsl:text>
669             </xsl:if>
670             <xsl:value-of select="." />
671           </xsl:for-each>
672         </pz:metadata>
673       </xsl:for-each>
674
675       <!-- passthrough id data -->
676       <xsl:for-each select="pz:metadata">
677         <xsl:copy-of select="." />
678       </xsl:for-each>
679
680       <!-- other stylesheets importing this might want to define this -->
681         <xsl:call-template name="record-hook" />
682
683     </pz:record>
684   </xsl:template>
685
686   <xsl:template match="text()" />
687
688   <!-- TODO Does not work anymore -->
689   <xsl:template name="shortTitle">
690     <xsl:param name="tag" />
691     <xsl:for-each select="tmarc:d">
692       <xsl:value-of select="tmarc:sa" />
693       <xsl:value-of select="tmarc:sm" />
694       <xsl:value-of select="tmarc:sn" />
695       <xsl:value-of select="tmarc:sp" />
696       <xsl:value-of select="tmarc:sr" />
697     </xsl:for-each>
698   </xsl:template>
699
700   <!-- No working as expected -->
701   <xsl:template name="description">
702     <xsl:param name="element" />
703     <xsl:for-each select="$element">
704       <pz:metadata type="description">
705         <xsl:for-each select="node()">
706           <xsl:value-of select="text()" />
707         </xsl:for-each>
708       </pz:metadata>
709     </xsl:for-each>
710     <xsl:apply-templates />
711   </xsl:template>
712
713   <!-- <xsl:for-each select="tmarc:d500"> <pz:metadata type="description"> 
714     <xsl:for-each select="node()"> <xsl:value-of select="text()"/> </xsl:for-each> 
715     </pz:metadata> </xsl:for-each> -->
716
717
718
719   <xsl:template name="subject">
720     <xsl:param name="element" />
721     <xsl:for-each select="$element">
722       <pz:metadata type="subject">
723         <xsl:value-of select="tmarc:sa" />
724       </pz:metadata>
725       <pz:metadata type="subject-long">
726         <xsl:for-each select="node()/text()">
727           <xsl:if test="position() > 1">
728             <xsl:text>, </xsl:text>
729           </xsl:if>
730           <xsl:value-of select="." />
731         </xsl:for-each>
732       </pz:metadata>
733     </xsl:for-each>
734   </xsl:template>
735
736
737 </xsl:stylesheet>