-
Notifications
You must be signed in to change notification settings - Fork 13
/
holdings-items.xsl
431 lines (427 loc) · 20.2 KB
/
holdings-items.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
<xsl:template match="collection">
<collection>
<xsl:apply-templates/>
</collection>
</xsl:template>
<xsl:template match="record">
<record>
<xsl:for-each select="*">
<xsl:copy-of select="."/>
</xsl:for-each>
<xsl:apply-templates select="original"/>
</record>
</xsl:template>
<xsl:template match="original">
<xsl:if test="item/datafield[@tag='203@']/subfield[@code='0']">
<holdingsRecords>
<arr>
<xsl:apply-templates select="item"/>
</arr>
</holdingsRecords>
</xsl:if>
</xsl:template>
<xsl:template match="item">
<i>
<xsl:variable name="hhrid" select="datafield[@tag='203@']/subfield[@code='0']"/>
<hrid>
<xsl:value-of select="$hhrid"/>
</hrid>
<xsl:variable name="electronicholding" select="substring(//datafield[@tag='002@']/subfield[@code='0'],1,1) = 'O'"/>
<xsl:variable name="lcode" select="datafield[@tag='209A']/subfield[@code='f']"/>
<permanentLocationId>
<xsl:value-of select="$lcode"/>
</permanentLocationId>
<callNumber>
<xsl:value-of select="datafield[@tag='209A']/subfield[@code='a']"/>
</callNumber>
<callNumberPrefix>
<xsl:value-of select="datafield[@tag='209A']/subfield[@code='f']"/>
</callNumberPrefix>
<holdingsTypeId>
<xsl:variable name="holType" select="../datafield[@tag='002@']/subfield[@code='0']"/>
<xsl:variable name="holType1" select="substring($holType, 1, 1)"/>
<xsl:choose>
<xsl:when test="$holType1 = 'O'">electronic</xsl:when>
<xsl:otherwise>physical</xsl:otherwise>
</xsl:choose>
</holdingsTypeId>
<holdingsStatements>
<xsl:if test="datafield[@tag='231B']/subfield[@code='a']">
<arr>
<xsl:for-each select="datafield[@tag='231B']/subfield[@code='a']">
<i>
<statement>
<xsl:value-of select="."/>
</statement>
</i>
</xsl:for-each>
</arr>
</xsl:if>
</holdingsStatements>
<sourceId>K10plus</sourceId>
<administrativeNotes>
<arr>
<xsl:for-each select="datafield[@tag='201B']">
<i>
<xsl:value-of select="concat(./subfield[@code='0'], ', ', substring(./subfield[@code='t'],1,5), ' (7903: Datum und Uhrzeit der letzten Änderung)')"/>
</i>
</xsl:for-each>
</arr>
</administrativeNotes>
<discoverySuppress>
<xsl:choose>
<xsl:when test="substring(datafield[@tag='208@']/subfield[@code='b'],1,1)='c'">true</xsl:when>
<xsl:when test="substring(datafield[@tag='208@']/subfield[@code='b'],1,1)='d'">true</xsl:when>
<xsl:when test="substring(datafield[@tag='208@']/subfield[@code='b'],1,1)='e'">true</xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
</discoverySuppress>
<notes>
<arr>
<xsl:if test="datafield[@tag='220B' or @tag='237A' or @tag='244Z' or @tag='209O' or @tag='206X' or @tag='206W']">
<!-- 4801 -->
<xsl:for-each select="datafield[@tag='237A']">
<xsl:if test="./subfield[@code='a'] or ./subfield[@code='0']">
<i>
<note>
<xsl:value-of select="./subfield[@code='a'] | ./subfield[@code='0']"/>
</note>
<holdingsNoteTypeId>Exemplarbezogener Kommentar - benutzerrelevante Hinweise (4801)</holdingsNoteTypeId>
<staffOnly>false</staffOnly>
</i>
</xsl:if>
</xsl:for-each>
<!-- 4802 -->
<xsl:for-each select="datafield[@tag='220B']">
<xsl:if test="./subfield[@code='a'] or ./subfield[@code='0']">
<i>
<note>
<xsl:value-of select="./subfield[@code='a'] | ./subfield[@code='0']"/>
</note>
<holdingsNoteTypeId>Exemplarbezogener Kommentar - bibliotheksinterne Hinweise (4802)</holdingsNoteTypeId>
<staffOnly>true</staffOnly>
</i>
</xsl:if>
</xsl:for-each>
<!-- 6800 -->
<xsl:for-each select="datafield[@tag='244Z']">
<xsl:variable name="expansion" select="substring-before(./subfield[@code='8'], ' ; ID:')"/>
<i>
<note>
<xsl:choose>
<xsl:when test="./subfield[@code='S']">
<xsl:choose>
<xsl:when test="$expansion">
<xsl:value-of select="concat(./subfield[@code='S'], ' ', $expansion)"/>
</xsl:when>
<xsl:when test="./subfield[@code='8']">
<xsl:value-of select="concat(./subfield[@code='S'], ' ', ./subfield[@code='8'])"/>
</xsl:when>
<xsl:when test="./subfield[@code='a']">
<xsl:value-of select="concat(./subfield[@code='S'], ' ', ./subfield[@code='a'])"/>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$expansion">
<xsl:value-of select="$expansion"/>
</xsl:when>
<xsl:when test="./subfield[@code='8']">
<xsl:value-of select="./subfield[@code='8']"/>
</xsl:when>
<xsl:when test="./subfield[@code='a']">
<xsl:value-of select="./subfield[@code='a']"/>
</xsl:when>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</note>
<holdingsNoteTypeId>Lokale Schlagwörter (6800)</holdingsNoteTypeId>
<staffOnly>false</staffOnly>
</i>
</xsl:for-each>
<!-- 8600 -->
<xsl:for-each select="datafield[@tag='209O']">
<xsl:if test="./subfield[@code='a']">
<i>
<note>
<xsl:value-of select="./subfield[@code='a']"/>
</note>
<holdingsNoteTypeId>Abrufzeichen exemplarspezifisch (8600)</holdingsNoteTypeId>
<staffOnly>true</staffOnly>
</i>
</xsl:if>
</xsl:for-each>
<!-- 7811 -->
<xsl:for-each select="datafield[@tag='206X']">
<xsl:if test="./subfield[@code='0']">
<i>
<note>
<xsl:value-of select="./subfield[@code='0']"/>
</note>
<holdingsNoteTypeId>Lokale Identifikationsnummer anderer Systeme (7811)</holdingsNoteTypeId>
<staffOnly>false</staffOnly>
</i>
</xsl:if>
</xsl:for-each>
<!-- 7812 -->
<xsl:for-each select="datafield[@tag='206W']">
<xsl:if test="./subfield[@code='0']">
<i>
<note>
<xsl:value-of select="./subfield[@code='0']"/>
</note>
<holdingsNoteTypeId>Lokale Identifikationsnummer externer Systeme (7812)</holdingsNoteTypeId>
<staffOnly>false</staffOnly>
</i>
</xsl:if>
</xsl:for-each>
</xsl:if>
</arr>
</notes>
<electronicAccess>
<arr>
<xsl:for-each select="datafield[@tag='209R']">
<xsl:if test="./subfield[@code='u']">
<i>
<uri>
<xsl:value-of select="./subfield[@code='u']"/>
</uri>
<relationshipId>Ressource</relationshipId>
<!-- Resource -->
<xsl:if test="../datafield[@tag='209K']">
<publicNote>
<xsl:variable name="enote" select="../datafield[@tag='209K'][1]/subfield[@code='a']"/>
<xsl:variable name="bnote" select="../datafield[@tag='209K'][1]/subfield[@code='b']"/>
<xsl:variable name="cnote" select="../datafield[@tag='209K'][1]/subfield[@code='c']"/>
<xsl:choose>
<xsl:when test="$enote='a'">Zugriffsrechte: domain, der Zugriff ist nur hausintern möglich</xsl:when>
<xsl:when test="$enote='b'">Zugriffsrechte: free, der Zugriff ist unbeschränkt möglich</xsl:when>
<xsl:when test="$enote='c'">Zugriffsrechte: blocked, der Zugriff ist gar nicht möglich</xsl:when>
<xsl:when test="$enote='d'">Zugriffsrechte: domain+, der Zugriff ist hausintern und für bestimmte zugelassene, andere Benutzer möglich</xsl:when>
<xsl:when test="$bnote">
<xsl:value-of select="concat('Zahl der parallelen Zugriffe: ', $bnote)"/>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="$cnote and ($enote or $bnote)">
<xsl:value-of select="concat(' ; ', $cnote)"/>
</xsl:when>
<xsl:when test="$cnote">
<xsl:value-of select="$cnote"/>
</xsl:when>
</xsl:choose>
</publicNote>
</xsl:if>
</i>
</xsl:if>
</xsl:for-each>
</arr>
</electronicAccess>
<illPolicyId>
<xsl:variable name="illpolicy" select="datafield[@tag='209B']/subfield[@code='a']"/>
<xsl:choose>
<xsl:when test="$illpolicy='nx'">8052 nx - keine Fernleihe</xsl:when>
<xsl:when test="$illpolicy='nxp'">8052 nxp - keine Fernleihe</xsl:when>
<xsl:when test="$illpolicy='kx'">8052 kx - Papierkopie an Endnutzer</xsl:when>
<xsl:when test="$illpolicy='ky'">8052 ky - Papierkopie an Endnutzer, nur im Inland</xsl:when>
<xsl:when test="$illpolicy='kxp'">8052 kxp - Papierkopie an Endnutzer, Elektronische Übertragung zwischen den Bibliotheken ausgeschlossen</xsl:when>
<xsl:when test="$illpolicy='kyp'">8052 kyp - Papierkopie an Endnutzer, nur im Inland, Elektronische Übertragung zwischen den Bibliotheken ausgeschlossen</xsl:when>
<xsl:when test="$illpolicy='ex'">8052 ex - elektronischer Versand an Endnutzer</xsl:when>
<xsl:when test="$illpolicy='ey'">8052 ey - elektronischer Versand an Endnutzer, nur im Inland</xsl:when>
</xsl:choose>
</illPolicyId>
<xsl:if test="not($electronicholding)">
<items>
<arr>
<xsl:choose>
<xsl:when test="datafield[@tag='209G']/subfield[@code='a'][2]">
<xsl:for-each select="datafield[@tag='209G']/subfield[@code='a']">
<xsl:apply-templates select="../.." mode="make-item">
<xsl:with-param name="hhrid" select="concat($hhrid, '-', .)"/>
<xsl:with-param name="bcode" select="."/>
<xsl:with-param name="copy" select="./following-sibling::subfield[@code='c'][1]"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:when>
<!-- start implement bound-with case -->
<xsl:when test="datafield[@tag='209A']/subfield[@code='i']">
<xsl:if test="datafield[@tag='209G']/subfield[@code='a']">
<xsl:apply-templates select="." mode="make-item">
<xsl:with-param name="hhrid" select="$hhrid"/>
</xsl:apply-templates>
</xsl:if>
<xsl:if test="not(datafield[@tag='209G']/subfield[@code='a'])">
<!-- exit and don't create an item -->
</xsl:if>
</xsl:when>
<!-- end implement bound-with case -->
<xsl:otherwise>
<xsl:apply-templates select="." mode="make-item">
<xsl:with-param name="hhrid" select="$hhrid"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</arr>
</items>
</xsl:if>
</i>
</xsl:template>
<xsl:template match="item" mode="make-item">
<xsl:param name="hhrid"/>
<xsl:param name="bcode" select="datafield[@tag='209G']/subfield[@code='a']"/>
<xsl:param name="copy" select="datafield[@tag='209G']/subfield[@code='c']"/>
<i>
<hrid>
<xsl:value-of select="$hhrid"/>
</hrid>
<materialTypeId>
<xsl:variable name="type" select="../datafield[@tag='002@']/subfield[@code='0']"/>
<xsl:variable name="type1" select="substring($type, 1, 1)"/>
<xsl:variable name="type12" select="substring($type, 1, 2)"/>
<xsl:variable name="type2" select="substring($type, 2, 1)"/>
<xsl:variable name="pd" select="../datafield[@tag='013H']/subfield[@code='a']"/>
<xsl:variable name="mt" select="../datafield[@tag='002D']/subfield[@code='b']"/>
<xsl:choose>
<xsl:when test="$type12 = 'Ab'">
<xsl:choose>
<xsl:when test="$pd = 'zt'">Zeitung</xsl:when>
<xsl:otherwise>Zeitschrift</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$type2 = 's'">Aufsatz</xsl:when>
<xsl:when test="$type2 = 'c'">Mehrteilige Monografie</xsl:when>
<xsl:when test="$type2 = 'd'">Serie</xsl:when>
<xsl:when test="$type1 = 'A'">
<xsl:choose>
<xsl:when test="$pd = 'kart'">Karte(nwerk)</xsl:when>
<xsl:when test="$pd = 'lo'">Loseblattwerk</xsl:when>
<xsl:when test="$pd = 'muno'">Musiknote</xsl:when>
<xsl:otherwise>Buch</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$type1 = 'B'">
<xsl:choose>
<xsl:when test="$pd = 'vide' or $mt = 'v'">Film (DVD/Video)</xsl:when>
<xsl:when test="$mt = 'g' or $mt = 'n'">Bild(ersammlung)</xsl:when>
<xsl:when test="$pd = 'muno'">Musiknote</xsl:when>
<xsl:otherwise>Tonträger</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$type1 = 'C'">Blindenschriftträger</xsl:when>
<xsl:when test="$type1 = 'E'">Mikroform</xsl:when>
<xsl:when test="$type1 = 'H'">Handschrift</xsl:when>
<xsl:when test="$type1 = 'O'">E-Ressource</xsl:when>
<xsl:when test="$type1 = 'S'">E-Ressource auf Datenträger</xsl:when>
<xsl:when test="$type1 = 'V'">Objekt</xsl:when>
<xsl:when test="$type = 'Lax'">Lax</xsl:when>
<xsl:otherwise>Nicht spezifiziert</xsl:otherwise>
</xsl:choose>
</materialTypeId>
<permanentLoanTypeId>
<xsl:variable name="loantype" select="datafield[@tag='209A']/subfield[@code='d']"/>
<xsl:choose>
<xsl:when test="$loantype='u'">u - ausleihbar/Fernleihe</xsl:when>
<xsl:when test="$loantype='b'">b - verkürzt ausleihbar/Fernleihe</xsl:when>
<xsl:when test="$loantype='c'">c - ausleihbar/keine Fernleihe</xsl:when>
<xsl:when test="$loantype='s'">s - mit Zustimmung ausleihbar/nur Kopie in die Fernleihe</xsl:when>
<xsl:when test="$loantype='d'">d - mit Zustimmung ausleihbar/Fernleihe</xsl:when>
<xsl:when test="$loantype='i'">i - Lesesaalausleihe/keine Fernleihe</xsl:when>
<xsl:when test="$loantype='f'">f - Lesesaalausleihe/nur Kopie in die Fernleihe</xsl:when>
<xsl:when test="$loantype='g'">g - für die Ausleihe gesperrt/keine Fernleihe</xsl:when>
<xsl:when test="$loantype='a'">a - bestellt/keine Fernleihe</xsl:when>
<xsl:when test="$loantype='o'">o - keine Angabe/keine Fernleihe</xsl:when>
<xsl:when test="$loantype='z'">z - Verlust/keine Fernleihe</xsl:when>
<xsl:otherwise>ausleihbar/Fernleihe</xsl:otherwise>
</xsl:choose>
</permanentLoanTypeId>
<status>
<xsl:variable name="frequency" select="substring(../datafield[@tag='002@']/subfield[@code='0'],2,1)"/>
<name>
<xsl:choose>
<xsl:when test="$frequency='b'">Intellectual item</xsl:when>
<xsl:when test="$frequency='c'">Intellectual item</xsl:when>
<xsl:when test="$frequency='d'">Intellectual item</xsl:when>
<xsl:when test="datafield[@tag='209A']/subfield[@code='d']='a'">On order</xsl:when>
<xsl:when test="datafield[@tag='209A']/subfield[@code='d']='u'">Available</xsl:when>
<xsl:when test="datafield[@tag='209A']/subfield[@code='d']='b'">Available</xsl:when>
<xsl:when test="datafield[@tag='209A']/subfield[@code='d']='c'">Available</xsl:when>
<xsl:when test="datafield[@tag='209A']/subfield[@code='d']='s'">Available</xsl:when>
<xsl:when test="datafield[@tag='209A']/subfield[@code='d']='d'">Available</xsl:when>
<xsl:when test="datafield[@tag='209A']/subfield[@code='d']='i'">Available</xsl:when>
<xsl:when test="datafield[@tag='209A']/subfield[@code='d']='f'">Available</xsl:when>
<xsl:when test="datafield[@tag='209A']/subfield[@code='d']='z'">Missing</xsl:when>
<xsl:when test="datafield[@tag='209A']/subfield[@code='d']='g'">Restricted</xsl:when>
<xsl:when test="datafield[@tag='209A']/subfield[@code='d']='o'">Unknown</xsl:when>
<xsl:otherwise>Available</xsl:otherwise>
</xsl:choose>
</name>
</status>
<xsl:if test="$bcode">
<barcode>
<xsl:value-of select="$bcode"/>
</barcode>
</xsl:if>
<copyNumber>
<xsl:value-of select="$copy"/>
</copyNumber>
<volume>
<xsl:for-each select="datafield[@tag='231@']/subfield[@code='d' or @code='n']">
<xsl:choose>
<xsl:when test="./@code='n'">
<xsl:value-of select="concat('-', .)"/>
</xsl:when>
<xsl:when test="./@code='d' and position()>1">
<xsl:value-of select="concat(', ', .)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="position()=last() and ./@code='d' and ../subfield[@code='6']">-</xsl:if>
</xsl:for-each>
</volume>
<chronology>
<xsl:for-each select="datafield[@tag='231@']/subfield[@code='j' or @code='k']">
<xsl:choose>
<xsl:when test="./@code='k'">
<xsl:value-of select="concat('-', .)"/>
</xsl:when>
<xsl:when test="./@code='j' and position()>1">
<xsl:value-of select="concat(', ', .)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="position()=last() and ./@code='j' and ../subfield[@code='6']">-</xsl:if>
</xsl:for-each>
</chronology>
<enumeration>
<xsl:value-of select="datafield[@tag='231B']/subfield[@code='a']"/>
</enumeration>
<descriptionOfPieces>
<xsl:value-of select="datafield[@tag='208F']/subfield[@code='a']"/>
</descriptionOfPieces>
<accessionNumber>
<xsl:for-each select="datafield[@tag='209C']">
<xsl:value-of select="./subfield[@code='a']"/>
<xsl:if test="position() != last()">, </xsl:if>
</xsl:for-each>
</accessionNumber>
<discoverySuppress>
<xsl:choose>
<xsl:when test="substring(datafield[@tag='208@']/subfield[@code='b'],1,1)='c'">true</xsl:when>
<xsl:when test="substring(datafield[@tag='208@']/subfield[@code='b'],1,1)='d'">true</xsl:when>
<xsl:when test="substring(datafield[@tag='208@']/subfield[@code='b'],1,1)='e'">true</xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
</discoverySuppress>
</i>
</xsl:template>
<xsl:template match="text()"/>
</xsl:stylesheet>