View | Details | Raw Unified | Return to bug 29629
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2MODS3.xsl (-2793 lines)
Lines 1-2793 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE stylesheet>
3
<xsl:stylesheet version="1.0" xmlns="http://www.loc.gov/mods/v3" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xlink marc">
4
	<xsl:include href="MARC21slimUtils.xsl"/>
5
	<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
6
7
<!--
8
Revision 1.9 subfield $y was added to field 242 2004/09/02 10:57 jrad
9
10
Revision 1.8 Subject chopPunctuation expanded and attribute fixes 2004/08/12 jrad
11
12
Revision 1.7 2004/03/25 08:29 jrad
13
14
Revision 1.6 various validation fixes 2004/02/20 ntra
15
16
Revision 1.5  2003/10/02 16:18:58  ntra
17
MODS2 to MODS3 updates, language unstacking and 
18
de-duping, chopPunctuation expanded
19
20
Revision 1.3  2003/04/03 00:07:19  ntra
21
Revision 1.3 Additional Changes not related to MODS Version 2.0 by ntra
22
23
Revision 1.2  2003/03/24 19:37:42  ckeith
24
Added Log Comment
25
26
-->
27
	<xsl:template match="/">
28
		<xsl:choose>
29
			<xsl:when test="marc:collection">
30
				<modsCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-0.xsd">
31
					<xsl:for-each select="marc:collection/marc:record">
32
						<mods version="3.0">
33
							<xsl:call-template name="marcRecord"/>
34
						</mods>
35
					</xsl:for-each>
36
				</modsCollection>
37
			</xsl:when>
38
			<xsl:otherwise>
39
				<mods version="3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-0.xsd">
40
					<xsl:for-each select="marc:record">
41
						<xsl:call-template name="marcRecord"/>
42
					</xsl:for-each>
43
				</mods>
44
			</xsl:otherwise>
45
		</xsl:choose>
46
	</xsl:template>
47
48
	<xsl:template name="marcRecord">
49
		<xsl:variable name="leader" select="marc:leader"/>
50
		<xsl:variable name="leader6" select="substring($leader,7,1)"/>
51
		<xsl:variable name="leader7" select="substring($leader,8,1)"/>
52
		<xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
53
		<xsl:variable name="typeOf008">
54
			<xsl:choose>
55
				<xsl:when test="$leader6='a'">
56
					<xsl:choose>
57
						<xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
58
						<xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">SE</xsl:when>
59
					</xsl:choose>
60
				</xsl:when>
61
				<xsl:when test="$leader6='t'">BK</xsl:when>
62
				<xsl:when test="$leader6='p'">MM</xsl:when>
63
				<xsl:when test="$leader6='m'">CF</xsl:when>
64
				<xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
65
				<xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">VM</xsl:when>
66
				<xsl:when test="$leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'">MU</xsl:when>
67
			</xsl:choose>
68
		</xsl:variable>
69
70
		<xsl:for-each select="marc:datafield[@tag=245]">
71
			<titleInfo>
72
				<xsl:variable name="title">
73
					<xsl:choose>
74
						<xsl:when test="marc:subfield[@code='b']">
75
							<xsl:call-template name="specialSubfieldSelect">
76
								<xsl:with-param name="axis">b</xsl:with-param>
77
								<xsl:with-param name="beforeCodes">afghk</xsl:with-param>
78
							</xsl:call-template>
79
						</xsl:when>
80
						<xsl:otherwise>
81
							<xsl:call-template name="subfieldSelect">
82
								<xsl:with-param name="codes">abfgk</xsl:with-param>
83
							</xsl:call-template>
84
						</xsl:otherwise>
85
					</xsl:choose>
86
				</xsl:variable>
87
88
				<xsl:variable name="titleChop">
89
					<xsl:call-template name="chopPunctuation">
90
						<xsl:with-param name="chopString">
91
							<xsl:value-of select="$title"/>
92
						</xsl:with-param>
93
					</xsl:call-template>
94
				</xsl:variable>
95
				<xsl:choose>
96
					<xsl:when test="@ind2&gt;0">
97
						<nonSort>
98
							<xsl:value-of select="substring($titleChop,1,@ind2)"/>
99
						</nonSort>
100
						<title>
101
							<xsl:value-of select="substring($titleChop,@ind2+1)"/>
102
						</title>
103
					</xsl:when>
104
					<xsl:otherwise>
105
						<title>
106
							<xsl:value-of select="$titleChop"/>
107
						</title>
108
					</xsl:otherwise>
109
				</xsl:choose>
110
				<xsl:if test="marc:subfield[@code='b']">
111
					<subTitle>
112
						<xsl:call-template name="chopPunctuation">
113
							<xsl:with-param name="chopString">
114
								<xsl:call-template name="specialSubfieldSelect">
115
									<xsl:with-param name="axis">b</xsl:with-param>
116
									<xsl:with-param name="anyCodes">b</xsl:with-param>
117
									<xsl:with-param name="afterCodes">afghk</xsl:with-param>
118
								</xsl:call-template>
119
							</xsl:with-param>
120
						</xsl:call-template>
121
					</subTitle>
122
				</xsl:if>
123
				<xsl:call-template name="part"/>
124
			</titleInfo>
125
		</xsl:for-each>
126
127
		<xsl:for-each select="marc:datafield[@tag=210]">
128
			<titleInfo type="abbreviated">
129
				<title>
130
					<xsl:call-template name="chopPunctuation">
131
						<xsl:with-param name="chopString">
132
							<xsl:call-template name="subfieldSelect">
133
								<xsl:with-param name="codes">a</xsl:with-param>
134
							</xsl:call-template>
135
						</xsl:with-param>
136
					</xsl:call-template>
137
				</title>
138
				<xsl:call-template name="subtitle"/>
139
			</titleInfo>
140
		</xsl:for-each>
141
142
		<xsl:for-each select="marc:datafield[@tag=242]">
143
			<titleInfo type="translated">
144
			<!--09/01/04 Added subfield $y-->
145
			<xsl:for-each select="marc:subfield[@code='y']">
146
					<xsl:attribute name="lang">
147
						<xsl:value-of select="text()"/>
148
					</xsl:attribute>
149
					</xsl:for-each>
150
			<title>
151
			
152
					<xsl:call-template name="chopPunctuation">
153
						<xsl:with-param name="chopString">
154
							<xsl:call-template name="subfieldSelect">
155
								<!-- 1/04 removed $h, b -->
156
								<xsl:with-param name="codes">a</xsl:with-param>
157
							</xsl:call-template>
158
						</xsl:with-param>
159
					</xsl:call-template>
160
					
161
				</title>
162
				
163
				
164
				<!-- 1/04 fix -->
165
				<xsl:call-template name="subtitle"/>
166
				<xsl:call-template name="part"/>
167
			</titleInfo>
168
		</xsl:for-each>
169
170
		<xsl:for-each select="marc:datafield[@tag=246]">
171
			<titleInfo type="alternative">
172
				<xsl:for-each select="marc:subfield[@code='i']">
173
					<xsl:attribute name="displayLabel">
174
						<xsl:value-of select="text()"/>
175
					</xsl:attribute>
176
				</xsl:for-each>
177
				<title>
178
					<xsl:call-template name="chopPunctuation">
179
						<xsl:with-param name="chopString">
180
							<xsl:call-template name="subfieldSelect">
181
								<!-- 1/04 removed $h, $b -->
182
								<xsl:with-param name="codes">af</xsl:with-param>
183
							</xsl:call-template>
184
						</xsl:with-param>
185
					</xsl:call-template>
186
				</title>
187
				<xsl:call-template name="subtitle"/>
188
				<xsl:call-template name="part"/>
189
			</titleInfo>
190
		</xsl:for-each>
191
192
		<xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
193
			<titleInfo type="uniform">
194
				<title>
195
					<xsl:variable name="str">
196
						<xsl:for-each select="marc:subfield">
197
							<xsl:if test="(contains('adfklmor',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))">
198
								<xsl:value-of select="text()"/>
199
								<xsl:text> </xsl:text>
200
							</xsl:if>
201
						</xsl:for-each>
202
					</xsl:variable>
203
204
					<xsl:call-template name="chopPunctuation">
205
						<xsl:with-param name="chopString">
206
							<xsl:value-of select="substring($str,1,string-length($str)-1)"/>
207
						</xsl:with-param>
208
					</xsl:call-template>
209
				</title>
210
				<xsl:call-template name="part"/>
211
			</titleInfo>
212
		</xsl:for-each>
213
214
		<xsl:for-each select="marc:datafield[@tag=740][@ind2!=2]">
215
			<titleInfo type="alternative">
216
				<title>
217
					<xsl:call-template name="chopPunctuation">
218
						<xsl:with-param name="chopString">
219
							<xsl:call-template name="subfieldSelect">
220
								<xsl:with-param name="codes">ah</xsl:with-param>
221
							</xsl:call-template>
222
						</xsl:with-param>
223
					</xsl:call-template>
224
				</title>
225
				<xsl:call-template name="part"/>
226
			</titleInfo>
227
		</xsl:for-each>
228
229
		<xsl:for-each select="marc:datafield[@tag=100]">
230
			<name type="personal">
231
				<xsl:call-template name="nameABCDQ"/>
232
				<xsl:call-template name="affiliation"/>
233
				<role>
234
					<roleTerm authority="marcrelator" type="text">creator</roleTerm>
235
				</role>
236
				<xsl:call-template name="role"/>
237
			</name>
238
		</xsl:for-each>
239
240
		<xsl:for-each select="marc:datafield[@tag=110]">
241
			<name type="corporate">
242
				<xsl:call-template name="nameABCDN"/>
243
				<role>
244
					<roleTerm authority="marcrelator" type="text">creator</roleTerm>
245
				</role>
246
				<xsl:call-template name="role"/>
247
			</name>
248
		</xsl:for-each>
249
250
		<xsl:for-each select="marc:datafield[@tag=111]">
251
			<name type="conference">
252
				<xsl:call-template name="nameACDEQ"/>
253
				<role>
254
					<roleTerm authority="marcrelator" type="text">creator</roleTerm>
255
				</role>
256
				<xsl:call-template name="role"/>
257
			</name>
258
		</xsl:for-each>
259
260
		<xsl:for-each select="marc:datafield[@tag=700][not(marc:subfield[@code='t'])]">
261
			<name type="personal">
262
				<xsl:call-template name="nameABCDQ"/>
263
				<xsl:call-template name="affiliation"/>
264
				<xsl:call-template name="role"/>
265
			</name>
266
		</xsl:for-each>
267
268
		<xsl:for-each select="marc:datafield[@tag=710][not(marc:subfield[@code='t'])]">
269
			<name type="corporate">
270
				<xsl:call-template name="nameABCDN"/>
271
				<xsl:call-template name="role"/>
272
			</name>
273
		</xsl:for-each>
274
275
		<xsl:for-each select="marc:datafield[@tag=711][not(marc:subfield[@code='t'])]">
276
			<name type="conference">
277
				<xsl:call-template name="nameACDEQ"/>
278
				<xsl:call-template name="role"/>
279
			</name>
280
		</xsl:for-each>
281
282
		<xsl:for-each select="marc:datafield[@tag=720][not(marc:subfield[@code='t'])]">
283
			<name>
284
				<xsl:if test="@ind1=1">
285
					<xsl:attribute name="type">
286
						<xsl:text>personal</xsl:text>
287
					</xsl:attribute>
288
				</xsl:if>
289
				<namePart>
290
					<xsl:value-of select="marc:subfield[@code='a']"/>
291
				</namePart>
292
				<xsl:call-template name="role"/>
293
			</name>
294
		</xsl:for-each>
295
296
		<typeOfResource>
297
			<xsl:if test="$leader7='c'">
298
				<xsl:attribute name="collection">yes</xsl:attribute>
299
			</xsl:if>
300
			<xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'">
301
				<xsl:attribute name="manuscript">yes</xsl:attribute>
302
			</xsl:if>
303
			<xsl:choose>
304
				<xsl:when test="$leader6='a' or $leader6='t'">text</xsl:when>
305
				<xsl:when test="$leader6='e' or $leader6='f'">cartographic</xsl:when>
306
				<xsl:when test="$leader6='c' or $leader6='d'">notated music</xsl:when>
307
				<xsl:when test="$leader6='i'">sound recording-nonmusical</xsl:when>
308
				<xsl:when test="$leader6='j'">sound recording-musical</xsl:when>
309
				<xsl:when test="$leader6='k'">still image</xsl:when>
310
				<xsl:when test="$leader6='g'">moving image</xsl:when>
311
				<xsl:when test="$leader6='r'">three dimensional object</xsl:when>
312
				<xsl:when test="$leader6='m'">software, multimedia</xsl:when>
313
				<xsl:when test="$leader6='p'">mixed material</xsl:when>
314
			</xsl:choose>
315
		</typeOfResource>
316
317
		<xsl:if test="substring($controlField008,26,1)='d'">
318
			<genre authority="marc">globe</genre>
319
		</xsl:if>
320
321
		<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='r']">
322
			<genre authority="marc">remote sensing image</genre>
323
		</xsl:if>
324
325
		<xsl:if test="$typeOf008='MP'">
326
			<xsl:variable name="controlField008-25" select="substring($controlField008,26,1)"/>
327
			<xsl:choose>
328
				<xsl:when test="$controlField008-25='a' or $controlField008-25='b' or $controlField008-25='c' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='j']">
329
					<genre authority="marc">map</genre>
330
				</xsl:when>
331
				<xsl:when test="$controlField008-25='e' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']">
332
					<genre authority="marc">atlas</genre>
333
				</xsl:when>
334
			</xsl:choose>
335
		</xsl:if>
336
337
		<xsl:if test="$typeOf008='SE'">
338
			<xsl:variable name="controlField008-21" select="substring($controlField008,22,1)"/>
339
			<xsl:choose>
340
				<xsl:when test="$controlField008-21='d'">
341
					<genre authority="marc">database</genre>
342
				</xsl:when>
343
				<xsl:when test="$controlField008-21='l'">
344
					<genre authority="marc">loose-leaf</genre>
345
				</xsl:when>
346
				<xsl:when test="$controlField008-21='m'">
347
					<genre authority="marc">series</genre>
348
				</xsl:when>
349
				<xsl:when test="$controlField008-21='n'">
350
					<genre authority="marc">newspaper</genre>
351
				</xsl:when>
352
				<xsl:when test="$controlField008-21='p'">
353
					<genre authority="marc">periodical</genre>
354
				</xsl:when>
355
				<xsl:when test="$controlField008-21='w'">
356
					<genre authority="marc">web site</genre>
357
				</xsl:when>
358
			</xsl:choose>
359
		</xsl:if>
360
361
		<xsl:if test="$typeOf008='BK' or $typeOf008='SE'">
362
			<xsl:variable name="controlField008-24" select="substring($controlField008,25,4)"/>
363
			<xsl:choose>
364
				<xsl:when test="contains($controlField008-24,'a')">
365
					<genre authority="marc">abstract or summary</genre>
366
				</xsl:when>
367
				<xsl:when test="contains($controlField008-24,'b')">
368
					<genre authority="marc">bibliography</genre>
369
				</xsl:when>
370
				<xsl:when test="contains($controlField008-24,'c')">
371
					<genre authority="marc">catalog</genre>
372
				</xsl:when>
373
				<xsl:when test="contains($controlField008-24,'d')">
374
					<genre authority="marc">dictionary</genre>
375
				</xsl:when>
376
				<xsl:when test="contains($controlField008-24,'e')">
377
					<genre authority="marc">encyclopedia</genre>
378
				</xsl:when>
379
				<xsl:when test="contains($controlField008-24,'f')">
380
					<genre authority="marc">handbook</genre>
381
				</xsl:when>
382
				<xsl:when test="contains($controlField008-24,'g')">
383
					<genre authority="marc">legal article</genre>
384
				</xsl:when>
385
				<xsl:when test="contains($controlField008-24,'i')">
386
					<genre authority="marc">index</genre>
387
				</xsl:when>
388
				<xsl:when test="contains($controlField008-24,'k')">
389
					<genre authority="marc">discography</genre>
390
				</xsl:when>
391
				<xsl:when test="contains($controlField008-24,'l')">
392
					<genre authority="marc">legislation</genre>
393
				</xsl:when>
394
				<xsl:when test="contains($controlField008-24,'m')">
395
					<genre authority="marc">theses</genre>
396
				</xsl:when>
397
				<xsl:when test="contains($controlField008-24,'n')">
398
					<genre authority="marc">survey of literature</genre>
399
				</xsl:when>
400
				<xsl:when test="contains($controlField008-24,'o')">
401
					<genre authority="marc">review</genre>
402
				</xsl:when>
403
				<xsl:when test="contains($controlField008-24,'p')">
404
					<genre authority="marc">programmed text</genre>
405
				</xsl:when>
406
				<xsl:when test="contains($controlField008-24,'q')">
407
					<genre authority="marc">filmography</genre>
408
				</xsl:when>
409
				<xsl:when test="contains($controlField008-24,'r')">
410
					<genre authority="marc">directory</genre>
411
				</xsl:when>
412
				<xsl:when test="contains($controlField008-24,'s')">
413
					<genre authority="marc">statistics</genre>
414
				</xsl:when>
415
				<xsl:when test="contains($controlField008-24,'t')">
416
					<genre authority="marc">technical report</genre>
417
				</xsl:when>
418
				<xsl:when test="contains($controlField008-24,'v')">
419
					<genre authority="marc">legal case and case notes</genre>
420
				</xsl:when>
421
				<xsl:when test="contains($controlField008-24,'w')">
422
					<genre authority="marc">law report or digest</genre>
423
				</xsl:when>
424
				<xsl:when test="contains($controlField008-24,'z')">
425
					<genre authority="marc">treaty</genre>
426
				</xsl:when>
427
			</xsl:choose>
428
			<xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/>
429
			<xsl:choose>
430
				<xsl:when test="$controlField008-29='1'">
431
					<genre authority="marc">conference publication</genre>
432
				</xsl:when>
433
			</xsl:choose>
434
		</xsl:if>
435
436
		<xsl:if test="$typeOf008='CF'">
437
			<xsl:variable name="controlField008-26" select="substring($controlField008,27,1)"/>
438
			<xsl:choose>
439
				<xsl:when test="$controlField008-26='a'">
440
					<genre authority="marc">numeric data</genre>
441
				</xsl:when>
442
				<xsl:when test="$controlField008-26='e'">
443
					<genre authority="marc">database</genre>
444
				</xsl:when>
445
				<xsl:when test="$controlField008-26='f'">
446
					<genre authority="marc">font</genre>
447
				</xsl:when>
448
				<xsl:when test="$controlField008-26='g'">
449
					<genre authority="marc">game</genre>
450
				</xsl:when>
451
			</xsl:choose>
452
		</xsl:if>
453
454
		<xsl:if test="$typeOf008='BK'">
455
			<xsl:if test="substring($controlField008,25,1)='j'">
456
				<genre authority="marc">patent</genre>
457
			</xsl:if>
458
			<xsl:if test="substring($controlField008,31,1)='1'">
459
				<genre authority="marc">festschrift</genre>
460
			</xsl:if>
461
462
			<xsl:variable name="controlField008-34" select="substring($controlField008,35,1)"/>
463
			<xsl:if test="$controlField008-34='a' or $controlField008-34='b' or $controlField008-34='c' or $controlField008-34='d'">
464
				<genre authority="marc">biography</genre>
465
			</xsl:if>
466
467
			<xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/>
468
			<xsl:choose>
469
				<xsl:when test="$controlField008-33='e'">
470
					<genre authority="marc">essay</genre>
471
				</xsl:when>
472
				<xsl:when test="$controlField008-33='d'">
473
					<genre authority="marc">drama</genre>
474
				</xsl:when>
475
				<xsl:when test="$controlField008-33='c'">
476
					<genre authority="marc">comic strip</genre>
477
				</xsl:when>
478
				<xsl:when test="$controlField008-33='l'">
479
					<genre authority="marc">fiction</genre>
480
				</xsl:when>
481
				<xsl:when test="$controlField008-33='h'">
482
					<genre authority="marc">humor, satire</genre>
483
				</xsl:when>
484
				<xsl:when test="$controlField008-33='i'">
485
					<genre authority="marc">letter</genre>
486
				</xsl:when>
487
				<xsl:when test="$controlField008-33='f'">
488
					<genre authority="marc">novel</genre>
489
				</xsl:when>
490
				<xsl:when test="$controlField008-33='j'">
491
					<genre authority="marc">short story</genre>
492
				</xsl:when>
493
				<xsl:when test="$controlField008-33='s'">
494
					<genre authority="marc">speech</genre>
495
				</xsl:when>
496
			</xsl:choose>
497
		</xsl:if>
498
499
		<xsl:if test="$typeOf008='MU'">
500
			<xsl:variable name="controlField008-30-31" select="substring($controlField008,31,2)"/>
501
			<xsl:if test="contains($controlField008-30-31,'b')">
502
				<genre authority="marc">biography</genre>
503
			</xsl:if>
504
			<xsl:if test="contains($controlField008-30-31,'c')">
505
				<genre authority="marc">conference publication</genre>
506
			</xsl:if>
507
			<xsl:if test="contains($controlField008-30-31,'d')">
508
				<genre authority="marc">drama</genre>
509
			</xsl:if>
510
			<xsl:if test="contains($controlField008-30-31,'e')">
511
				<genre authority="marc">essay</genre>
512
			</xsl:if>
513
			<xsl:if test="contains($controlField008-30-31,'f')">
514
				<genre authority="marc">fiction</genre>
515
			</xsl:if>
516
			<xsl:if test="contains($controlField008-30-31,'o')">
517
				<genre authority="marc">folktale</genre>
518
			</xsl:if>
519
			<xsl:if test="contains($controlField008-30-31,'h')">
520
				<genre authority="marc">history</genre>
521
			</xsl:if>
522
			<xsl:if test="contains($controlField008-30-31,'k')">
523
				<genre authority="marc">humor, satire</genre>
524
			</xsl:if>
525
			<xsl:if test="contains($controlField008-30-31,'m')">
526
				<genre authority="marc">memoir</genre>
527
			</xsl:if>
528
			<xsl:if test="contains($controlField008-30-31,'p')">
529
				<genre authority="marc">poetry</genre>
530
			</xsl:if>
531
			<xsl:if test="contains($controlField008-30-31,'r')">
532
				<genre authority="marc">rehearsal</genre>
533
			</xsl:if>
534
			<xsl:if test="contains($controlField008-30-31,'g')">
535
				<genre authority="marc">reporting</genre>
536
			</xsl:if>
537
			<xsl:if test="contains($controlField008-30-31,'s')">
538
				<genre authority="marc">sound</genre>
539
			</xsl:if>
540
			<xsl:if test="contains($controlField008-30-31,'l')">
541
				<genre authority="marc">speech</genre>
542
			</xsl:if>
543
		</xsl:if>
544
545
		<xsl:if test="$typeOf008='VM'">
546
			<xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/>
547
			<xsl:choose>
548
				<xsl:when test="$controlField008-33='a'">
549
					<genre authority="marc">art original</genre>
550
				</xsl:when>
551
				<xsl:when test="$controlField008-33='b'">
552
					<genre authority="marc">kit</genre>
553
				</xsl:when>
554
				<xsl:when test="$controlField008-33='c'">
555
					<genre authority="marc">art reproduction</genre>
556
				</xsl:when>
557
				<xsl:when test="$controlField008-33='d'">
558
					<genre authority="marc">diorama</genre>
559
				</xsl:when>
560
				<xsl:when test="$controlField008-33='f'">
561
					<genre authority="marc">filmstrip</genre>
562
				</xsl:when>
563
				<xsl:when test="$controlField008-33='g'">
564
					<genre authority="marc">legal article</genre>
565
				</xsl:when>
566
				<xsl:when test="$controlField008-33='i'">
567
					<genre authority="marc">picture</genre>
568
				</xsl:when>
569
				<xsl:when test="$controlField008-33='k'">
570
					<genre authority="marc">graphic</genre>
571
				</xsl:when>
572
				<xsl:when test="$controlField008-33='l'">
573
					<genre authority="marc">technical drawing</genre>
574
				</xsl:when>
575
				<xsl:when test="$controlField008-33='m'">
576
					<genre authority="marc">motion picture</genre>
577
				</xsl:when>
578
				<xsl:when test="$controlField008-33='n'">
579
					<genre authority="marc">chart</genre>
580
				</xsl:when>
581
				<xsl:when test="$controlField008-33='o'">
582
					<genre authority="marc">flash card</genre>
583
				</xsl:when>
584
				<xsl:when test="$controlField008-33='p'">
585
					<genre authority="marc">microscope slide</genre>
586
				</xsl:when>
587
				<xsl:when test="$controlField008-33='q' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']">
588
					<genre authority="marc">model</genre>
589
				</xsl:when>
590
				<xsl:when test="$controlField008-33='r'">
591
					<genre authority="marc">realia</genre>
592
				</xsl:when>
593
				<xsl:when test="$controlField008-33='s'">
594
					<genre authority="marc">slide</genre>
595
				</xsl:when>
596
				<xsl:when test="$controlField008-33='t'">
597
					<genre authority="marc">transparency</genre>
598
				</xsl:when>
599
				<xsl:when test="$controlField008-33='v'">
600
					<genre authority="marc">videorecording</genre>
601
				</xsl:when>
602
				<xsl:when test="$controlField008-33='w'">
603
					<genre authority="marc">toy</genre>
604
				</xsl:when>
605
			</xsl:choose>
606
		</xsl:if>
607
608
		<xsl:for-each select="marc:datafield[@tag=655]">
609
			<genre authority="marc">
610
				<xsl:attribute name="authority">
611
					<xsl:value-of select="marc:subfield[@code='2']"/>
612
				</xsl:attribute>
613
				<xsl:call-template name="subfieldSelect">
614
					<xsl:with-param name="codes">abvxyz</xsl:with-param>
615
					<xsl:with-param name="delimeter">-</xsl:with-param>
616
				</xsl:call-template>
617
			</genre>
618
		</xsl:for-each>
619
620
		<originInfo>
621
			<xsl:variable name="MARCpublicationCode" select="normalize-space(substring($controlField008,16,3))"/>
622
623
			<xsl:if test="translate($MARCpublicationCode,'|','')">
624
				<place>
625
					<placeTerm>
626
						<xsl:attribute name="type">code</xsl:attribute>
627
						<xsl:attribute name="authority">marccountry</xsl:attribute>
628
						<xsl:value-of select="$MARCpublicationCode"/>
629
					</placeTerm>
630
				</place>
631
			</xsl:if>
632
633
			<xsl:for-each select="marc:datafield[@tag=044]/marc:subfield[@code='c']">
634
				<place>
635
					<placeTerm>
636
						<xsl:attribute name="type">code</xsl:attribute>
637
						<xsl:attribute name="authority">iso3166</xsl:attribute>
638
						<xsl:value-of select="."/>
639
					</placeTerm>
640
				</place>
641
			</xsl:for-each>
642
643
			<xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='a']">
644
				<place>
645
					<placeTerm>
646
						<xsl:attribute name="type">text</xsl:attribute>
647
						<xsl:call-template name="chopPunctuationFront">
648
							<xsl:with-param name="chopString">
649
								<xsl:call-template name="chopPunctuation">
650
									<xsl:with-param name="chopString" select="."/>
651
								</xsl:call-template>
652
							</xsl:with-param>
653
						</xsl:call-template>
654
					</placeTerm>
655
				</place>
656
			</xsl:for-each>
657
658
			<xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='m']">
659
				<dateValid point="start">
660
					<xsl:value-of select="."/>
661
				</dateValid>
662
			</xsl:for-each>
663
			<xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='n']">
664
				<dateValid point="end">
665
					<xsl:value-of select="."/>
666
				</dateValid>
667
			</xsl:for-each>
668
			<xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='j']">
669
				<dateModified>
670
					<xsl:value-of select="."/>
671
				</dateModified>
672
			</xsl:for-each>
673
674
			<xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='b' or @code='c' or @code='g']">
675
				<xsl:choose>
676
					<xsl:when test="@code='b'">
677
						<publisher>
678
							<xsl:call-template name="chopPunctuation">
679
								<xsl:with-param name="chopString" select="."/>
680
								<xsl:with-param name="punctuation">
681
									<xsl:text>:,;/ </xsl:text>
682
								</xsl:with-param>
683
							</xsl:call-template>
684
						</publisher>
685
					</xsl:when>
686
					<xsl:when test="@code='c'">
687
						<dateIssued>
688
							<xsl:call-template name="chopPunctuation">
689
								<xsl:with-param name="chopString" select="."/>
690
							</xsl:call-template>
691
						</dateIssued>
692
					</xsl:when>
693
					<xsl:when test="@code='g'">
694
						<dateCreated>
695
							<xsl:value-of select="."/>
696
						</dateCreated>
697
					</xsl:when>
698
				</xsl:choose>
699
			</xsl:for-each>
700
701
			<xsl:variable name="dataField260c">
702
				<xsl:call-template name="chopPunctuation">
703
					<xsl:with-param name="chopString" select="marc:datafield[@tag=260]/marc:subfield[@code='c']"/>
704
				</xsl:call-template>
705
			</xsl:variable>
706
707
			<xsl:variable name="controlField008-7-10" select="normalize-space(substring($controlField008, 8, 4))"/>
708
			<xsl:variable name="controlField008-11-14" select="normalize-space(substring($controlField008, 12, 4))"/>
709
			<xsl:variable name="controlField008-6" select="normalize-space(substring($controlField008, 7, 1))"/>
710
711
			<xsl:if test="$controlField008-6='e' or $controlField008-6='p' or $controlField008-6='r' or $controlField008-6='t' or $controlField008-6='s'">
712
				<xsl:if test="$controlField008-7-10 and ($controlField008-7-10 != $dataField260c)">
713
					<dateIssued encoding="marc">
714
						<xsl:value-of select="$controlField008-7-10"/>
715
					</dateIssued>
716
				</xsl:if>
717
			</xsl:if>
718
719
			<xsl:if test="$controlField008-6='c' or $controlField008-6='d' or $controlField008-6='i' or $controlField008-6='k' or $controlField008-6='m' or $controlField008-6='q' or $controlField008-6='u'">
720
				<xsl:if test="$controlField008-7-10">
721
					<dateIssued encoding="marc" point="start">
722
						<xsl:value-of select="$controlField008-7-10"/>
723
					</dateIssued>
724
				</xsl:if>
725
			</xsl:if>
726
727
			<xsl:if test="$controlField008-6='c' or $controlField008-6='d' or $controlField008-6='i' or $controlField008-6='k' or $controlField008-6='m' or $controlField008-6='q' or $controlField008-6='u'">
728
				<xsl:if test="$controlField008-11-14">
729
					<dateIssued encoding="marc" point="end">
730
						<xsl:value-of select="$controlField008-11-14"/>
731
					</dateIssued>
732
				</xsl:if>
733
			</xsl:if>
734
735
			<xsl:if test="$controlField008-6='q'">
736
				<xsl:if test="$controlField008-7-10">
737
					<dateIssued encoding="marc" point="start" qualifier="questionable">
738
						<xsl:value-of select="$controlField008-7-10"/>
739
					</dateIssued>
740
				</xsl:if>
741
			</xsl:if>
742
743
			<xsl:if test="$controlField008-6='q'">
744
				<xsl:if test="$controlField008-11-14">
745
					<dateIssued encoding="marc" point="end" qualifier="questionable">
746
						<xsl:value-of select="$controlField008-11-14"/>
747
					</dateIssued>
748
				</xsl:if>
749
			</xsl:if>
750
751
			<xsl:if test="$controlField008-6='t'">
752
				<xsl:if test="$controlField008-11-14">
753
					<copyrightDate encoding="marc">
754
						<xsl:value-of select="$controlField008-11-14"/>
755
					</copyrightDate>
756
				</xsl:if>
757
			</xsl:if>
758
759
			<xsl:for-each select="marc:datafield[@tag=033][@ind1=0 or @ind1=1]/marc:subfield[@code='a']">
760
				<dateCaptured encoding="iso8601">
761
					<xsl:value-of select="."/>
762
				</dateCaptured>
763
			</xsl:for-each>
764
765
			<xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][1]">
766
				<dateCaptured encoding="iso8601" point="start">
767
					<xsl:value-of select="."/>
768
				</dateCaptured>
769
			</xsl:for-each>
770
771
			<xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][2]">
772
				<dateCaptured encoding="iso8601" point="end">
773
					<xsl:value-of select="."/>
774
				</dateCaptured>
775
			</xsl:for-each>
776
777
			<xsl:for-each select="marc:datafield[@tag=250]/marc:subfield[@code='a']">
778
				<edition>
779
					<xsl:value-of select="."/>
780
				</edition>
781
			</xsl:for-each>
782
783
			<xsl:for-each select="marc:leader">
784
				<issuance>
785
					<xsl:choose>
786
						<xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">monographic</xsl:when>
787
						<xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">continuing</xsl:when>
788
					</xsl:choose>
789
				</issuance>
790
			</xsl:for-each>
791
792
			<xsl:for-each select="marc:datafield[@tag=310]|marc:datafield[@tag=321]">
793
				<frequency>
794
					<xsl:call-template name="subfieldSelect">
795
						<xsl:with-param name="codes">ab</xsl:with-param>
796
					</xsl:call-template>
797
				</frequency>
798
			</xsl:for-each>
799
		</originInfo>
800
		<xsl:variable name="controlField008-35-37" select="normalize-space(translate(substring($controlField008,36,3),'|#',''))"/>
801
		<xsl:if test="$controlField008-35-37">
802
			<language>
803
				<languageTerm authority="iso639-2b" type="code">
804
					<xsl:value-of select="substring($controlField008,36,3)"/>
805
				</languageTerm>
806
			</language>
807
		</xsl:if>
808
809
		<xsl:for-each select="marc:datafield[@tag=041]">
810
811
			<!--			<xsl:variable name="langCodes">			
812
				<xsl:copy-of select="marc:subfield[@code='a'or @code='d' or @code='e' or @code='2']"/>
813
			</xsl:variable>
814
			-->
815
			<xsl:variable name="langCodes" select="marc:subfield[@code='a'or @code='d' or @code='e' or @code='2']"/>
816
817
			<xsl:choose>
818
				<xsl:when test="marc:subfield[@code='2']='rfc3066'">
819
					<!-- not stacked but could be repeated -->
820
					<xsl:call-template name="rfcLanguages">
821
						<xsl:with-param name="nodeNum">
822
							<xsl:value-of select="1"/>
823
						</xsl:with-param>
824
						<xsl:with-param name="usedLanguages">
825
							<xsl:text></xsl:text>
826
						</xsl:with-param>
827
						<xsl:with-param name="controlField008-35-37">
828
							<xsl:value-of select="$controlField008-35-37"/>
829
						</xsl:with-param>
830
					</xsl:call-template>
831
				</xsl:when>
832
				<xsl:otherwise>
833
					<!-- iso -->
834
					<xsl:variable name="allLanguages">
835
						<xsl:copy-of select="$langCodes"/>
836
					</xsl:variable>
837
					<xsl:variable name="currentLanguage">
838
						<xsl:value-of select="substring($allLanguages,1,3)"/>
839
					</xsl:variable>
840
					<xsl:call-template name="isoLanguage">
841
						<xsl:with-param name="currentLanguage">
842
							<xsl:value-of select="substring($allLanguages,1,3)"/>
843
						</xsl:with-param>
844
						<xsl:with-param name="remainingLanguages">
845
							<xsl:value-of select="substring($allLanguages,4,string-length($allLanguages)-3)"/>
846
						</xsl:with-param>
847
						<xsl:with-param name="usedLanguages">
848
							<xsl:if test="$controlField008-35-37">
849
								<xsl:value-of select="$controlField008-35-37"/>
850
							</xsl:if>
851
						</xsl:with-param>
852
					</xsl:call-template>
853
				</xsl:otherwise>
854
			</xsl:choose>
855
		</xsl:for-each>
856
857
		<xsl:variable name="physicalDescription">
858
			<xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='a' or substring(.,12,1)='b']">
859
				<digitalOrigin>reformatted digital</digitalOrigin>
860
			</xsl:if>
861
862
			<xsl:variable name="controlField008-23" select="substring($controlField008,24,1)"/>
863
			<xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/>
864
865
			<xsl:variable name="check008-23">
866
				<xsl:if test="$typeOf008='BK' or $typeOf008='MU' or $typeOf008='SE' or $typeOf008='MM'">
867
					<xsl:value-of select="true()"/>
868
				</xsl:if>
869
			</xsl:variable>
870
871
			<xsl:variable name="check008-29">
872
				<xsl:if test="$typeOf008='MP' or $typeOf008='VM'">
873
					<xsl:value-of select="true()"/>
874
				</xsl:if>
875
			</xsl:variable>
876
877
			<xsl:choose>
878
				<xsl:when test="($check008-23 and $controlField008-23='f') or ($check008-29 and $controlField008-29='f')">
879
					<form authority="marcform">braille</form>
880
				</xsl:when>
881
				<xsl:when test="($controlField008-23=' ' and ($leader6='c' or $leader6='d')) or (($typeOf008='BK' or $typeOf008='SE') and ($controlField008-23=' ' or $controlField008='r'))">
882
					<form authority="marcform">print</form>
883
				</xsl:when>
884
				<xsl:when test="$leader6 = 'm' or ($check008-23 and $controlField008-23='s') or ($check008-29 and $controlField008-29='s')">
885
					<form authority="marcform">electronic</form>
886
				</xsl:when>
887
				<xsl:when test="($check008-23 and $controlField008-23='b') or ($check008-29 and $controlField008-29='b')">
888
					<form authority="marcform">microfiche</form>
889
				</xsl:when>
890
				<xsl:when test="($check008-23 and $controlField008-23='a') or ($check008-29 and $controlField008-29='a')">
891
					<form authority="marcform">microfilm</form>
892
				</xsl:when>
893
			</xsl:choose>
894
			<!-- 1/04 fix -->
895
			<xsl:if test="marc:datafield[@tag=130]/marc:subfield[@code='h']">
896
				<form authority="gmd">
897
					<xsl:call-template name="chopBrackets">
898
						<xsl:with-param name="chopString">
899
							<xsl:value-of select="marc:datafield[@tag=130]/marc:subfield[@code='h']"/>
900
						</xsl:with-param>
901
					</xsl:call-template>
902
				</form>
903
			</xsl:if>
904
905
			<xsl:if test="marc:datafield[@tag=240]/marc:subfield[@code='h']">
906
				<form authority="gmd">
907
					<xsl:call-template name="chopBrackets">
908
						<xsl:with-param name="chopString">
909
							<xsl:value-of select="marc:datafield[@tag=240]/marc:subfield[@code='h']"/>
910
						</xsl:with-param>
911
					</xsl:call-template>
912
				</form>
913
			</xsl:if>
914
			<xsl:if test="marc:datafield[@tag=242]/marc:subfield[@code='h']">
915
				<form authority="gmd">
916
					<xsl:call-template name="chopBrackets">
917
						<xsl:with-param name="chopString">
918
							<xsl:value-of select="marc:datafield[@tag=242]/marc:subfield[@code='h']"/>
919
						</xsl:with-param>
920
					</xsl:call-template>
921
				</form>
922
			</xsl:if>
923
			<xsl:if test="marc:datafield[@tag=245]/marc:subfield[@code='h']">
924
				<form authority="gmd">
925
					<xsl:call-template name="chopBrackets">
926
						<xsl:with-param name="chopString">
927
							<xsl:value-of select="marc:datafield[@tag=245]/marc:subfield[@code='h']"/>
928
						</xsl:with-param>
929
					</xsl:call-template>
930
				</form>
931
			</xsl:if>
932
			<xsl:if test="marc:datafield[@tag=246]/marc:subfield[@code='h']">
933
				<form authority="gmd">
934
					<xsl:call-template name="chopBrackets">
935
						<xsl:with-param name="chopString">
936
							<xsl:value-of select="marc:datafield[@tag=246]/marc:subfield[@code='h']"/>
937
						</xsl:with-param>
938
					</xsl:call-template>
939
				</form>
940
			</xsl:if>
941
			<xsl:if test="marc:datafield[@tag=730]/marc:subfield[@code='h']">
942
				<form authority="gmd">
943
					<xsl:call-template name="chopBrackets">
944
						<xsl:with-param name="chopString">
945
							<xsl:value-of select="marc:datafield[@tag=730]/marc:subfield[@code='h']"/>
946
						</xsl:with-param>
947
					</xsl:call-template>
948
				</form>
949
			</xsl:if>
950
			<xsl:for-each select="marc:datafield[@tag=256]/marc:subfield[@code='a']">
951
				<form>
952
					<xsl:value-of select="."/>
953
				</form>
954
			</xsl:for-each>
955
956
			<xsl:for-each select="marc:controlfield[@tag=007][substring(text(),1,1)='c']">
957
				<xsl:choose>
958
					<xsl:when test="substring(text(),14,1)='a'">
959
						<reformattingQuality>access</reformattingQuality>
960
					</xsl:when>
961
					<xsl:when test="substring(text(),14,1)='p'">
962
						<reformattingQuality>preservation</reformattingQuality>
963
					</xsl:when>
964
					<xsl:when test="substring(text(),14,1)='r'">
965
						<reformattingQuality>replacement</reformattingQuality>
966
					</xsl:when>
967
				</xsl:choose>
968
			</xsl:for-each>
969
970
			<xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='q'][string-length(.)&gt;1]">
971
				<internetMediaType>
972
					<xsl:value-of select="."/>
973
				</internetMediaType>
974
			</xsl:for-each>
975
976
			<xsl:for-each select="marc:datafield[@tag=300]">
977
				<extent>
978
					<xsl:call-template name="subfieldSelect">
979
						<xsl:with-param name="codes">abce</xsl:with-param>
980
					</xsl:call-template>
981
				</extent>
982
			</xsl:for-each>
983
		</xsl:variable>
984
985
		<xsl:if test="string-length(normalize-space($physicalDescription))">
986
			<physicalDescription>
987
				<xsl:copy-of select="$physicalDescription"/>
988
			</physicalDescription>
989
		</xsl:if>
990
991
		<xsl:for-each select="marc:datafield[@tag=520]">
992
			<abstract>
993
				<xsl:call-template name="uri"/>
994
				<xsl:call-template name="subfieldSelect">
995
					<xsl:with-param name="codes">ab</xsl:with-param>
996
				</xsl:call-template>
997
			</abstract>
998
		</xsl:for-each>
999
1000
		<xsl:for-each select="marc:datafield[@tag=505]">
1001
			<tableOfContents>
1002
				<xsl:call-template name="uri"/>
1003
				<xsl:call-template name="subfieldSelect">
1004
					<xsl:with-param name="codes">agrt</xsl:with-param>
1005
				</xsl:call-template>
1006
			</tableOfContents>
1007
		</xsl:for-each>
1008
1009
		<xsl:for-each select="marc:datafield[@tag=521]">
1010
			<targetAudience>
1011
				<xsl:call-template name="subfieldSelect">
1012
					<xsl:with-param name="codes">ab</xsl:with-param>
1013
				</xsl:call-template>
1014
			</targetAudience>
1015
		</xsl:for-each>
1016
1017
		<xsl:if test="$typeOf008='BK' or $typeOf008='CF' or $typeOf008='MU' or $typeOf008='VM'">
1018
			<xsl:variable name="controlField008-22" select="substring($controlField008,23,1)"/>
1019
			<xsl:choose>
1020
				<!-- 01/04 fix -->
1021
				<xsl:when test="$controlField008-22='d'">
1022
					<targetAudience authority="marctarget">adolescent</targetAudience>
1023
				</xsl:when>
1024
				<xsl:when test="$controlField008-22='e'">
1025
					<targetAudience authority="marctarget">adult</targetAudience>
1026
				</xsl:when>
1027
				<xsl:when test="$controlField008-22='g'">
1028
					<targetAudience authority="marctarget">general</targetAudience>
1029
				</xsl:when>
1030
				<xsl:when test="$controlField008-22='b' or $controlField008-22='c' or $controlField008-22='j'">
1031
					<targetAudience authority="marctarget">juvenile</targetAudience>
1032
				</xsl:when>
1033
				<xsl:when test="$controlField008-22='a'">
1034
					<targetAudience authority="marctarget">preschool</targetAudience>
1035
				</xsl:when>
1036
				<xsl:when test="$controlField008-22='f'">
1037
					<targetAudience authority="marctarget">specialized</targetAudience>
1038
				</xsl:when>
1039
			</xsl:choose>
1040
		</xsl:if>
1041
1042
		<xsl:for-each select="marc:datafield[@tag=245]/marc:subfield[@code='c']">
1043
			<note type="statement of responsibility">
1044
				<xsl:value-of select="."/>
1045
			</note>
1046
		</xsl:for-each>
1047
1048
		<xsl:for-each select="marc:datafield[@tag=500]">
1049
			<note>
1050
				<xsl:value-of select="marc:subfield[@code='a']"/>
1051
				<xsl:call-template name="uri"/>
1052
			</note>
1053
		</xsl:for-each>
1054
1055
		<xsl:for-each select="marc:datafield[@tag=511]">
1056
			<note type="performers">
1057
				<xsl:call-template name="uri"/>
1058
				<xsl:value-of select="marc:subfield[@code='a']"/>
1059
			</note>
1060
		</xsl:for-each>
1061
1062
		<xsl:for-each select="marc:datafield[@tag=518]">
1063
			<note type="venue">
1064
				<xsl:call-template name="uri"/>
1065
				<xsl:value-of select="marc:subfield[@code='a']"/>
1066
			</note>
1067
		</xsl:for-each>
1068
1069
		<xsl:for-each select="marc:datafield[@tag=501 or @tag=502 or @tag=504 or @tag=506 or @tag=507 or @tag=508 or  @tag=513 or @tag=514 or @tag=515 or @tag=516 or @tag=522 or @tag=524 or @tag=525 or @tag=526 or @tag=530 or @tag=533 or @tag=534 or @tag=535 or @tag=536 or @tag=538 or @tag=540 or @tag=541 or @tag=544 or @tag=545 or @tag=546 or @tag=547 or @tag=550 or @tag=552 or @tag=555 or @tag=556 or @tag=561 or @tag=562 or @tag=565 or @tag=567 or @tag=580 or @tag=581 or @tag=583 or @tag=584 or @tag=585 or @tag=586]">
1070
			<note>
1071
				<xsl:call-template name="uri"/>
1072
				<xsl:variable name="str">
1073
					<xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1074
						<xsl:value-of select="."/>
1075
						<xsl:text> </xsl:text>
1076
					</xsl:for-each>
1077
				</xsl:variable>
1078
				<xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1079
			</note>
1080
		</xsl:for-each>
1081
1082
		<xsl:for-each select="marc:datafield[@tag=034][marc:subfield[@code='d' or @code='e' or @code='f' or @code='g']]">
1083
			<subject>
1084
				<cartographics>
1085
					<coordinates>
1086
						<xsl:call-template name="subfieldSelect">
1087
							<xsl:with-param name="codes">defg</xsl:with-param>
1088
						</xsl:call-template>
1089
					</coordinates>
1090
				</cartographics>
1091
			</subject>
1092
		</xsl:for-each>
1093
1094
		<xsl:for-each select="marc:datafield[@tag=043]">
1095
			<subject>
1096
				<xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']">
1097
					<geographicCode>
1098
						<xsl:attribute name="authority">
1099
							<xsl:if test="@code='a'">
1100
								<xsl:text>marcgac</xsl:text>
1101
							</xsl:if>
1102
							<xsl:if test="@code='b'">
1103
								<xsl:value-of select="following-sibling::marc:subfield[@code=2]"/>
1104
							</xsl:if>
1105
							<xsl:if test="@code='c'">
1106
								<xsl:text>iso3166</xsl:text>
1107
							</xsl:if>
1108
						</xsl:attribute>
1109
						<xsl:value-of select="self::marc:subfield"/>
1110
					</geographicCode>
1111
				</xsl:for-each>
1112
			</subject>
1113
		</xsl:for-each>
1114
1115
		<xsl:for-each select="marc:datafield[@tag=255]">
1116
			<subject>
1117
				<cartographics>
1118
					<xsl:for-each select="marc:subfield[@code='c']">
1119
						<coordinates>
1120
							<xsl:value-of select="."/>
1121
						</coordinates>
1122
					</xsl:for-each>
1123
					<xsl:for-each select="marc:subfield[@code='a']">
1124
						<scale>
1125
							<xsl:value-of select="."/>
1126
						</scale>
1127
					</xsl:for-each>
1128
					<xsl:for-each select="marc:subfield[@code='b']">
1129
						<projection>
1130
							<xsl:value-of select="."/>
1131
						</projection>
1132
					</xsl:for-each>
1133
				</cartographics>
1134
			</subject>
1135
		</xsl:for-each>
1136
1137
		<xsl:apply-templates select="marc:datafield[653 &gt;= @tag and @tag &gt;= 600]"/>
1138
1139
		<xsl:apply-templates select="marc:datafield[@tag=656]"/>
1140
1141
		<xsl:for-each select="marc:datafield[@tag=752]">
1142
			<subject>
1143
				<hierarchicalGeographic>
1144
					<xsl:for-each select="marc:subfield[@code='a']">
1145
						<country>
1146
							<xsl:call-template name="chopPunctuation">
1147
								<xsl:with-param name="chopString" select="."/>
1148
							</xsl:call-template>
1149
						</country>
1150
					</xsl:for-each>
1151
					<xsl:for-each select="marc:subfield[@code='b']">
1152
						<state>
1153
							<xsl:call-template name="chopPunctuation">
1154
								<xsl:with-param name="chopString" select="."/>
1155
							</xsl:call-template>
1156
						</state>
1157
					</xsl:for-each>
1158
					<xsl:for-each select="marc:subfield[@code='c']">
1159
						<county>
1160
							<xsl:call-template name="chopPunctuation">
1161
								<xsl:with-param name="chopString" select="."/>
1162
							</xsl:call-template>
1163
						</county>
1164
					</xsl:for-each>
1165
					<xsl:for-each select="marc:subfield[@code='d']">
1166
						<city>
1167
							<xsl:call-template name="chopPunctuation">
1168
								<xsl:with-param name="chopString" select="."/>
1169
							</xsl:call-template>
1170
						</city>
1171
					</xsl:for-each>
1172
				</hierarchicalGeographic>
1173
			</subject>
1174
		</xsl:for-each>
1175
1176
		<xsl:for-each select="marc:datafield[@tag=045][marc:subfield[@code='b']]">
1177
			<subject>
1178
1179
				<xsl:choose>
1180
1181
					<xsl:when test="@ind1=2">
1182
1183
						<temporal encoding="iso8601" point="start">
1184
							<xsl:call-template name="chopPunctuation">
1185
								<xsl:with-param name="chopString">
1186
									<xsl:value-of select="marc:subfield[@code='b'][1]"/>
1187
								</xsl:with-param>
1188
							</xsl:call-template>
1189
						</temporal>
1190
						<temporal encoding="iso8601" point="end">
1191
							<xsl:call-template name="chopPunctuation">
1192
								<xsl:with-param name="chopString">
1193
1194
1195
									<xsl:value-of select="marc:subfield[@code='b'][2]"/>
1196
								</xsl:with-param>
1197
							</xsl:call-template>
1198
						</temporal>
1199
					</xsl:when>
1200
					<xsl:otherwise>
1201
						<xsl:for-each select="marc:subfield[@code='b']">
1202
							<temporal encoding="iso8601">
1203
								<xsl:call-template name="chopPunctuation">
1204
									<xsl:with-param name="chopString" select="."/>
1205
								</xsl:call-template>
1206
							</temporal>
1207
						</xsl:for-each>
1208
					</xsl:otherwise>
1209
				</xsl:choose>
1210
			</subject>
1211
		</xsl:for-each>
1212
1213
		<xsl:for-each select="marc:datafield[@tag=050]">
1214
			<xsl:for-each select="marc:subfield[@code='b']">
1215
				<classification authority="lcc">
1216
					<xsl:value-of select="preceding-sibling::marc:subfield[@code='a'][1]"/>
1217
					<xsl:text> </xsl:text>
1218
					<xsl:value-of select="text()"/>
1219
				</classification>
1220
			</xsl:for-each>
1221
			<xsl:for-each select="marc:subfield[@code='a'][not(following-sibling::marc:subfield[@code='b'])]">
1222
				<classification authority="lcc">
1223
					<xsl:value-of select="text()"/>
1224
				</classification>
1225
			</xsl:for-each>
1226
		</xsl:for-each>
1227
1228
		<xsl:for-each select="marc:datafield[@tag=082]">
1229
			<classification authority="ddc">
1230
				<xsl:if test="marc:subfield[@code='2']">
1231
					<xsl:attribute name="edition">
1232
						<xsl:value-of select="marc:subfield[@code='2']"/>
1233
					</xsl:attribute>
1234
				</xsl:if>
1235
				<xsl:call-template name="subfieldSelect">
1236
					<xsl:with-param name="codes">ab</xsl:with-param>
1237
				</xsl:call-template>
1238
			</classification>
1239
		</xsl:for-each>
1240
1241
		<xsl:for-each select="marc:datafield[@tag=080]">
1242
			<classification authority="udc">
1243
				<xsl:call-template name="subfieldSelect">
1244
					<xsl:with-param name="codes">abx</xsl:with-param>
1245
				</xsl:call-template>
1246
			</classification>
1247
		</xsl:for-each>
1248
1249
		<xsl:for-each select="marc:datafield[@tag=060]">
1250
			<classification authority="nlm">
1251
				<xsl:call-template name="subfieldSelect">
1252
					<xsl:with-param name="codes">ab</xsl:with-param>
1253
				</xsl:call-template>
1254
			</classification>
1255
		</xsl:for-each>
1256
1257
		<xsl:for-each select="marc:datafield[@tag=086][@ind1=0]">
1258
			<classification authority="sudocs">
1259
				<xsl:value-of select="marc:subfield[@code='a']"/>
1260
			</classification>
1261
		</xsl:for-each>
1262
1263
		<xsl:for-each select="marc:datafield[@tag=086][@ind1=1]">
1264
			<classification authority="candoc">
1265
				<xsl:value-of select="marc:subfield[@code='a']"/>
1266
			</classification>
1267
		</xsl:for-each>
1268
1269
		<xsl:for-each select="marc:datafield[@tag=086]">
1270
			<classification>
1271
				<xsl:attribute name="authority">
1272
					<xsl:value-of select="marc:subfield[@code='2']"/>
1273
				</xsl:attribute>
1274
				<xsl:value-of select="marc:subfield[@code='a']"/>
1275
			</classification>
1276
		</xsl:for-each>
1277
1278
		<xsl:for-each select="marc:datafield[@tag=084]">
1279
			<classification>
1280
				<xsl:attribute name="authority">
1281
					<xsl:value-of select="marc:subfield[@code='2']"/>
1282
				</xsl:attribute>
1283
				<xsl:call-template name="subfieldSelect">
1284
					<xsl:with-param name="codes">ab</xsl:with-param>
1285
				</xsl:call-template>
1286
			</classification>
1287
		</xsl:for-each>
1288
1289
		<xsl:for-each select="marc:datafield[@tag=440]">
1290
			<relatedItem type="series">
1291
				<titleInfo>
1292
					<title>
1293
						<xsl:call-template name="chopPunctuation">
1294
							<xsl:with-param name="chopString">
1295
								<xsl:call-template name="subfieldSelect">
1296
									<xsl:with-param name="codes">av</xsl:with-param>
1297
								</xsl:call-template>
1298
							</xsl:with-param>
1299
						</xsl:call-template>
1300
					</title>
1301
					<xsl:call-template name="part"/>
1302
				</titleInfo>
1303
			</relatedItem>
1304
		</xsl:for-each>
1305
1306
		<xsl:for-each select="marc:datafield[@tag=490][@ind1=0]">
1307
			<relatedItem type="series">
1308
				<titleInfo>
1309
					<title>
1310
						<xsl:call-template name="chopPunctuation">
1311
							<xsl:with-param name="chopString">
1312
								<xsl:call-template name="subfieldSelect">
1313
									<xsl:with-param name="codes">av</xsl:with-param>
1314
								</xsl:call-template>
1315
							</xsl:with-param>
1316
						</xsl:call-template>
1317
					</title>
1318
					<xsl:call-template name="part"/>
1319
				</titleInfo>
1320
			</relatedItem>
1321
		</xsl:for-each>
1322
1323
		<xsl:for-each select="marc:datafield[@tag=510]">
1324
			<relatedItem type="isReferencedBy">
1325
				<note>
1326
					<xsl:call-template name="subfieldSelect">
1327
						<xsl:with-param name="codes">abcx3</xsl:with-param>
1328
					</xsl:call-template>
1329
				</note>
1330
			</relatedItem>
1331
		</xsl:for-each>
1332
1333
		<xsl:for-each select="marc:datafield[@tag=534]">
1334
			<relatedItem type="original">
1335
				<xsl:call-template name="relatedTitle"/>
1336
				<xsl:call-template name="relatedName"/>
1337
				<xsl:if test="marc:subfield[@code='b' or @code='c']">
1338
					<originInfo>
1339
						<xsl:for-each select="marc:subfield[@code='c']">
1340
							<publisher>
1341
								<xsl:value-of select="."/>
1342
							</publisher>
1343
						</xsl:for-each>
1344
						<xsl:for-each select="marc:subfield[@code='b']">
1345
							<edition>
1346
								<xsl:value-of select="."/>
1347
							</edition>
1348
						</xsl:for-each>
1349
					</originInfo>
1350
				</xsl:if>
1351
				<xsl:call-template name="relatedIdentifierISSN"/>
1352
				<xsl:for-each select="marc:subfield[@code='z']">
1353
					<identifier type="isbn">
1354
						<xsl:value-of select="."/>
1355
					</identifier>
1356
				</xsl:for-each>
1357
				<xsl:call-template name="relatedNote"/>
1358
			</relatedItem>
1359
		</xsl:for-each>
1360
1361
		<xsl:for-each select="marc:datafield[@tag=700][marc:subfield[@code='t']]">
1362
			<relatedItem>
1363
				<xsl:call-template name="constituentOrRelatedType"/>
1364
				<titleInfo>
1365
					<title>
1366
						<xsl:call-template name="chopPunctuation">
1367
							<xsl:with-param name="chopString">
1368
								<xsl:call-template name="specialSubfieldSelect">
1369
									<xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
1370
									<xsl:with-param name="axis">t</xsl:with-param>
1371
									<xsl:with-param name="afterCodes">g</xsl:with-param>
1372
								</xsl:call-template>
1373
							</xsl:with-param>
1374
						</xsl:call-template>
1375
					</title>
1376
					<xsl:call-template name="part"/>
1377
				</titleInfo>
1378
				<name type="personal">
1379
					<namePart>
1380
						<xsl:call-template name="specialSubfieldSelect">
1381
							<xsl:with-param name="anyCodes">aq</xsl:with-param>
1382
							<xsl:with-param name="axis">t</xsl:with-param>
1383
							<xsl:with-param name="beforeCodes">g</xsl:with-param>
1384
						</xsl:call-template>
1385
					</namePart>
1386
					<xsl:call-template name="termsOfAddress"/>
1387
					<xsl:call-template name="nameDate"/>
1388
					<xsl:call-template name="role"/>
1389
				</name>
1390
				<xsl:call-template name="relatedForm"/>
1391
				<xsl:call-template name="relatedIdentifierISSN"/>
1392
			</relatedItem>
1393
		</xsl:for-each>
1394
1395
		<xsl:for-each select="marc:datafield[@tag=710][marc:subfield[@code='t']]">
1396
			<relatedItem>
1397
				<xsl:call-template name="constituentOrRelatedType"/>
1398
				<titleInfo>
1399
					<title>
1400
						<xsl:call-template name="chopPunctuation">
1401
							<xsl:with-param name="chopString">
1402
								<xsl:call-template name="specialSubfieldSelect">
1403
									<xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
1404
									<xsl:with-param name="axis">t</xsl:with-param>
1405
									<xsl:with-param name="afterCodes">dg</xsl:with-param>
1406
								</xsl:call-template>
1407
							</xsl:with-param>
1408
						</xsl:call-template>
1409
					</title>
1410
					<xsl:call-template name="relatedPartNumName"/>
1411
				</titleInfo>
1412
				<name type="corporate">
1413
					<xsl:for-each select="marc:subfield[@code='a']">
1414
						<namePart>
1415
							<xsl:value-of select="."/>
1416
						</namePart>
1417
					</xsl:for-each>
1418
					<xsl:for-each select="marc:subfield[@code='b']">
1419
						<namePart>
1420
							<xsl:value-of select="."/>
1421
						</namePart>
1422
					</xsl:for-each>
1423
					<xsl:variable name="tempNamePart">
1424
						<xsl:call-template name="specialSubfieldSelect">
1425
							<xsl:with-param name="anyCodes">c</xsl:with-param>
1426
							<xsl:with-param name="axis">t</xsl:with-param>
1427
							<xsl:with-param name="beforeCodes">dgn</xsl:with-param>
1428
						</xsl:call-template>
1429
					</xsl:variable>
1430
					<xsl:if test="normalize-space($tempNamePart)">
1431
						<namePart>
1432
							<xsl:value-of select="$tempNamePart"/>
1433
						</namePart>
1434
					</xsl:if>
1435
					<xsl:call-template name="role"/>
1436
				</name>
1437
				<xsl:call-template name="relatedForm"/>
1438
				<xsl:call-template name="relatedIdentifierISSN"/>
1439
			</relatedItem>
1440
		</xsl:for-each>
1441
1442
		<xsl:for-each select="marc:datafield[@tag=711][marc:subfield[@code='t']]">
1443
			<relatedItem>
1444
				<xsl:call-template name="constituentOrRelatedType"/>
1445
				<titleInfo>
1446
					<title>
1447
						<xsl:call-template name="chopPunctuation">
1448
							<xsl:with-param name="chopString">
1449
								<xsl:call-template name="specialSubfieldSelect">
1450
									<xsl:with-param name="anyCodes">tfklsv</xsl:with-param>
1451
									<xsl:with-param name="axis">t</xsl:with-param>
1452
									<xsl:with-param name="afterCodes">g</xsl:with-param>
1453
								</xsl:call-template>
1454
							</xsl:with-param>
1455
						</xsl:call-template>
1456
					</title>
1457
					<xsl:call-template name="relatedPartNumName"/>
1458
				</titleInfo>
1459
				<name type="conference">
1460
					<namePart>
1461
						<xsl:call-template name="specialSubfieldSelect">
1462
							<xsl:with-param name="anyCodes">aqdc</xsl:with-param>
1463
							<xsl:with-param name="axis">t</xsl:with-param>
1464
							<xsl:with-param name="beforeCodes">gn</xsl:with-param>
1465
						</xsl:call-template>
1466
					</namePart>
1467
				</name>
1468
				<xsl:call-template name="relatedForm"/>
1469
				<xsl:call-template name="relatedIdentifierISSN"/>
1470
			</relatedItem>
1471
		</xsl:for-each>
1472
1473
		<xsl:for-each select="marc:datafield[@tag=730][@ind2=2]">
1474
			<relatedItem>
1475
				<xsl:call-template name="constituentOrRelatedType"/>
1476
				<titleInfo>
1477
					<title>
1478
						<xsl:call-template name="chopPunctuation">
1479
							<xsl:with-param name="chopString">
1480
								<xsl:call-template name="subfieldSelect">
1481
									<xsl:with-param name="codes">adfgklmorsv</xsl:with-param>
1482
								</xsl:call-template>
1483
							</xsl:with-param>
1484
						</xsl:call-template>
1485
					</title>
1486
					<xsl:call-template name="part"/>
1487
				</titleInfo>
1488
				<xsl:call-template name="relatedForm"/>
1489
				<xsl:call-template name="relatedIdentifierISSN"/>
1490
			</relatedItem>
1491
		</xsl:for-each>
1492
1493
		<xsl:for-each select="marc:datafield[@tag=740][@ind2=2]">
1494
			<relatedItem>
1495
				<xsl:call-template name="constituentOrRelatedType"/>
1496
				<titleInfo>
1497
					<title>
1498
						<xsl:call-template name="chopPunctuation">
1499
							<xsl:with-param name="chopString">
1500
								<xsl:value-of select="marc:subfield[@code='a']"/>
1501
							</xsl:with-param>
1502
						</xsl:call-template>
1503
					</title>
1504
					<xsl:call-template name="part"/>
1505
				</titleInfo>
1506
				<xsl:call-template name="relatedForm"/>
1507
			</relatedItem>
1508
		</xsl:for-each>
1509
1510
		<xsl:for-each select="marc:datafield[@tag=760]|marc:datafield[@tag=762]">
1511
			<relatedItem type="series">
1512
				<xsl:call-template name="relatedItem76X-78X"/>
1513
			</relatedItem>
1514
		</xsl:for-each>
1515
1516
		<xsl:for-each select="marc:datafield[@tag=765]|marc:datafield[@tag=767]|marc:datafield[@tag=777]|marc:datafield[@tag=787]">
1517
			<relatedItem>
1518
				<xsl:call-template name="relatedItem76X-78X"/>
1519
			</relatedItem>
1520
		</xsl:for-each>
1521
1522
		<xsl:for-each select="marc:datafield[@tag=775]">
1523
			<relatedItem type="otherVersion">
1524
				<xsl:call-template name="relatedItem76X-78X"/>
1525
			</relatedItem>
1526
		</xsl:for-each>
1527
1528
		<xsl:for-each select="marc:datafield[@tag=770]|marc:datafield[@tag=774]">
1529
			<relatedItem type="constituent">
1530
				<xsl:call-template name="relatedItem76X-78X"/>
1531
			</relatedItem>
1532
		</xsl:for-each>
1533
1534
		<xsl:for-each select="marc:datafield[@tag=772]|marc:datafield[@tag=773]">
1535
			<relatedItem type="host">
1536
				<xsl:call-template name="relatedItem76X-78X"/>
1537
			</relatedItem>
1538
		</xsl:for-each>
1539
1540
		<xsl:for-each select="marc:datafield[@tag=776]">
1541
			<relatedItem type="otherFormat">
1542
				<xsl:call-template name="relatedItem76X-78X"/>
1543
			</relatedItem>
1544
		</xsl:for-each>
1545
1546
		<xsl:for-each select="marc:datafield[@tag=780]">
1547
			<relatedItem type="preceding">
1548
				<xsl:call-template name="relatedItem76X-78X"/>
1549
			</relatedItem>
1550
		</xsl:for-each>
1551
1552
		<xsl:for-each select="marc:datafield[@tag=785]">
1553
			<relatedItem type="succeeding">
1554
				<xsl:call-template name="relatedItem76X-78X"/>
1555
			</relatedItem>
1556
		</xsl:for-each>
1557
1558
		<xsl:for-each select="marc:datafield[@tag=786]">
1559
			<relatedItem type="original">
1560
				<xsl:call-template name="relatedItem76X-78X"/>
1561
			</relatedItem>
1562
		</xsl:for-each>
1563
1564
		<xsl:for-each select="marc:datafield[@tag=800]">
1565
			<relatedItem type="series">
1566
				<titleInfo>
1567
					<title>
1568
						<xsl:call-template name="chopPunctuation">
1569
							<xsl:with-param name="chopString">
1570
								<xsl:call-template name="specialSubfieldSelect">
1571
									<xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
1572
									<xsl:with-param name="axis">t</xsl:with-param>
1573
									<xsl:with-param name="afterCodes">g</xsl:with-param>
1574
								</xsl:call-template>
1575
							</xsl:with-param>
1576
						</xsl:call-template>
1577
					</title>
1578
					<xsl:call-template name="part"/>
1579
				</titleInfo>
1580
				<name type="personal">
1581
					<namePart>
1582
						<xsl:call-template name="chopPunctuation">
1583
							<xsl:with-param name="chopString">
1584
								<xsl:call-template name="specialSubfieldSelect">
1585
									<xsl:with-param name="anyCodes">aq</xsl:with-param>
1586
									<xsl:with-param name="axis">t</xsl:with-param>
1587
									<xsl:with-param name="beforeCodes">g</xsl:with-param>
1588
								</xsl:call-template>
1589
							</xsl:with-param>
1590
						</xsl:call-template>
1591
					</namePart>
1592
					<xsl:call-template name="termsOfAddress"/>
1593
					<xsl:call-template name="nameDate"/>
1594
					<xsl:call-template name="role"/>
1595
				</name>
1596
				<xsl:call-template name="relatedForm"/>
1597
			</relatedItem>
1598
		</xsl:for-each>
1599
1600
		<xsl:for-each select="marc:datafield[@tag=810]">
1601
			<relatedItem type="series">
1602
				<titleInfo>
1603
					<title>
1604
						<xsl:call-template name="chopPunctuation">
1605
							<xsl:with-param name="chopString">
1606
								<xsl:call-template name="specialSubfieldSelect">
1607
									<xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
1608
									<xsl:with-param name="axis">t</xsl:with-param>
1609
									<xsl:with-param name="afterCodes">dg</xsl:with-param>
1610
								</xsl:call-template>
1611
							</xsl:with-param>
1612
						</xsl:call-template>
1613
					</title>
1614
					<xsl:call-template name="relatedPartNumName"/>
1615
				</titleInfo>
1616
				<name type="corporate">
1617
					<xsl:for-each select="marc:subfield[@code='a']">
1618
						<namePart>
1619
							<xsl:value-of select="."/>
1620
						</namePart>
1621
					</xsl:for-each>
1622
					<xsl:for-each select="marc:subfield[@code='b']">
1623
1624
						<namePart>
1625
							<xsl:value-of select="."/>
1626
						</namePart>
1627
					</xsl:for-each>
1628
					<namePart>
1629
						<xsl:call-template name="specialSubfieldSelect">
1630
							<xsl:with-param name="anyCodes">c</xsl:with-param>
1631
							<xsl:with-param name="axis">t</xsl:with-param>
1632
							<xsl:with-param name="beforeCodes">dgn</xsl:with-param>
1633
						</xsl:call-template>
1634
					</namePart>
1635
					<xsl:call-template name="role"/>
1636
				</name>
1637
				<xsl:call-template name="relatedForm"/>
1638
			</relatedItem>
1639
		</xsl:for-each>
1640
1641
		<xsl:for-each select="marc:datafield[@tag=811]">
1642
			<relatedItem type="series">
1643
				<titleInfo>
1644
					<title>
1645
						<xsl:call-template name="chopPunctuation">
1646
							<xsl:with-param name="chopString">
1647
								<xsl:call-template name="specialSubfieldSelect">
1648
									<xsl:with-param name="anyCodes">tfklsv</xsl:with-param>
1649
									<xsl:with-param name="axis">t</xsl:with-param>
1650
									<xsl:with-param name="afterCodes">g</xsl:with-param>
1651
								</xsl:call-template>
1652
							</xsl:with-param>
1653
						</xsl:call-template>
1654
					</title>
1655
					<xsl:call-template name="relatedPartNumName"/>
1656
				</titleInfo>
1657
				<name type="conference">
1658
					<namePart>
1659
						<xsl:call-template name="specialSubfieldSelect">
1660
							<xsl:with-param name="anyCodes">aqdc</xsl:with-param>
1661
							<xsl:with-param name="axis">t</xsl:with-param>
1662
							<xsl:with-param name="beforeCodes">gn</xsl:with-param>
1663
						</xsl:call-template>
1664
					</namePart>
1665
					<xsl:call-template name="role"/>
1666
				</name>
1667
				<xsl:call-template name="relatedForm"/>
1668
			</relatedItem>
1669
		</xsl:for-each>
1670
1671
		<xsl:for-each select="marc:datafield[@tag=830]">
1672
			<relatedItem type="series">
1673
				<titleInfo>
1674
					<title>
1675
						<xsl:call-template name="chopPunctuation">
1676
							<xsl:with-param name="chopString">
1677
								<xsl:call-template name="subfieldSelect">
1678
									<xsl:with-param name="codes">adfgklmorsv</xsl:with-param>
1679
								</xsl:call-template>
1680
							</xsl:with-param>
1681
						</xsl:call-template>
1682
					</title>
1683
					<xsl:call-template name="part"/>
1684
				</titleInfo>
1685
				<xsl:call-template name="relatedForm"/>
1686
			</relatedItem>
1687
		</xsl:for-each>
1688
1689
		<xsl:for-each select="marc:datafield[@tag=856][@ind2=2]/marc:subfield[@code='q']">
1690
			<relatedItem>
1691
				<internetMediaType>
1692
					<xsl:value-of select="."/>
1693
				</internetMediaType>
1694
			</relatedItem>
1695
		</xsl:for-each>
1696
1697
		<xsl:for-each select="marc:datafield[@tag=020]">
1698
			<identifier type="isbn">
1699
				<xsl:call-template name="isInvalid"/>
1700
				<xsl:value-of select="marc:subfield[@code='a']"/>
1701
			</identifier>
1702
		</xsl:for-each>
1703
1704
		<xsl:for-each select="marc:datafield[@tag=024][@ind1=0]">
1705
			<identifier type="isrc">
1706
				<xsl:call-template name="isInvalid"/>
1707
				<xsl:value-of select="marc:subfield[@code='a']"/>
1708
			</identifier>
1709
		</xsl:for-each>
1710
1711
		<xsl:for-each select="marc:datafield[@tag=024][@ind1=2]">
1712
			<identifier type="ismn">
1713
				<xsl:call-template name="isInvalid"/>
1714
				<xsl:value-of select="marc:subfield[@code='a']"/>
1715
			</identifier>
1716
		</xsl:for-each>
1717
1718
		<xsl:for-each select="marc:datafield[@tag=022]">
1719
			<identifier type="issn">
1720
				<xsl:call-template name="isInvalid"/>
1721
				<xsl:value-of select="marc:subfield[@code='a']"/>
1722
			</identifier>
1723
		</xsl:for-each>
1724
1725
		<xsl:for-each select="marc:datafield[@tag=010]">
1726
			<identifier type="lccn">
1727
				<xsl:call-template name="isInvalid"/>
1728
				<xsl:value-of select="normalize-space(marc:subfield[@code='a'])"/>
1729
			</identifier>
1730
		</xsl:for-each>
1731
1732
		<xsl:for-each select="marc:datafield[@tag=028]">
1733
			<identifier>
1734
				<xsl:call-template name="isInvalid"/>
1735
				<xsl:attribute name="type">
1736
					<xsl:choose>
1737
						<xsl:when test="@ind1=0">issue number</xsl:when>
1738
						<xsl:when test="@ind1=1">matrix number</xsl:when>
1739
						<xsl:when test="@ind1=2">music plate</xsl:when>
1740
						<xsl:when test="@ind1=3">music publisher</xsl:when>
1741
						<xsl:when test="@ind1=4">videorecording identifier</xsl:when>
1742
					</xsl:choose>
1743
				</xsl:attribute>
1744
				<xsl:call-template name="subfieldSelect">
1745
					<xsl:with-param name="codes">
1746
						<xsl:choose>
1747
							<xsl:when test="@ind1=0">ba</xsl:when>
1748
							<xsl:otherwise>ab</xsl:otherwise>
1749
						</xsl:choose>
1750
					</xsl:with-param>
1751
				</xsl:call-template>
1752
			</identifier>
1753
		</xsl:for-each>
1754
1755
		<xsl:for-each select="marc:datafield[@tag=024][@ind1='4']">
1756
			<identifier type="sici">
1757
				<xsl:call-template name="isInvalid"/>
1758
				<xsl:call-template name="subfieldSelect">
1759
					<xsl:with-param name="codes">ab</xsl:with-param>
1760
				</xsl:call-template>
1761
			</identifier>
1762
		</xsl:for-each>
1763
1764
		<xsl:for-each select="marc:datafield[@tag=037]">
1765
			<identifier type="stock number">
1766
				<xsl:call-template name="isInvalid"/>
1767
				<xsl:call-template name="subfieldSelect">
1768
					<xsl:with-param name="codes">ab</xsl:with-param>
1769
				</xsl:call-template>
1770
			</identifier>
1771
		</xsl:for-each>
1772
1773
		<xsl:for-each select="marc:datafield[@tag=856][marc:subfield[@code='u']]">
1774
			<identifier>
1775
				<xsl:attribute name="type">
1776
					<xsl:choose>
1777
						<xsl:when test="starts-with(marc:subfield[@code='u'],'urn:doi') or starts-with(marc:subfield[@code='u'],'doi')">doi</xsl:when>
1778
						<xsl:when test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl') or starts-with(marc:subfield[@code='u'],'http://hdl.loc.gov')">hdl</xsl:when>
1779
						<xsl:otherwise>uri</xsl:otherwise>
1780
					</xsl:choose>
1781
				</xsl:attribute>
1782
				<xsl:choose>
1783
					<xsl:when test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl') or starts-with(marc:subfield[@code='u'],'http://hdl.loc.gov') ">
1784
						<xsl:value-of select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))"/>
1785
					</xsl:when>
1786
					<xsl:otherwise>
1787
						<xsl:value-of select="marc:subfield[@code='u']"/>
1788
					</xsl:otherwise>
1789
				</xsl:choose>
1790
			</identifier>
1791
			<xsl:if test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl')">
1792
				<identifier type="hdl">
1793
					<xsl:if test="marc:subfield[@code='y' or @code='3' or @code='z']">
1794
						<xsl:attribute name="displayLabel">
1795
							<xsl:call-template name="subfieldSelect">
1796
								<xsl:with-param name="codes">y3z</xsl:with-param>
1797
							</xsl:call-template>
1798
						</xsl:attribute>
1799
					</xsl:if>
1800
					<xsl:value-of select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))"/>
1801
				</identifier>
1802
			</xsl:if>
1803
		</xsl:for-each>
1804
1805
		<xsl:for-each select="marc:datafield[@tag=024][@ind1=1]">
1806
			<identifier type="upc">
1807
				<xsl:call-template name="isInvalid"/>
1808
				<xsl:value-of select="marc:subfield[@code='a']"/>
1809
			</identifier>
1810
		</xsl:for-each>
1811
		<!-- 1/04 fix added $y -->
1812
		<xsl:for-each select="marc:datafield[@tag=856][marc:subfield[@code='u']]">
1813
			<location>
1814
				<url>
1815
					<xsl:if test="marc:subfield[@code='y' or @code='3']">
1816
						<xsl:attribute name="displayLabel">
1817
							<xsl:call-template name="subfieldSelect">
1818
								<xsl:with-param name="codes">y3</xsl:with-param>
1819
							</xsl:call-template>
1820
						</xsl:attribute>
1821
					</xsl:if>
1822
					<xsl:value-of select="marc:subfield[@code='u']"/>
1823
				</url>
1824
			</location>
1825
		</xsl:for-each>
1826
1827
		<xsl:for-each select="marc:datafield[@tag=852]">
1828
			<location>
1829
				<physicalLocation>
1830
					<xsl:call-template name="displayLabel"/>
1831
					<xsl:call-template name="subfieldSelect">
1832
						<xsl:with-param name="codes">abje</xsl:with-param>
1833
					</xsl:call-template>
1834
				</physicalLocation>
1835
			</location>
1836
		</xsl:for-each>
1837
1838
		<xsl:for-each select="marc:datafield[@tag=506]">
1839
			<accessCondition type="restrictionOnAccess">
1840
				<xsl:call-template name="subfieldSelect">
1841
					<xsl:with-param name="codes">abcd35</xsl:with-param>
1842
				</xsl:call-template>
1843
			</accessCondition>
1844
		</xsl:for-each>
1845
1846
		<xsl:for-each select="marc:datafield[@tag=540]">
1847
			<accessCondition type="useAndReproduction">
1848
				<xsl:call-template name="subfieldSelect">
1849
					<xsl:with-param name="codes">abcde35</xsl:with-param>
1850
				</xsl:call-template>
1851
			</accessCondition>
1852
		</xsl:for-each>
1853
1854
		<recordInfo>
1855
			<xsl:for-each select="marc:datafield[@tag=040]">
1856
				<recordContentSource authority="marcorg">
1857
					<xsl:value-of select="marc:subfield[@code='a']"/>
1858
				</recordContentSource>
1859
			</xsl:for-each>
1860
1861
			<xsl:for-each select="marc:controlfield[@tag=008]">
1862
				<recordCreationDate encoding="marc">
1863
					<xsl:value-of select="substring(.,1,6)"/>
1864
				</recordCreationDate>
1865
			</xsl:for-each>
1866
1867
			<xsl:for-each select="marc:controlfield[@tag=005]">
1868
				<recordChangeDate encoding="iso8601">
1869
					<xsl:value-of select="."/>
1870
				</recordChangeDate>
1871
			</xsl:for-each>
1872
1873
			<xsl:for-each select="marc:controlfield[@tag=001]">
1874
				<recordIdentifier>
1875
					<xsl:if test="../marc:controlfield[@tag=003]">
1876
						<xsl:attribute name="source">
1877
							<xsl:value-of select="../marc:controlfield[@tag=003]"/>
1878
						</xsl:attribute>
1879
					</xsl:if>
1880
					<xsl:value-of select="."/>
1881
				</recordIdentifier>
1882
			</xsl:for-each>
1883
1884
			<xsl:for-each select="marc:datafield[@tag=040]/marc:subfield[@code='b']">
1885
				<languageOfCataloging>
1886
					<languageTerm authority="iso639-2b" type="code">
1887
						<xsl:value-of select="."/>
1888
					</languageTerm>
1889
				</languageOfCataloging>
1890
			</xsl:for-each>
1891
		</recordInfo>
1892
	</xsl:template>
1893
1894
	<xsl:template name="displayForm">
1895
		<xsl:for-each select="marc:subfield[@code='c']">
1896
			<displayForm>
1897
				<xsl:value-of select="."/>
1898
			</displayForm>
1899
		</xsl:for-each>
1900
	</xsl:template>
1901
1902
	<xsl:template name="affiliation">
1903
		<xsl:for-each select="marc:subfield[@code='u']">
1904
			<affiliation>
1905
				<xsl:value-of select="."/>
1906
			</affiliation>
1907
		</xsl:for-each>
1908
	</xsl:template>
1909
1910
	<xsl:template name="uri">
1911
		<xsl:for-each select="marc:subfield[@code='u']">
1912
			<xsl:attribute name="xlink:href">
1913
				<xsl:value-of select="."/>
1914
			</xsl:attribute>
1915
		</xsl:for-each>
1916
	</xsl:template>
1917
1918
	<xsl:template name="role">
1919
		<xsl:for-each select="marc:subfield[@code='e']">
1920
			<role>
1921
				<roleTerm type="text">
1922
					<xsl:value-of select="."/>
1923
				</roleTerm>
1924
			</role>
1925
		</xsl:for-each>
1926
		<xsl:for-each select="marc:subfield[@code='4']">
1927
			<role>
1928
				<roleTerm authority="marcrelator" type="code">
1929
					<xsl:value-of select="."/>
1930
				</roleTerm>
1931
			</role>
1932
		</xsl:for-each>
1933
	</xsl:template>
1934
1935
	<xsl:template name="part">
1936
		<xsl:variable name="partNumber">
1937
			<xsl:call-template name="specialSubfieldSelect">
1938
				<xsl:with-param name="axis">n</xsl:with-param>
1939
				<xsl:with-param name="anyCodes">n</xsl:with-param>
1940
				<xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1941
			</xsl:call-template>
1942
		</xsl:variable>
1943
		<xsl:variable name="partName">
1944
			<xsl:call-template name="specialSubfieldSelect">
1945
				<xsl:with-param name="axis">p</xsl:with-param>
1946
				<xsl:with-param name="anyCodes">p</xsl:with-param>
1947
				<xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1948
			</xsl:call-template>
1949
		</xsl:variable>
1950
		<xsl:if test="string-length(normalize-space($partNumber))">
1951
			<partNumber>
1952
				<xsl:call-template name="chopPunctuation">
1953
					<xsl:with-param name="chopString" select="$partNumber"/>
1954
				</xsl:call-template>
1955
			</partNumber>
1956
		</xsl:if>
1957
		<xsl:if test="string-length(normalize-space($partName))">
1958
			<partName>
1959
				<xsl:call-template name="chopPunctuation">
1960
					<xsl:with-param name="chopString" select="$partName"/>
1961
				</xsl:call-template>
1962
			</partName>
1963
		</xsl:if>
1964
	</xsl:template>
1965
1966
	<xsl:template name="relatedPart">
1967
		<xsl:if test="@tag=773">
1968
			<xsl:for-each select="marc:subfield[@code='g']">
1969
				<part>
1970
					<text>
1971
						<xsl:value-of select="."/>
1972
					</text>
1973
				</part>
1974
			</xsl:for-each>
1975
			<xsl:for-each select="marc:subfield[@code='q']">
1976
				<part>
1977
					<xsl:call-template name="parsePart"/>
1978
				</part>
1979
			</xsl:for-each>
1980
		</xsl:if>
1981
	</xsl:template>
1982
1983
	<xsl:template name="relatedPartNumName">
1984
		<xsl:variable name="partNumber">
1985
			<xsl:call-template name="specialSubfieldSelect">
1986
				<xsl:with-param name="axis">g</xsl:with-param>
1987
				<xsl:with-param name="anyCodes">g</xsl:with-param>
1988
				<xsl:with-param name="afterCodes">pst</xsl:with-param>
1989
			</xsl:call-template>
1990
		</xsl:variable>
1991
		<xsl:variable name="partName">
1992
			<xsl:call-template name="specialSubfieldSelect">
1993
				<xsl:with-param name="axis">p</xsl:with-param>
1994
				<xsl:with-param name="anyCodes">p</xsl:with-param>
1995
				<xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1996
			</xsl:call-template>
1997
		</xsl:variable>
1998
		<xsl:if test="string-length(normalize-space($partNumber))">
1999
			<partNumber>
2000
				<xsl:value-of select="$partNumber"/>
2001
			</partNumber>
2002
		</xsl:if>
2003
		<xsl:if test="string-length(normalize-space($partName))">
2004
			<partName>
2005
				<xsl:value-of select="$partName"/>
2006
			</partName>
2007
		</xsl:if>
2008
	</xsl:template>
2009
2010
	<xsl:template name="relatedName">
2011
		<xsl:for-each select="marc:subfield[@code='a']">
2012
			<name>
2013
				<namePart>
2014
					<xsl:value-of select="."/>
2015
				</namePart>
2016
			</name>
2017
		</xsl:for-each>
2018
	</xsl:template>
2019
2020
	<xsl:template name="relatedForm">
2021
		<xsl:for-each select="marc:subfield[@code='h']">
2022
			<physicalDescription>
2023
				<form>
2024
					<xsl:value-of select="."/>
2025
				</form>
2026
			</physicalDescription>
2027
		</xsl:for-each>
2028
	</xsl:template>
2029
2030
	<xsl:template name="relatedExtent">
2031
		<xsl:for-each select="marc:subfield[@code='h']">
2032
			<physicalDescription>
2033
				<extent>
2034
					<xsl:value-of select="."/>
2035
				</extent>
2036
			</physicalDescription>
2037
		</xsl:for-each>
2038
	</xsl:template>
2039
2040
	<xsl:template name="relatedNote">
2041
		<xsl:for-each select="marc:subfield[@code='n']">
2042
			<note>
2043
				<xsl:value-of select="."/>
2044
			</note>
2045
		</xsl:for-each>
2046
	</xsl:template>
2047
2048
	<xsl:template name="relatedSubject">
2049
		<xsl:for-each select="marc:subfield[@code='j']">
2050
			<subject>
2051
				<temporal encoding="iso8601">
2052
					<xsl:call-template name="chopPunctuation">
2053
						<xsl:with-param name="chopString" select="."/>
2054
					</xsl:call-template>
2055
				</temporal>
2056
			</subject>
2057
		</xsl:for-each>
2058
	</xsl:template>
2059
2060
	<xsl:template name="relatedIdentifierISSN">
2061
		<xsl:for-each select="marc:subfield[@code='x']">
2062
			<identifier type="issn">
2063
				<xsl:value-of select="."/>
2064
			</identifier>
2065
		</xsl:for-each>
2066
	</xsl:template>
2067
2068
	<xsl:template name="relatedIdentifierLocal">
2069
		<xsl:for-each select="marc:subfield[@code='w']">
2070
			<identifier type="local">
2071
				<xsl:value-of select="."/>
2072
			</identifier>
2073
		</xsl:for-each>
2074
	</xsl:template>
2075
2076
	<xsl:template name="relatedIdentifier">
2077
		<xsl:for-each select="marc:subfield[@code='o']">
2078
			<identifier>
2079
				<xsl:value-of select="."/>
2080
			</identifier>
2081
		</xsl:for-each>
2082
	</xsl:template>
2083
2084
	<xsl:template name="relatedItem76X-78X">
2085
		<xsl:call-template name="displayLabel"/>
2086
		<xsl:call-template name="relatedTitle76X-78X"/>
2087
		<xsl:call-template name="relatedName"/>
2088
		<xsl:call-template name="relatedOriginInfo"/>
2089
		<xsl:call-template name="relatedLanguage"/>
2090
		<xsl:call-template name="relatedExtent"/>
2091
		<xsl:call-template name="relatedNote"/>
2092
		<xsl:call-template name="relatedSubject"/>
2093
		<xsl:call-template name="relatedIdentifier"/>
2094
		<xsl:call-template name="relatedIdentifierISSN"/>
2095
		<xsl:call-template name="relatedIdentifierLocal"/>
2096
		<xsl:call-template name="relatedPart"/>
2097
	</xsl:template>
2098
2099
	<xsl:template name="subjectGeographicZ">
2100
		<geographic>
2101
2102
2103
			<xsl:call-template name="chopPunctuation">
2104
				<xsl:with-param name="chopString" select="."/>
2105
			</xsl:call-template>
2106
		</geographic>
2107
	</xsl:template>
2108
2109
	<xsl:template name="subjectTemporalY">
2110
		<temporal>
2111
			<xsl:call-template name="chopPunctuation">
2112
				<xsl:with-param name="chopString" select="."/>
2113
			</xsl:call-template>
2114
		</temporal>
2115
	</xsl:template>
2116
2117
	<xsl:template name="subjectTopic">
2118
		<topic>
2119
			<xsl:call-template name="chopPunctuation">
2120
				<xsl:with-param name="chopString" select="."/>
2121
			</xsl:call-template>
2122
		</topic>
2123
	</xsl:template>
2124
2125
	<xsl:template name="nameABCDN">
2126
		<xsl:for-each select="marc:subfield[@code='a']">
2127
			<namePart>
2128
				<xsl:call-template name="chopPunctuation">
2129
					<xsl:with-param name="chopString" select="."/>
2130
				</xsl:call-template>
2131
			</namePart>
2132
		</xsl:for-each>
2133
		<xsl:for-each select="marc:subfield[@code='b']">
2134
			<namePart>
2135
				<xsl:value-of select="."/>
2136
			</namePart>
2137
		</xsl:for-each>
2138
		<xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
2139
			<namePart>
2140
				<xsl:call-template name="subfieldSelect">
2141
					<xsl:with-param name="codes">cdn</xsl:with-param>
2142
				</xsl:call-template>
2143
			</namePart>
2144
		</xsl:if>
2145
	</xsl:template>
2146
2147
	<xsl:template name="nameABCDQ">
2148
		<namePart>
2149
			<xsl:call-template name="chopPunctuation">
2150
				<xsl:with-param name="chopString">
2151
					<xsl:call-template name="subfieldSelect">
2152
						<xsl:with-param name="codes">aq</xsl:with-param>
2153
					</xsl:call-template>
2154
				</xsl:with-param>
2155
				<xsl:with-param name="punctuation">
2156
					<xsl:text>:,;/ </xsl:text>
2157
				</xsl:with-param>
2158
			</xsl:call-template>
2159
		</namePart>
2160
		<xsl:call-template name="termsOfAddress"/>
2161
		<xsl:call-template name="nameDate"/>
2162
	</xsl:template>
2163
2164
	<xsl:template name="nameACDEQ">
2165
		<namePart>
2166
			<xsl:call-template name="subfieldSelect">
2167
				<xsl:with-param name="codes">acdeq</xsl:with-param>
2168
			</xsl:call-template>
2169
		</namePart>
2170
	</xsl:template>
2171
2172
	<xsl:template name="constituentOrRelatedType">
2173
		<xsl:if test="@ind2=2">
2174
			<xsl:attribute name="type">constituent</xsl:attribute>
2175
		</xsl:if>
2176
	</xsl:template>
2177
2178
	<xsl:template name="relatedTitle">
2179
		<xsl:for-each select="marc:subfield[@code='t']">
2180
			<titleInfo>
2181
				<title>
2182
					<xsl:call-template name="chopPunctuation">
2183
						<xsl:with-param name="chopString">
2184
							<xsl:value-of select="."/>
2185
						</xsl:with-param>
2186
					</xsl:call-template>
2187
				</title>
2188
			</titleInfo>
2189
		</xsl:for-each>
2190
	</xsl:template>
2191
2192
	<xsl:template name="relatedTitle76X-78X">
2193
		<xsl:for-each select="marc:subfield[@code='t']">
2194
			<titleInfo>
2195
				<title>
2196
					<xsl:call-template name="chopPunctuation">
2197
						<xsl:with-param name="chopString">
2198
							<xsl:value-of select="."/>
2199
						</xsl:with-param>
2200
					</xsl:call-template>
2201
				</title>
2202
				<xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
2203
					<xsl:call-template name="relatedPartNumName"/>
2204
				</xsl:if>
2205
			</titleInfo>
2206
		</xsl:for-each>
2207
		<xsl:for-each select="marc:subfield[@code='p']">
2208
			<titleInfo type="abbreviated">
2209
				<title>
2210
					<xsl:call-template name="chopPunctuation">
2211
						<xsl:with-param name="chopString">
2212
							<xsl:value-of select="."/>
2213
						</xsl:with-param>
2214
					</xsl:call-template>
2215
				</title>
2216
				<xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
2217
					<xsl:call-template name="relatedPartNumName"/>
2218
				</xsl:if>
2219
			</titleInfo>
2220
		</xsl:for-each>
2221
		<xsl:for-each select="marc:subfield[@code='s']">
2222
			<titleInfo type="uniform">
2223
				<title>
2224
					<xsl:call-template name="chopPunctuation">
2225
						<xsl:with-param name="chopString">
2226
							<xsl:value-of select="."/>
2227
						</xsl:with-param>
2228
					</xsl:call-template>
2229
				</title>
2230
				<xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
2231
					<xsl:call-template name="relatedPartNumName"/>
2232
				</xsl:if>
2233
			</titleInfo>
2234
		</xsl:for-each>
2235
	</xsl:template>
2236
2237
	<xsl:template name="relatedOriginInfo">
2238
		<xsl:if test="marc:subfield[@code='b' or @code='d'] or marc:subfield[@code='f']">
2239
			<originInfo>
2240
				<xsl:if test="@tag=775">
2241
					<xsl:for-each select="marc:subfield[@code='f']">
2242
						<place>
2243
							<placeTerm>
2244
								<xsl:attribute name="type">code</xsl:attribute>
2245
								<xsl:attribute name="authority">marcgac</xsl:attribute>
2246
								<xsl:value-of select="."/>
2247
							</placeTerm>
2248
						</place>
2249
					</xsl:for-each>
2250
				</xsl:if>
2251
				<xsl:for-each select="marc:subfield[@code='d']">
2252
					<publisher>
2253
						<xsl:value-of select="."/>
2254
					</publisher>
2255
				</xsl:for-each>
2256
				<xsl:for-each select="marc:subfield[@code='b']">
2257
					<edition>
2258
						<xsl:value-of select="."/>
2259
					</edition>
2260
				</xsl:for-each>
2261
			</originInfo>
2262
		</xsl:if>
2263
	</xsl:template>
2264
2265
	<xsl:template name="relatedLanguage">
2266
		<xsl:for-each select="marc:subfield[@code='e']">
2267
			<xsl:call-template name="getLanguage">
2268
				<xsl:with-param name="langString">
2269
					<xsl:value-of select="."/>
2270
				</xsl:with-param>
2271
			</xsl:call-template>
2272
		</xsl:for-each>
2273
	</xsl:template>
2274
	<xsl:template name="nameDate">
2275
		<xsl:for-each select="marc:subfield[@code='d']">
2276
			<namePart type="date">
2277
				<xsl:call-template name="chopPunctuation">
2278
					<xsl:with-param name="chopString" select="."/>
2279
				</xsl:call-template>
2280
			</namePart>
2281
		</xsl:for-each>
2282
	</xsl:template>
2283
2284
	<xsl:template name="subjectAuthority">
2285
2286
		<xsl:if test="@ind2!=4">
2287
			<xsl:if test="@ind2!=' '">
2288
				<xsl:if test="@ind2!=8">
2289
					<xsl:if test="@ind2!=9">
2290
						<xsl:attribute name="authority">
2291
							<xsl:choose>
2292
2293
								<xsl:when test="@ind2=0">lcsh</xsl:when>
2294
								<xsl:when test="@ind2=1">lcshac</xsl:when>
2295
								<xsl:when test="@ind2=2">mesh</xsl:when>
2296
								<!-- 1/04 fix -->
2297
								<xsl:when test="@ind2=3">nal</xsl:when>
2298
								<xsl:when test="@ind2=5">csh</xsl:when>
2299
								<xsl:when test="@ind2=6">rvm</xsl:when>
2300
								<xsl:when test="@ind2=7">
2301
									<xsl:value-of select="marc:subfield[@code='2']"/>
2302
								</xsl:when>
2303
							</xsl:choose>
2304
						</xsl:attribute>
2305
					</xsl:if>
2306
				</xsl:if>
2307
			</xsl:if>
2308
		</xsl:if>
2309
	</xsl:template>
2310
2311
	<xsl:template name="subjectAnyOrder">
2312
		<xsl:for-each select="marc:subfield[@code='v' or @code='x' or @code='y' or @code='z']">
2313
			<xsl:choose>
2314
				<xsl:when test="@code='v'">
2315
					<xsl:call-template name="subjectTopic"/>
2316
				</xsl:when>
2317
				<xsl:when test="@code='x'">
2318
					<xsl:call-template name="subjectTopic"/>
2319
				</xsl:when>
2320
				<xsl:when test="@code='y'">
2321
					<xsl:call-template name="subjectTemporalY"/>
2322
				</xsl:when>
2323
				<xsl:when test="@code='z'">
2324
					<xsl:call-template name="subjectGeographicZ"/>
2325
				</xsl:when>
2326
			</xsl:choose>
2327
		</xsl:for-each>
2328
	</xsl:template>
2329
2330
	<xsl:template name="specialSubfieldSelect">
2331
		<xsl:param name="anyCodes"/>
2332
		<xsl:param name="axis"/>
2333
		<xsl:param name="beforeCodes"/>
2334
		<xsl:param name="afterCodes"/>
2335
		<xsl:variable name="str">
2336
			<xsl:for-each select="marc:subfield">
2337
				<xsl:if test="contains($anyCodes, @code)      or (contains($beforeCodes,@code) and following-sibling::marc:subfield[@code=$axis])      or (contains($afterCodes,@code) and preceding-sibling::marc:subfield[@code=$axis])">
2338
					<xsl:value-of select="text()"/>
2339
					<xsl:text> </xsl:text>
2340
				</xsl:if>
2341
			</xsl:for-each>
2342
		</xsl:variable>
2343
		<xsl:value-of select="substring($str,1,string-length($str)-1)"/>
2344
	</xsl:template>
2345
2346
	<xsl:template match="marc:datafield[@tag=600]">
2347
		<subject>
2348
			<xsl:call-template name="subjectAuthority"/>
2349
			<name type="personal">
2350
				<xsl:call-template name="termsOfAddress"/>
2351
				<namePart>
2352
					<xsl:call-template name="chopPunctuation">
2353
						<xsl:with-param name="chopString">
2354
							<xsl:call-template name="subfieldSelect">
2355
								<xsl:with-param name="codes">aq</xsl:with-param>
2356
							</xsl:call-template>
2357
						</xsl:with-param>
2358
					</xsl:call-template>
2359
				</namePart>
2360
				<xsl:call-template name="nameDate"/>
2361
				<xsl:call-template name="affiliation"/>
2362
				<xsl:call-template name="role"/>
2363
			</name>
2364
			<xsl:call-template name="subjectAnyOrder"/>
2365
		</subject>
2366
	</xsl:template>
2367
2368
	<xsl:template match="marc:datafield[@tag=610]">
2369
		<subject>
2370
			<xsl:call-template name="subjectAuthority"/>
2371
			<name type="corporate">
2372
				<xsl:for-each select="marc:subfield[@code='a']">
2373
					<namePart>
2374
						<xsl:value-of select="."/>
2375
					</namePart>
2376
				</xsl:for-each>
2377
				<xsl:for-each select="marc:subfield[@code='b']">
2378
					<namePart>
2379
						<xsl:value-of select="."/>
2380
					</namePart>
2381
				</xsl:for-each>
2382
				<xsl:if test="marc:subfield[@code='c' or @code='d' or @code='n' or @code='p']">
2383
					<namePart>
2384
						<xsl:call-template name="subfieldSelect">
2385
							<xsl:with-param name="codes">cdnp</xsl:with-param>
2386
						</xsl:call-template>
2387
					</namePart>
2388
				</xsl:if>
2389
				<xsl:call-template name="role"/>
2390
			</name>
2391
			<xsl:call-template name="subjectAnyOrder"/>
2392
		</subject>
2393
	</xsl:template>
2394
2395
	<xsl:template match="marc:datafield[@tag=611]">
2396
		<subject>
2397
			<xsl:call-template name="subjectAuthority"/>
2398
			<name type="conference">
2399
				<namePart>
2400
					<xsl:call-template name="subfieldSelect">
2401
						<xsl:with-param name="codes">abcdeqnp</xsl:with-param>
2402
					</xsl:call-template>
2403
				</namePart>
2404
				<xsl:for-each select="marc:subfield[@code='4']">
2405
					<role>
2406
						<roleTerm authority="marcrelator" type="code">
2407
							<xsl:value-of select="."/>
2408
						</roleTerm>
2409
					</role>
2410
				</xsl:for-each>
2411
			</name>
2412
			<xsl:call-template name="subjectAnyOrder"/>
2413
		</subject>
2414
	</xsl:template>
2415
2416
	<xsl:template match="marc:datafield[@tag=630]">
2417
		<subject>
2418
			<xsl:call-template name="subjectAuthority"/>
2419
			<titleInfo>
2420
				<title>
2421
					<xsl:call-template name="chopPunctuation">
2422
						<xsl:with-param name="chopString">
2423
							<xsl:call-template name="subfieldSelect">
2424
								<xsl:with-param name="codes">adfhklor</xsl:with-param>
2425
							</xsl:call-template>
2426
						</xsl:with-param>
2427
					</xsl:call-template>
2428
					<xsl:call-template name="part"/>
2429
				</title>
2430
			</titleInfo>
2431
			<xsl:call-template name="subjectAnyOrder"/>
2432
		</subject>
2433
	</xsl:template>
2434
2435
	<xsl:template match="marc:datafield[@tag=650]">
2436
		<subject>
2437
			<xsl:call-template name="subjectAuthority"/>
2438
			<topic>
2439
				<xsl:call-template name="chopPunctuation">
2440
					<xsl:with-param name="chopString">
2441
						<xsl:call-template name="subfieldSelect">
2442
							<xsl:with-param name="codes">abcd</xsl:with-param>
2443
						</xsl:call-template>
2444
					</xsl:with-param>
2445
				</xsl:call-template>
2446
			</topic>
2447
			<xsl:call-template name="subjectAnyOrder"/>
2448
		</subject>
2449
	</xsl:template>
2450
2451
	<xsl:template match="marc:datafield[@tag=651]">
2452
		<subject>
2453
			<xsl:call-template name="subjectAuthority"/>
2454
			<xsl:for-each select="marc:subfield[@code='a']">
2455
2456
				<geographic>
2457
					<xsl:call-template name="chopPunctuation">
2458
						<xsl:with-param name="chopString" select="."/>
2459
					</xsl:call-template>
2460
				</geographic>
2461
			</xsl:for-each>
2462
2463
			<xsl:call-template name="subjectAnyOrder"/>
2464
		</subject>
2465
	</xsl:template>
2466
2467
	<xsl:template match="marc:datafield[@tag=653]">
2468
		<subject>
2469
			<xsl:for-each select="marc:subfield[@code='a']">
2470
				<topic>
2471
					<xsl:value-of select="."/>
2472
				</topic>
2473
			</xsl:for-each>
2474
		</subject>
2475
	</xsl:template>
2476
2477
	<xsl:template match="marc:datafield[@tag=656]">
2478
		<subject>
2479
			<xsl:if test="marc:subfield[@code=2]">
2480
				<xsl:attribute name="authority">
2481
					<xsl:value-of select="marc:subfield[@code=2]"/>
2482
				</xsl:attribute>
2483
			</xsl:if>
2484
			<occupation>
2485
				<xsl:call-template name="chopPunctuation">
2486
					<xsl:with-param name="chopString">
2487
						<xsl:value-of select="marc:subfield[@code='a']"/>
2488
					</xsl:with-param>
2489
				</xsl:call-template>
2490
			</occupation>
2491
		</subject>
2492
	</xsl:template>
2493
2494
	<xsl:template name="termsOfAddress">
2495
		<xsl:if test="marc:subfield[@code='b' or @code='c']">
2496
			<namePart type="termsOfAddress">
2497
				<xsl:call-template name="chopPunctuation">
2498
					<xsl:with-param name="chopString">
2499
						<xsl:call-template name="subfieldSelect">
2500
							<xsl:with-param name="codes">bc</xsl:with-param>
2501
						</xsl:call-template>
2502
					</xsl:with-param>
2503
				</xsl:call-template>
2504
			</namePart>
2505
		</xsl:if>
2506
	</xsl:template>
2507
2508
	<xsl:template name="displayLabel">
2509
		<xsl:if test="marc:subfield[@code='i']">
2510
			<xsl:attribute name="displayLabel">
2511
				<xsl:value-of select="marc:subfield[@code='i']"/>
2512
			</xsl:attribute>
2513
		</xsl:if>
2514
		<xsl:if test="marc:subfield[@code='3']">
2515
			<xsl:attribute name="displayLabel">
2516
				<xsl:value-of select="marc:subfield[@code='3']"/>
2517
			</xsl:attribute>
2518
		</xsl:if>
2519
	</xsl:template>
2520
2521
	<xsl:template name="isInvalid">
2522
		<xsl:if test="marc:subfield[@code='z']">
2523
			<xsl:attribute name="invalid">yes</xsl:attribute>
2524
		</xsl:if>
2525
	</xsl:template>
2526
2527
	<xsl:template name="subtitle">
2528
		<xsl:if test="marc:subfield[@code='b']">
2529
			<subTitle>
2530
				<xsl:call-template name="chopPunctuation">
2531
					<xsl:with-param name="chopString">
2532
						<xsl:value-of select="marc:subfield[@code='b']"/>
2533
2534
						<!--<xsl:call-template name="subfieldSelect">
2535
							<xsl:with-param name="codes">b</xsl:with-param>									
2536
						</xsl:call-template>-->
2537
					</xsl:with-param>
2538
				</xsl:call-template>
2539
			</subTitle>
2540
		</xsl:if>
2541
	</xsl:template>
2542
2543
	<xsl:template name="script">
2544
		<xsl:param name="scriptCode"/>
2545
		<xsl:attribute name="script">
2546
			<xsl:choose>
2547
				<xsl:when test="$scriptCode='(3'">Arabic</xsl:when>
2548
				<xsl:when test="$scriptCode='(B'">Latin</xsl:when>
2549
				<xsl:when test="$scriptCode='$1'">Chinese, Japanese, Korean</xsl:when>
2550
				<xsl:when test="$scriptCode='(N'">Cyrillic</xsl:when>
2551
				<xsl:when test="$scriptCode='(2'">Hebrew</xsl:when>
2552
				<xsl:when test="$scriptCode='(S'">Greek</xsl:when>
2553
			</xsl:choose>
2554
		</xsl:attribute>
2555
	</xsl:template>
2556
2557
	<xsl:template name="parsePart">
2558
		<!-- assumes 773$q= 1:2:3<4
2559
		     with up to 3 levels and one optional start page
2560
		-->
2561
		<xsl:variable name="level1">
2562
			<xsl:choose>
2563
				<xsl:when test="contains(text(),':')">
2564
					<!-- 1:2 -->
2565
					<xsl:value-of select="substring-before(text(),':')"/>
2566
				</xsl:when>
2567
				<xsl:when test="not(contains(text(),':'))">
2568
					<!-- 1 or 1<3 -->
2569
					<xsl:if test="contains(text(),'&lt;')">
2570
						<!-- 1<3 -->
2571
						<xsl:value-of select="substring-before(text(),'&lt;')"/>
2572
					</xsl:if>
2573
					<xsl:if test="not(contains(text(),'&lt;'))">
2574
						<!-- 1 -->
2575
						<xsl:value-of select="text()"/>
2576
					</xsl:if>
2577
				</xsl:when>
2578
			</xsl:choose>
2579
		</xsl:variable>
2580
		<xsl:variable name="sici2">
2581
			<xsl:choose>
2582
				<xsl:when test="starts-with(substring-after(text(),$level1),':')">
2583
					<xsl:value-of select="substring(substring-after(text(),$level1),2)"/>
2584
				</xsl:when>
2585
				<xsl:otherwise>
2586
					<xsl:value-of select="substring-after(text(),$level1)"/>
2587
				</xsl:otherwise>
2588
			</xsl:choose>
2589
		</xsl:variable>
2590
		<xsl:variable name="level2">
2591
			<xsl:choose>
2592
				<xsl:when test="contains($sici2,':')">
2593
					<!--  2:3<4  -->
2594
					<xsl:value-of select="substring-before($sici2,':')"/>
2595
				</xsl:when>
2596
				<xsl:when test="contains($sici2,'&lt;')">
2597
					<!-- 1: 2<4 -->
2598
					<xsl:value-of select="substring-before($sici2,'&lt;')"/>
2599
				</xsl:when>
2600
				<xsl:otherwise>
2601
					<xsl:value-of select="$sici2"/>
2602
					<!-- 1:2 -->
2603
				</xsl:otherwise>
2604
			</xsl:choose>
2605
		</xsl:variable>
2606
		<xsl:variable name="sici3">
2607
			<xsl:choose>
2608
				<xsl:when test="starts-with(substring-after($sici2,$level2),':')">
2609
					<xsl:value-of select="substring(substring-after($sici2,$level2),2)"/>
2610
				</xsl:when>
2611
				<xsl:otherwise>
2612
					<xsl:value-of select="substring-after($sici2,$level2)"/>
2613
				</xsl:otherwise>
2614
			</xsl:choose>
2615
		</xsl:variable>
2616
		<xsl:variable name="level3">
2617
			<xsl:choose>
2618
				<xsl:when test="contains($sici3,'&lt;')">
2619
					<!-- 2<4 -->
2620
					<xsl:value-of select="substring-before($sici3,'&lt;')"/>
2621
				</xsl:when>
2622
				<xsl:otherwise>
2623
					<xsl:value-of select="$sici3"/>
2624
					<!-- 3 -->
2625
				</xsl:otherwise>
2626
			</xsl:choose>
2627
		</xsl:variable>
2628
		<xsl:variable name="page">
2629
			<xsl:if test="contains(text(),'&lt;')">
2630
				<xsl:value-of select="substring-after(text(),'&lt;')"/>
2631
			</xsl:if>
2632
		</xsl:variable>
2633
		<xsl:if test="$level1">
2634
			<detail level="1">
2635
				<number>
2636
					<xsl:value-of select="$level1"/>
2637
				</number>
2638
			</detail>
2639
		</xsl:if>
2640
		<xsl:if test="$level2">
2641
			<detail level="2">
2642
				<number>
2643
					<xsl:value-of select="$level2"/>
2644
				</number>
2645
			</detail>
2646
		</xsl:if>
2647
		<xsl:if test="$level3">
2648
			<detail level="3">
2649
				<number>
2650
					<xsl:value-of select="$level3"/>
2651
				</number>
2652
			</detail>
2653
		</xsl:if>
2654
		<xsl:if test="$page">
2655
			<extent unit="page">
2656
				<start>
2657
					<xsl:value-of select="$page"/>
2658
				</start>
2659
			</extent>
2660
		</xsl:if>
2661
	</xsl:template>
2662
2663
	<xsl:template name="getLanguage">
2664
		<xsl:param name="langString"/>
2665
		<xsl:param name="controlField008-35-37"/>
2666
		<xsl:variable name="length" select="string-length($langString)"/>
2667
		<xsl:choose>
2668
			<xsl:when test="$length=0"/>
2669
			<xsl:when test="$controlField008-35-37=substring($langString,1,3)">
2670
				<xsl:call-template name="getLanguage">
2671
					<xsl:with-param name="langString" select="substring($langString,4,$length)"/>
2672
					<xsl:with-param name="controlField008-35-37" select="$controlField008-35-37"/>
2673
				</xsl:call-template>
2674
			</xsl:when>
2675
			<xsl:otherwise>
2676
				<language>
2677
					<languageTerm authority="iso639-2b" type="code">
2678
						<xsl:value-of select="substring($langString,1,3)"/>
2679
					</languageTerm>
2680
				</language>
2681
				<xsl:call-template name="getLanguage">
2682
					<xsl:with-param name="langString" select="substring($langString,4,$length)"/>
2683
					<xsl:with-param name="controlField008-35-37" select="$controlField008-35-37"/>
2684
				</xsl:call-template>
2685
			</xsl:otherwise>
2686
		</xsl:choose>
2687
	</xsl:template>
2688
2689
	<xsl:template name="isoLanguage">
2690
		<xsl:param name="currentLanguage"/>
2691
		<xsl:param name="usedLanguages"/>
2692
		<xsl:param name="remainingLanguages"/>
2693
		<xsl:choose>
2694
			<xsl:when test="string-length($currentLanguage)=0"/>
2695
			<xsl:when test="not(contains($usedLanguages, $currentLanguage))">
2696
				<language>
2697
					<languageTerm authority="iso639-2b" type="code">
2698
						<xsl:value-of select="$currentLanguage"/>
2699
					</languageTerm>
2700
				</language>
2701
				<xsl:call-template name="isoLanguage">
2702
					<xsl:with-param name="currentLanguage">
2703
						<xsl:value-of select="substring($remainingLanguages,1,3)"/>
2704
					</xsl:with-param>
2705
					<xsl:with-param name="usedLanguages">
2706
						<xsl:value-of select="concat($usedLanguages,$currentLanguage)"/>
2707
					</xsl:with-param>
2708
					<xsl:with-param name="remainingLanguages">
2709
						<xsl:value-of select="substring($remainingLanguages,4,string-length($remainingLanguages))"/>
2710
					</xsl:with-param>
2711
				</xsl:call-template>
2712
			</xsl:when>
2713
			<xsl:otherwise>
2714
				<xsl:call-template name="isoLanguage">
2715
					<xsl:with-param name="currentLanguage">
2716
						<xsl:value-of select="substring($remainingLanguages,1,3)"/>
2717
					</xsl:with-param>
2718
					<xsl:with-param name="usedLanguages">
2719
						<xsl:value-of select="concat($usedLanguages,$currentLanguage)"/>
2720
					</xsl:with-param>
2721
					<xsl:with-param name="remainingLanguages">
2722
						<xsl:value-of select="substring($remainingLanguages,4,string-length($remainingLanguages))"/>
2723
					</xsl:with-param>
2724
				</xsl:call-template>
2725
			</xsl:otherwise>
2726
		</xsl:choose>
2727
	</xsl:template>
2728
2729
	<xsl:template name="chopBrackets">
2730
		<xsl:param name="chopString"/>
2731
		<xsl:variable name="string">
2732
			<xsl:call-template name="chopPunctuation">
2733
				<xsl:with-param name="chopString" select="$chopString"/>
2734
			</xsl:call-template>
2735
		</xsl:variable>
2736
		<xsl:if test="substring($string, 1,1)='['">
2737
			<xsl:value-of select="substring($string,2, string-length($string)-2)"/>
2738
		</xsl:if>
2739
		<xsl:if test="substring($string, 1,1)!='['">
2740
			<xsl:value-of select="$string"/>
2741
		</xsl:if>
2742
	</xsl:template>
2743
2744
	<xsl:template name="rfcLanguages">
2745
		<xsl:param name="nodeNum"/>
2746
		<xsl:param name="usedLanguages"/>
2747
		<xsl:param name="controlField008-35-37"/>
2748
		<!-- ??? xalan -->
2749
2750
		<xsl:variable name="currentLanguage" select="marc:subfield[position()=$nodeNum]/text()"/>
2751
		<xsl:choose>
2752
			<xsl:when test="not($currentLanguage)"/>
2753
			<xsl:when test="$currentLanguage!=$controlField008-35-37 and $currentLanguage!='rfc3066'">
2754
				<xsl:if test="not(contains($usedLanguages,$currentLanguage))">
2755
					<language>
2756
						<languageTerm authority="rfc3066" type="code">
2757
							<xsl:value-of select="$currentLanguage"/>
2758
						</languageTerm>
2759
					</language>
2760
				</xsl:if>
2761
				<xsl:call-template name="rfcLanguages">
2762
					<!-- ??? xalan -->
2763
					<xsl:with-param name="nodeNum">
2764
						<xsl:value-of select="$nodeNum+1"/>
2765
					</xsl:with-param>
2766
					<xsl:with-param name="usedLanguages">
2767
						<xsl:value-of select="concat($usedLanguages,'|',$currentLanguage)"/>
2768
					</xsl:with-param>
2769
					<xsl:with-param name="controlField008-35-37">
2770
						<xsl:value-of select="$controlField008-35-37"/>
2771
					</xsl:with-param>
2772
				</xsl:call-template>
2773
			</xsl:when>
2774
			<xsl:otherwise>
2775
				<xsl:call-template name="rfcLanguages">
2776
					<xsl:with-param name="nodeNum">
2777
						<xsl:value-of select="$nodeNum+1"/>
2778
					</xsl:with-param>
2779
					<xsl:with-param name="usedLanguages">
2780
						<xsl:value-of select="concat($usedLanguages,$currentLanguage)"/>
2781
					</xsl:with-param>
2782
					<xsl:with-param name="controlField008-35-37">
2783
						<xsl:value-of select="$controlField008-35-37"/>
2784
					</xsl:with-param>
2785
				</xsl:call-template>
2786
			</xsl:otherwise>
2787
		</xsl:choose>
2788
	</xsl:template>
2789
</xsl:stylesheet><!-- Stylus Studio meta-information - (c)1998-2003 Copyright Sonic Software Corporation. All rights reserved.
2790
<metaInformation>
2791
<scenarios ><scenario default="no" name="Apr 02 Test" userelativepaths="yes" externalpreview="no" url="file://n:\jackie\test_files\v3.xml" htmlbaseurl="" outputurl="file://n:\temp\x.xml" processortype="xalan" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="no" name="v3Test1" userelativepaths="yes" externalpreview="no" url="file://n:\jackie\test_files\v3.xml" htmlbaseurl="" outputurl="file://n:\jackie\test_files\modsv3Converted.xml" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="no" name="Scenario1" userelativepaths="yes" externalpreview="no" url="file://n:\ckeith\DESKTOP\test.xml" htmlbaseurl="" outputurl="" processortype="xalan" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="yes" name="Test" userelativepaths="yes" externalpreview="no" url="file://n:\jackie\MARCXML\marcxmlfile.xml" htmlbaseurl="" outputurl="" processortype="xalan" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/></scenarios><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
2792
</metaInformation>
2793
-->
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2MODS32.xsl (-3009 lines)
Lines 1-3008 Link Here
1
<!DOCTYPE stylesheet>
2
<xsl:stylesheet xmlns="http://www.loc.gov/mods/v3" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xlink marc" version="1.0">
3
	<xsl:include href="MARC21slimUtils.xsl"/>
4
	<xsl:output encoding="UTF-8" indent="yes" method="xml"/>
5
<!--
6
Revision 1.14 - Fixed template isValid and fields 010, 020, 022, 024, 028, and 037 to output additional identifier elements 
7
  with corresponding @type and @invalid == 'yes' when subfields z or y (in the case of 022) exist in the MARCXML ::: 2007/01/04 17:35:20 cred
8
9
Revision 1.13 - Changed order of output under cartographics to reflect schema  2006/11/28 tmee
10
	
11
Revision 1.12 - Updated to reflect MODS 3.2 Mapping  2006/10/11 tmee
12
		
13
Revision 1.11 - The attribute objectPart moved from <languageTerm> to <language>
14
      2006/04/08  jrad
15
16
Revision 1.10 MODS 3.1 revisions to language and classification elements  
17
				(plus ability to find marc:collection embedded in wrapper elements such as SRU zs: wrappers)
18
				2006/02/06  ggar
19
20
Revision 1.9 subfield $y was added to field 242 2004/09/02 10:57 jrad
21
22
Revision 1.8 Subject chopPunctuation expanded and attribute fixes 2004/08/12 jrad
23
24
Revision 1.7 2004/03/25 08:29 jrad
25
26
Revision 1.6 various validation fixes 2004/02/20 ntra
27
28
Revision 1.5  2003/10/02 16:18:58  ntra
29
MODS2 to MODS3 updates, language unstacking and 
30
de-duping, chopPunctuation expanded
31
32
Revision 1.3  2003/04/03 00:07:19  ntra
33
Revision 1.3 Additional Changes not related to MODS Version 2.0 by ntra
34
35
Revision 1.2  2003/03/24 19:37:42  ckeith
36
Added Log Comment
37
38
-->
39
	<xsl:template match="/">
40
		<xsl:choose>
41
			<xsl:when test="//marc:collection">
42
				<modsCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-2.xsd">
43
					<xsl:for-each select="//marc:collection/marc:record">
44
						<mods version="3.2">
45
							<xsl:call-template name="marcRecord"/>
46
						</mods>
47
					</xsl:for-each>
48
				</modsCollection>
49
			</xsl:when>
50
			<xsl:otherwise>
51
				<mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.2" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-2.xsd">
52
					<xsl:for-each select="//marc:record">
53
						<xsl:call-template name="marcRecord"/>
54
					</xsl:for-each>
55
				</mods>
56
			</xsl:otherwise>
57
		</xsl:choose>
58
	</xsl:template>
59
	<xsl:template name="marcRecord">
60
		<xsl:variable name="leader" select="marc:leader"/>
61
		<xsl:variable name="leader6" select="substring($leader,7,1)"/>
62
		<xsl:variable name="leader7" select="substring($leader,8,1)"/>
63
		<xsl:variable name="controlField008" select="marc:controlfield[@tag='008']"/>
64
		<xsl:variable name="typeOf008">
65
			<xsl:choose>
66
				<xsl:when test="$leader6='a'">
67
					<xsl:choose>
68
						<xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
69
						<xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">SE</xsl:when>
70
					</xsl:choose>
71
				</xsl:when>
72
				<xsl:when test="$leader6='t'">BK</xsl:when>
73
				<xsl:when test="$leader6='p'">MM</xsl:when>
74
				<xsl:when test="$leader6='m'">CF</xsl:when>
75
				<xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
76
				<xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">VM</xsl:when>
77
				<xsl:when test="$leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'">MU</xsl:when>
78
			</xsl:choose>
79
		</xsl:variable>
80
		<xsl:for-each select="marc:datafield[@tag='245']">
81
			<titleInfo>
82
				<xsl:variable name="title">
83
					<xsl:choose>
84
						<xsl:when test="marc:subfield[@code='b']">
85
							<xsl:call-template name="specialSubfieldSelect">
86
								<xsl:with-param name="axis">b</xsl:with-param>
87
								<xsl:with-param name="beforeCodes">afgk</xsl:with-param>
88
							</xsl:call-template>
89
						</xsl:when>
90
						<xsl:otherwise>
91
							<xsl:call-template name="subfieldSelect">
92
								<xsl:with-param name="codes">abfgk</xsl:with-param>
93
							</xsl:call-template>
94
						</xsl:otherwise>
95
					</xsl:choose>
96
				</xsl:variable>
97
				<xsl:variable name="titleChop">
98
					<xsl:call-template name="chopPunctuation">
99
						<xsl:with-param name="chopString">
100
							<xsl:value-of select="$title"/>
101
						</xsl:with-param>
102
					</xsl:call-template>
103
				</xsl:variable>
104
				<xsl:choose>
105
					<xsl:when test="@ind2>0">
106
						<nonSort>
107
							<xsl:value-of select="substring($titleChop,1,@ind2)"/>
108
						</nonSort>
109
						<title>
110
							<xsl:value-of select="substring($titleChop,@ind2+1)"/>
111
						</title>
112
					</xsl:when>
113
					<xsl:otherwise>
114
						<title>
115
							<xsl:value-of select="$titleChop"/>
116
						</title>
117
					</xsl:otherwise>
118
				</xsl:choose>
119
				<xsl:if test="marc:subfield[@code='b']">
120
					<subTitle>
121
						<xsl:call-template name="chopPunctuation">
122
							<xsl:with-param name="chopString">
123
								<xsl:call-template name="specialSubfieldSelect">
124
									<xsl:with-param name="axis">b</xsl:with-param>
125
									<xsl:with-param name="anyCodes">b</xsl:with-param>
126
									<xsl:with-param name="afterCodes">afgk</xsl:with-param>
127
								</xsl:call-template>
128
							</xsl:with-param>
129
						</xsl:call-template>
130
					</subTitle>
131
				</xsl:if>
132
				<xsl:call-template name="part"></xsl:call-template>
133
			</titleInfo>
134
		</xsl:for-each>
135
		<xsl:for-each select="marc:datafield[@tag='210']">
136
			<titleInfo type="abbreviated">
137
				<title>
138
					<xsl:call-template name="chopPunctuation">
139
						<xsl:with-param name="chopString">
140
							<xsl:call-template name="subfieldSelect">
141
								<xsl:with-param name="codes">a</xsl:with-param>
142
							</xsl:call-template>
143
						</xsl:with-param>
144
					</xsl:call-template>
145
				</title>
146
				<xsl:call-template name="subtitle"/>
147
			</titleInfo>
148
		</xsl:for-each>
149
		<xsl:for-each select="marc:datafield[@tag='242']">
150
			<titleInfo type="translated">
151
				<!--09/01/04 Added subfield $y-->
152
				<xsl:for-each select="marc:subfield[@code='y']">
153
					<xsl:attribute name="lang">
154
						<xsl:value-of select="text()"/>
155
					</xsl:attribute>
156
				</xsl:for-each>
157
				<title>
158
					<xsl:call-template name="chopPunctuation">
159
						<xsl:with-param name="chopString">
160
							<xsl:call-template name="subfieldSelect">
161
								<!-- 1/04 removed $h, b -->
162
								<xsl:with-param name="codes">a</xsl:with-param>
163
							</xsl:call-template>
164
						</xsl:with-param>
165
					</xsl:call-template>
166
				</title>
167
				<!-- 1/04 fix -->
168
				<xsl:call-template name="subtitle"/>
169
				<xsl:call-template name="part"/>
170
			</titleInfo>
171
		</xsl:for-each>
172
		<xsl:for-each select="marc:datafield[@tag='246']">
173
			<titleInfo type="alternative">
174
				<xsl:for-each select="marc:subfield[@code='i']">
175
					<xsl:attribute name="displayLabel">
176
						<xsl:value-of select="text()"/>
177
					</xsl:attribute>
178
				</xsl:for-each>
179
				<title>
180
					<xsl:call-template name="chopPunctuation">
181
						<xsl:with-param name="chopString">
182
							<xsl:call-template name="subfieldSelect">
183
								<!-- 1/04 removed $h, $b -->
184
								<xsl:with-param name="codes">af</xsl:with-param>
185
							</xsl:call-template>
186
						</xsl:with-param>
187
					</xsl:call-template>
188
				</title>
189
				<xsl:call-template name="subtitle"/>
190
				<xsl:call-template name="part"/>
191
			</titleInfo>
192
		</xsl:for-each>
193
		<xsl:for-each select="marc:datafield[@tag='130']|marc:datafield[@tag='240']|marc:datafield[@tag='730'][@ind2!='2']">
194
			<titleInfo type="uniform">
195
				<title>
196
					<xsl:variable name="str">
197
						<xsl:for-each select="marc:subfield">
198
							<xsl:if test="(contains('adfklmor',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))">
199
								<xsl:value-of select="text()"/>
200
								<xsl:text> </xsl:text>
201
							</xsl:if>
202
						</xsl:for-each>
203
					</xsl:variable>
204
					<xsl:call-template name="chopPunctuation">
205
						<xsl:with-param name="chopString">
206
							<xsl:value-of select="substring($str,1,string-length($str)-1)"/>
207
						</xsl:with-param>
208
					</xsl:call-template>
209
				</title>
210
				<xsl:call-template name="part"/>
211
			</titleInfo>
212
		</xsl:for-each>
213
		<xsl:for-each select="marc:datafield[@tag='740'][@ind2!='2']">
214
			<titleInfo type="alternative">
215
				<title>
216
					<xsl:call-template name="chopPunctuation">
217
						<xsl:with-param name="chopString">
218
							<xsl:call-template name="subfieldSelect">
219
								<xsl:with-param name="codes">ah</xsl:with-param>
220
							</xsl:call-template>
221
						</xsl:with-param>
222
					</xsl:call-template>
223
				</title>
224
				<xsl:call-template name="part"/>
225
			</titleInfo>
226
		</xsl:for-each>
227
		<xsl:for-each select="marc:datafield[@tag='100']">
228
			<name type="personal">
229
				<xsl:call-template name="nameABCDQ"/>
230
				<xsl:call-template name="affiliation"/>
231
				<role>
232
					<roleTerm authority="marcrelator" type="text">creator</roleTerm>
233
				</role>
234
				<xsl:call-template name="role"/>
235
			</name>
236
		</xsl:for-each>
237
		<xsl:for-each select="marc:datafield[@tag='110']">
238
			<name type="corporate">
239
				<xsl:call-template name="nameABCDN"/>
240
				<role>
241
					<roleTerm authority="marcrelator" type="text">creator</roleTerm>
242
				</role>
243
				<xsl:call-template name="role"/>
244
			</name>
245
		</xsl:for-each>
246
		<xsl:for-each select="marc:datafield[@tag='111']">
247
			<name type="conference">
248
				<xsl:call-template name="nameACDEQ"/>
249
				<role>
250
					<roleTerm authority="marcrelator" type="text">creator</roleTerm>
251
				</role>
252
				<xsl:call-template name="role"/>
253
			</name>
254
		</xsl:for-each>
255
		<xsl:for-each select="marc:datafield[@tag='700'][not(marc:subfield[@code='t'])]">
256
			<name type="personal">
257
				<xsl:call-template name="nameABCDQ"/>
258
				<xsl:call-template name="affiliation"/>
259
				<xsl:call-template name="role"/>
260
			</name>
261
		</xsl:for-each>
262
		<xsl:for-each select="marc:datafield[@tag='710'][not(marc:subfield[@code='t'])]">
263
			<name type="corporate">
264
				<xsl:call-template name="nameABCDN"/>
265
				<xsl:call-template name="role"/>
266
			</name>
267
		</xsl:for-each>
268
		<xsl:for-each select="marc:datafield[@tag='711'][not(marc:subfield[@code='t'])]">
269
			<name type="conference">
270
				<xsl:call-template name="nameACDEQ"/>
271
				<xsl:call-template name="role"/>
272
			</name>
273
		</xsl:for-each>
274
		<xsl:for-each select="marc:datafield[@tag='720'][not(marc:subfield[@code='t'])]">
275
			<name>
276
				<xsl:if test="@ind1=1">
277
					<xsl:attribute name="type">
278
						<xsl:text>personal</xsl:text>
279
					</xsl:attribute>
280
				</xsl:if>
281
				<namePart>
282
					<xsl:value-of select="marc:subfield[@code='a']"/>
283
				</namePart>
284
				<xsl:call-template name="role"/>
285
			</name>
286
		</xsl:for-each>
287
		<typeOfResource>
288
			<xsl:if test="$leader7='c'">
289
				<xsl:attribute name="collection">yes</xsl:attribute>
290
			</xsl:if>
291
			<xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'">
292
				<xsl:attribute name="manuscript">yes</xsl:attribute>
293
			</xsl:if>
294
			<xsl:choose>
295
				<xsl:when test="$leader6='a' or $leader6='t'">text</xsl:when>
296
				<xsl:when test="$leader6='e' or $leader6='f'">cartographic</xsl:when>
297
				<xsl:when test="$leader6='c' or $leader6='d'">notated music</xsl:when>
298
				<xsl:when test="$leader6='i'">sound recording-nonmusical</xsl:when>
299
				<xsl:when test="$leader6='j'">sound recording-musical</xsl:when>
300
				<xsl:when test="$leader6='k'">still image</xsl:when>
301
				<xsl:when test="$leader6='g'">moving image</xsl:when>
302
				<xsl:when test="$leader6='r'">three dimensional object</xsl:when>
303
				<xsl:when test="$leader6='m'">software, multimedia</xsl:when>
304
				<xsl:when test="$leader6='p'">mixed material</xsl:when>
305
			</xsl:choose>
306
		</typeOfResource>
307
		<xsl:if test="substring($controlField008,26,1)='d'">
308
			<genre authority="marc">globe</genre>
309
		</xsl:if>
310
		<xsl:if test="marc:controlfield[@tag='007'][substring(text(),1,1)='a'][substring(text(),2,1)='r']">
311
			<genre authority="marc">remote sensing image</genre>
312
		</xsl:if>
313
		<xsl:if test="$typeOf008='MP'">
314
			<xsl:variable name="controlField008-25" select="substring($controlField008,26,1)"></xsl:variable>
315
			<xsl:choose>
316
				<xsl:when test="$controlField008-25='a' or $controlField008-25='b' or $controlField008-25='c' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='j']">
317
					<genre authority="marc">map</genre>
318
				</xsl:when>
319
				<xsl:when test="$controlField008-25='e' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']">
320
					<genre authority="marc">atlas</genre>
321
				</xsl:when>
322
			</xsl:choose>
323
		</xsl:if>
324
		<xsl:if test="$typeOf008='SE'">
325
			<xsl:variable name="controlField008-21" select="substring($controlField008,22,1)"></xsl:variable>
326
			<xsl:choose>
327
				<xsl:when test="$controlField008-21='d'">
328
					<genre authority="marc">database</genre>
329
				</xsl:when>
330
				<xsl:when test="$controlField008-21='l'">
331
					<genre authority="marc">loose-leaf</genre>
332
				</xsl:when>
333
				<xsl:when test="$controlField008-21='m'">
334
					<genre authority="marc">series</genre>
335
				</xsl:when>
336
				<xsl:when test="$controlField008-21='n'">
337
					<genre authority="marc">newspaper</genre>
338
				</xsl:when>
339
				<xsl:when test="$controlField008-21='p'">
340
					<genre authority="marc">periodical</genre>
341
				</xsl:when>
342
				<xsl:when test="$controlField008-21='w'">
343
					<genre authority="marc">web site</genre>
344
				</xsl:when>
345
			</xsl:choose>
346
		</xsl:if>
347
		<xsl:if test="$typeOf008='BK' or $typeOf008='SE'">
348
			<xsl:variable name="controlField008-24" select="substring($controlField008,25,4)"></xsl:variable>
349
			<xsl:choose>
350
				<xsl:when test="contains($controlField008-24,'a')">
351
					<genre authority="marc">abstract or summary</genre>
352
				</xsl:when>
353
				<xsl:when test="contains($controlField008-24,'b')">
354
					<genre authority="marc">bibliography</genre>
355
				</xsl:when>
356
				<xsl:when test="contains($controlField008-24,'c')">
357
					<genre authority="marc">catalog</genre>
358
				</xsl:when>
359
				<xsl:when test="contains($controlField008-24,'d')">
360
					<genre authority="marc">dictionary</genre>
361
				</xsl:when>
362
				<xsl:when test="contains($controlField008-24,'e')">
363
					<genre authority="marc">encyclopedia</genre>
364
				</xsl:when>
365
				<xsl:when test="contains($controlField008-24,'f')">
366
					<genre authority="marc">handbook</genre>
367
				</xsl:when>
368
				<xsl:when test="contains($controlField008-24,'g')">
369
					<genre authority="marc">legal article</genre>
370
				</xsl:when>
371
				<xsl:when test="contains($controlField008-24,'i')">
372
					<genre authority="marc">index</genre>
373
				</xsl:when>
374
				<xsl:when test="contains($controlField008-24,'k')">
375
					<genre authority="marc">discography</genre>
376
				</xsl:when>
377
				<xsl:when test="contains($controlField008-24,'l')">
378
					<genre authority="marc">legislation</genre>
379
				</xsl:when>
380
				<xsl:when test="contains($controlField008-24,'m')">
381
					<genre authority="marc">theses</genre>
382
				</xsl:when>
383
				<xsl:when test="contains($controlField008-24,'n')">
384
					<genre authority="marc">survey of literature</genre>
385
				</xsl:when>
386
				<xsl:when test="contains($controlField008-24,'o')">
387
					<genre authority="marc">review</genre>
388
				</xsl:when>
389
				<xsl:when test="contains($controlField008-24,'p')">
390
					<genre authority="marc">programmed text</genre>
391
				</xsl:when>
392
				<xsl:when test="contains($controlField008-24,'q')">
393
					<genre authority="marc">filmography</genre>
394
				</xsl:when>
395
				<xsl:when test="contains($controlField008-24,'r')">
396
					<genre authority="marc">directory</genre>
397
				</xsl:when>
398
				<xsl:when test="contains($controlField008-24,'s')">
399
					<genre authority="marc">statistics</genre>
400
				</xsl:when>
401
				<xsl:when test="contains($controlField008-24,'t')">
402
					<genre authority="marc">technical report</genre>
403
				</xsl:when>
404
				<xsl:when test="contains($controlField008-24,'v')">
405
					<genre authority="marc">legal case and case notes</genre>
406
				</xsl:when>
407
				<xsl:when test="contains($controlField008-24,'w')">
408
					<genre authority="marc">law report or digest</genre>
409
				</xsl:when>
410
				<xsl:when test="contains($controlField008-24,'z')">
411
					<genre authority="marc">treaty</genre>
412
				</xsl:when>
413
			</xsl:choose>
414
			<xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"></xsl:variable>
415
			<xsl:choose>
416
				<xsl:when test="$controlField008-29='1'">
417
					<genre authority="marc">conference publication</genre>
418
				</xsl:when>
419
			</xsl:choose>
420
		</xsl:if>
421
		<xsl:if test="$typeOf008='CF'">
422
			<xsl:variable name="controlField008-26" select="substring($controlField008,27,1)"></xsl:variable>
423
			<xsl:choose>
424
				<xsl:when test="$controlField008-26='a'">
425
					<genre authority="marc">numeric data</genre>
426
				</xsl:when>
427
				<xsl:when test="$controlField008-26='e'">
428
					<genre authority="marc">database</genre>
429
				</xsl:when>
430
				<xsl:when test="$controlField008-26='f'">
431
					<genre authority="marc">font</genre>
432
				</xsl:when>
433
				<xsl:when test="$controlField008-26='g'">
434
					<genre authority="marc">game</genre>
435
				</xsl:when>
436
			</xsl:choose>
437
		</xsl:if>
438
		<xsl:if test="$typeOf008='BK'">
439
			<xsl:if test="substring($controlField008,25,1)='j'">
440
				<genre authority="marc">patent</genre>
441
			</xsl:if>
442
			<xsl:if test="substring($controlField008,31,1)='1'">
443
				<genre authority="marc">festschrift</genre>
444
			</xsl:if>
445
			<xsl:variable name="controlField008-34" select="substring($controlField008,35,1)"></xsl:variable>
446
			<xsl:if test="$controlField008-34='a' or $controlField008-34='b' or $controlField008-34='c' or $controlField008-34='d'">
447
				<genre authority="marc">biography</genre>
448
			</xsl:if>
449
			<xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"></xsl:variable>
450
			<xsl:choose>
451
				<xsl:when test="$controlField008-33='e'">
452
					<genre authority="marc">essay</genre>
453
				</xsl:when>
454
				<xsl:when test="$controlField008-33='d'">
455
					<genre authority="marc">drama</genre>
456
				</xsl:when>
457
				<xsl:when test="$controlField008-33='c'">
458
					<genre authority="marc">comic strip</genre>
459
				</xsl:when>
460
				<xsl:when test="$controlField008-33='l'">
461
					<genre authority="marc">fiction</genre>
462
				</xsl:when>
463
				<xsl:when test="$controlField008-33='h'">
464
					<genre authority="marc">humor, satire</genre>
465
				</xsl:when>
466
				<xsl:when test="$controlField008-33='i'">
467
					<genre authority="marc">letter</genre>
468
				</xsl:when>
469
				<xsl:when test="$controlField008-33='f'">
470
					<genre authority="marc">novel</genre>
471
				</xsl:when>
472
				<xsl:when test="$controlField008-33='j'">
473
					<genre authority="marc">short story</genre>
474
				</xsl:when>
475
				<xsl:when test="$controlField008-33='s'">
476
					<genre authority="marc">speech</genre>
477
				</xsl:when>
478
			</xsl:choose>
479
		</xsl:if>
480
		<xsl:if test="$typeOf008='MU'">
481
			<xsl:variable name="controlField008-30-31" select="substring($controlField008,31,2)"></xsl:variable>
482
			<xsl:if test="contains($controlField008-30-31,'b')">
483
				<genre authority="marc">biography</genre>
484
			</xsl:if>
485
			<xsl:if test="contains($controlField008-30-31,'c')">
486
				<genre authority="marc">conference publication</genre>
487
			</xsl:if>
488
			<xsl:if test="contains($controlField008-30-31,'d')">
489
				<genre authority="marc">drama</genre>
490
			</xsl:if>
491
			<xsl:if test="contains($controlField008-30-31,'e')">
492
				<genre authority="marc">essay</genre>
493
			</xsl:if>
494
			<xsl:if test="contains($controlField008-30-31,'f')">
495
				<genre authority="marc">fiction</genre>
496
			</xsl:if>
497
			<xsl:if test="contains($controlField008-30-31,'o')">
498
				<genre authority="marc">folktale</genre>
499
			</xsl:if>
500
			<xsl:if test="contains($controlField008-30-31,'h')">
501
				<genre authority="marc">history</genre>
502
			</xsl:if>
503
			<xsl:if test="contains($controlField008-30-31,'k')">
504
				<genre authority="marc">humor, satire</genre>
505
			</xsl:if>
506
			<xsl:if test="contains($controlField008-30-31,'m')">
507
				<genre authority="marc">memoir</genre>
508
			</xsl:if>
509
			<xsl:if test="contains($controlField008-30-31,'p')">
510
				<genre authority="marc">poetry</genre>
511
			</xsl:if>
512
			<xsl:if test="contains($controlField008-30-31,'r')">
513
				<genre authority="marc">rehearsal</genre>
514
			</xsl:if>
515
			<xsl:if test="contains($controlField008-30-31,'g')">
516
				<genre authority="marc">reporting</genre>
517
			</xsl:if>
518
			<xsl:if test="contains($controlField008-30-31,'s')">
519
				<genre authority="marc">sound</genre>
520
			</xsl:if>
521
			<xsl:if test="contains($controlField008-30-31,'l')">
522
				<genre authority="marc">speech</genre>
523
			</xsl:if>
524
		</xsl:if>
525
		<xsl:if test="$typeOf008='VM'">
526
			<xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"></xsl:variable>
527
			<xsl:choose>
528
				<xsl:when test="$controlField008-33='a'">
529
					<genre authority="marc">art original</genre>
530
				</xsl:when>
531
				<xsl:when test="$controlField008-33='b'">
532
					<genre authority="marc">kit</genre>
533
				</xsl:when>
534
				<xsl:when test="$controlField008-33='c'">
535
					<genre authority="marc">art reproduction</genre>
536
				</xsl:when>
537
				<xsl:when test="$controlField008-33='d'">
538
					<genre authority="marc">diorama</genre>
539
				</xsl:when>
540
				<xsl:when test="$controlField008-33='f'">
541
					<genre authority="marc">filmstrip</genre>
542
				</xsl:when>
543
				<xsl:when test="$controlField008-33='g'">
544
					<genre authority="marc">legal article</genre>
545
				</xsl:when>
546
				<xsl:when test="$controlField008-33='i'">
547
					<genre authority="marc">picture</genre>
548
				</xsl:when>
549
				<xsl:when test="$controlField008-33='k'">
550
					<genre authority="marc">graphic</genre>
551
				</xsl:when>
552
				<xsl:when test="$controlField008-33='l'">
553
					<genre authority="marc">technical drawing</genre>
554
				</xsl:when>
555
				<xsl:when test="$controlField008-33='m'">
556
					<genre authority="marc">motion picture</genre>
557
				</xsl:when>
558
				<xsl:when test="$controlField008-33='n'">
559
					<genre authority="marc">chart</genre>
560
				</xsl:when>
561
				<xsl:when test="$controlField008-33='o'">
562
					<genre authority="marc">flash card</genre>
563
				</xsl:when>
564
				<xsl:when test="$controlField008-33='p'">
565
					<genre authority="marc">microscope slide</genre>
566
				</xsl:when>
567
				<xsl:when test="$controlField008-33='q' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']">
568
					<genre authority="marc">model</genre>
569
				</xsl:when>
570
				<xsl:when test="$controlField008-33='r'">
571
					<genre authority="marc">realia</genre>
572
				</xsl:when>
573
				<xsl:when test="$controlField008-33='s'">
574
					<genre authority="marc">slide</genre>
575
				</xsl:when>
576
				<xsl:when test="$controlField008-33='t'">
577
					<genre authority="marc">transparency</genre>
578
				</xsl:when>
579
				<xsl:when test="$controlField008-33='v'">
580
					<genre authority="marc">videorecording</genre>
581
				</xsl:when>
582
				<xsl:when test="$controlField008-33='w'">
583
					<genre authority="marc">toy</genre>
584
				</xsl:when>
585
			</xsl:choose>
586
		</xsl:if>
587
		<xsl:for-each select="marc:datafield[@tag=655]">
588
			<genre authority="marc">
589
				<xsl:attribute name="authority">
590
					<xsl:value-of select="marc:subfield[@code='2']"/>
591
				</xsl:attribute>
592
				<xsl:call-template name="subfieldSelect">
593
					<xsl:with-param name="codes">abvxyz</xsl:with-param>
594
					<xsl:with-param name="delimeter">-</xsl:with-param>
595
				</xsl:call-template>
596
			</genre>
597
		</xsl:for-each>
598
		<originInfo>
599
			<xsl:variable name="MARCpublicationCode" select="normalize-space(substring($controlField008,16,3))"></xsl:variable>
600
			<xsl:if test="translate($MARCpublicationCode,'|','')">
601
				<place>
602
					<placeTerm>
603
						<xsl:attribute name="type">code</xsl:attribute>
604
						<xsl:attribute name="authority">marccountry</xsl:attribute>
605
						<xsl:value-of select="$MARCpublicationCode"/>
606
					</placeTerm>
607
				</place>
608
			</xsl:if>
609
			<xsl:for-each select="marc:datafield[@tag=044]/marc:subfield[@code='c']">
610
				<place>
611
					<placeTerm>
612
						<xsl:attribute name="type">code</xsl:attribute>
613
						<xsl:attribute name="authority">iso3166</xsl:attribute>
614
						<xsl:value-of select="."/>
615
					</placeTerm>
616
				</place>
617
			</xsl:for-each>
618
			<xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='a']">
619
				<place>
620
					<placeTerm>
621
						<xsl:attribute name="type">text</xsl:attribute>
622
						<xsl:call-template name="chopPunctuationFront">
623
							<xsl:with-param name="chopString">
624
								<xsl:call-template name="chopPunctuation">
625
									<xsl:with-param name="chopString" select="."/>
626
								</xsl:call-template>
627
							</xsl:with-param>
628
						</xsl:call-template>
629
					</placeTerm>
630
				</place>
631
			</xsl:for-each>
632
			<xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='m']">
633
				<dateValid point="start">
634
					<xsl:value-of select="."/>
635
				</dateValid>
636
			</xsl:for-each>
637
			<xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='n']">
638
				<dateValid point="end">
639
					<xsl:value-of select="."/>
640
				</dateValid>
641
			</xsl:for-each>
642
			<xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='j']">
643
				<dateModified>
644
					<xsl:value-of select="."/>
645
				</dateModified>
646
			</xsl:for-each>
647
			<xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='b' or @code='c' or @code='g']">
648
				<xsl:choose>
649
					<xsl:when test="@code='b'">
650
						<publisher>
651
							<xsl:call-template name="chopPunctuation">
652
								<xsl:with-param name="chopString" select="."/>
653
								<xsl:with-param name="punctuation">
654
									<xsl:text>:,;/ </xsl:text>
655
								</xsl:with-param>
656
							</xsl:call-template>
657
						</publisher>
658
					</xsl:when>
659
					<xsl:when test="@code='c'">
660
						<dateIssued>
661
							<xsl:call-template name="chopPunctuation">
662
								<xsl:with-param name="chopString" select="."/>
663
							</xsl:call-template>
664
						</dateIssued>
665
					</xsl:when>
666
					<xsl:when test="@code='g'">
667
						<dateCreated>
668
							<xsl:value-of select="."/>
669
						</dateCreated>
670
					</xsl:when>
671
				</xsl:choose>
672
			</xsl:for-each>
673
			<xsl:variable name="dataField260c">
674
				<xsl:call-template name="chopPunctuation">
675
					<xsl:with-param name="chopString" select="marc:datafield[@tag=260]/marc:subfield[@code='c']"></xsl:with-param>
676
				</xsl:call-template>
677
			</xsl:variable>
678
			<xsl:variable name="controlField008-7-10" select="normalize-space(substring($controlField008, 8, 4))"></xsl:variable>
679
			<xsl:variable name="controlField008-11-14" select="normalize-space(substring($controlField008, 12, 4))"></xsl:variable>
680
			<xsl:variable name="controlField008-6" select="normalize-space(substring($controlField008, 7, 1))"></xsl:variable>
681
			<xsl:if test="$controlField008-6='e' or $controlField008-6='p' or $controlField008-6='r' or $controlField008-6='t' or $controlField008-6='s'">
682
				<xsl:if test="$controlField008-7-10 and ($controlField008-7-10 != $dataField260c)">
683
					<dateIssued encoding="marc">
684
						<xsl:value-of select="$controlField008-7-10"/>
685
					</dateIssued>
686
				</xsl:if>
687
			</xsl:if>
688
			<xsl:if test="$controlField008-6='c' or $controlField008-6='d' or $controlField008-6='i' or $controlField008-6='k' or $controlField008-6='m' or $controlField008-6='q' or $controlField008-6='u'">
689
				<xsl:if test="$controlField008-7-10">
690
					<dateIssued encoding="marc" point="start">
691
						<xsl:value-of select="$controlField008-7-10"/>
692
					</dateIssued>
693
				</xsl:if>
694
			</xsl:if>
695
			<xsl:if test="$controlField008-6='c' or $controlField008-6='d' or $controlField008-6='i' or $controlField008-6='k' or $controlField008-6='m' or $controlField008-6='q' or $controlField008-6='u'">
696
				<xsl:if test="$controlField008-11-14">
697
					<dateIssued encoding="marc" point="end">
698
						<xsl:value-of select="$controlField008-11-14"/>
699
					</dateIssued>
700
				</xsl:if>
701
			</xsl:if>
702
			<xsl:if test="$controlField008-6='q'">
703
				<xsl:if test="$controlField008-7-10">
704
					<dateIssued encoding="marc" point="start" qualifier="questionable">
705
						<xsl:value-of select="$controlField008-7-10"/>
706
					</dateIssued>
707
				</xsl:if>
708
			</xsl:if>
709
			<xsl:if test="$controlField008-6='q'">
710
				<xsl:if test="$controlField008-11-14">
711
					<dateIssued encoding="marc" point="end" qualifier="questionable">
712
						<xsl:value-of select="$controlField008-11-14"/>
713
					</dateIssued>
714
				</xsl:if>
715
			</xsl:if>
716
			<xsl:if test="$controlField008-6='t'">
717
				<xsl:if test="$controlField008-11-14">
718
					<copyrightDate encoding="marc">
719
						<xsl:value-of select="$controlField008-11-14"/>
720
					</copyrightDate>
721
				</xsl:if>
722
			</xsl:if>
723
			<xsl:for-each select="marc:datafield[@tag=033][@ind1=0 or @ind1=1]/marc:subfield[@code='a']">
724
				<dateCaptured encoding="iso8601">
725
					<xsl:value-of select="."/>
726
				</dateCaptured>
727
			</xsl:for-each>
728
			<xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][1]">
729
				<dateCaptured encoding="iso8601" point="start">
730
					<xsl:value-of select="."/>
731
				</dateCaptured>
732
			</xsl:for-each>
733
			<xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][2]">
734
				<dateCaptured encoding="iso8601" point="end">
735
					<xsl:value-of select="."/>
736
				</dateCaptured>
737
			</xsl:for-each>
738
			<xsl:for-each select="marc:datafield[@tag=250]/marc:subfield[@code='a']">
739
				<edition>
740
					<xsl:value-of select="."/>
741
				</edition>
742
			</xsl:for-each>
743
			<xsl:for-each select="marc:leader">
744
				<issuance>
745
					<xsl:choose>
746
						<xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">monographic</xsl:when>
747
						<xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">continuing</xsl:when>
748
					</xsl:choose>
749
				</issuance>
750
			</xsl:for-each>
751
			<xsl:for-each select="marc:datafield[@tag=310]|marc:datafield[@tag=321]">
752
				<frequency>
753
					<xsl:call-template name="subfieldSelect">
754
						<xsl:with-param name="codes">ab</xsl:with-param>
755
					</xsl:call-template>
756
				</frequency>
757
			</xsl:for-each>
758
		</originInfo>
759
		<xsl:variable name="controlField008-35-37" select="normalize-space(translate(substring($controlField008,36,3),'|#',''))"></xsl:variable>
760
		<xsl:if test="$controlField008-35-37">
761
			<language>
762
				<languageTerm authority="iso639-2b" type="code">
763
					<xsl:value-of select="substring($controlField008,36,3)"/>
764
				</languageTerm>
765
			</language>
766
		</xsl:if>
767
		<xsl:for-each select="marc:datafield[@tag=041]">
768
			<xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='d' or @code='e' or @code='f' or @code='g' or @code='h']">
769
				<xsl:variable name="langCodes" select="."/>
770
				<xsl:choose>
771
					<xsl:when test="../marc:subfield[@code='2']='rfc3066'">
772
						<!-- not stacked but could be repeated -->
773
						<xsl:call-template name="rfcLanguages">
774
							<xsl:with-param name="nodeNum">
775
								<xsl:value-of select="1"/>
776
							</xsl:with-param>
777
							<xsl:with-param name="usedLanguages">
778
								<xsl:text></xsl:text>
779
							</xsl:with-param>
780
							<xsl:with-param name="controlField008-35-37">
781
								<xsl:value-of select="$controlField008-35-37"></xsl:value-of>
782
							</xsl:with-param>
783
						</xsl:call-template>
784
					</xsl:when>
785
					<xsl:otherwise>
786
						<!-- iso -->
787
						<xsl:variable name="allLanguages">
788
							<xsl:copy-of select="$langCodes"></xsl:copy-of>
789
						</xsl:variable>
790
						<xsl:variable name="currentLanguage">
791
							<xsl:value-of select="substring($allLanguages,1,3)"></xsl:value-of>
792
						</xsl:variable>
793
						<xsl:call-template name="isoLanguage">
794
							<xsl:with-param name="currentLanguage">
795
								<xsl:value-of select="substring($allLanguages,1,3)"></xsl:value-of>
796
							</xsl:with-param>
797
							<xsl:with-param name="remainingLanguages">
798
								<xsl:value-of select="substring($allLanguages,4,string-length($allLanguages)-3)"></xsl:value-of>
799
							</xsl:with-param>
800
							<xsl:with-param name="usedLanguages">
801
								<xsl:if test="$controlField008-35-37">
802
									<xsl:value-of select="$controlField008-35-37"></xsl:value-of>
803
								</xsl:if>
804
							</xsl:with-param>
805
						</xsl:call-template>
806
					</xsl:otherwise>
807
				</xsl:choose>
808
			</xsl:for-each>
809
		</xsl:for-each>
810
		<xsl:variable name="physicalDescription">
811
			<!--3.2 change tmee 007/11 -->
812
			<xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='a']">
813
				<digitalOrigin>reformatted digital</digitalOrigin>
814
			</xsl:if>
815
			<xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='b']">
816
				<digitalOrigin>digitized microfilm</digitalOrigin>
817
			</xsl:if>
818
			<xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='d']">
819
				<digitalOrigin>digitized other analog</digitalOrigin>
820
			</xsl:if>
821
			<xsl:variable name="controlField008-23" select="substring($controlField008,24,1)"></xsl:variable>
822
			<xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"></xsl:variable>
823
			<xsl:variable name="check008-23">
824
				<xsl:if test="$typeOf008='BK' or $typeOf008='MU' or $typeOf008='SE' or $typeOf008='MM'">
825
					<xsl:value-of select="true()"></xsl:value-of>
826
				</xsl:if>
827
			</xsl:variable>
828
			<xsl:variable name="check008-29">
829
				<xsl:if test="$typeOf008='MP' or $typeOf008='VM'">
830
					<xsl:value-of select="true()"></xsl:value-of>
831
				</xsl:if>
832
			</xsl:variable>
833
			<xsl:choose>
834
				<xsl:when test="($check008-23 and $controlField008-23='f') or ($check008-29 and $controlField008-29='f')">
835
					<form authority="marcform">braille</form>
836
				</xsl:when>
837
				<xsl:when test="($controlField008-23=' ' and ($leader6='c' or $leader6='d')) or (($typeOf008='BK' or $typeOf008='SE') and ($controlField008-23=' ' or $controlField008='r'))">
838
					<form authority="marcform">print</form>
839
				</xsl:when>
840
				<xsl:when test="$leader6 = 'm' or ($check008-23 and $controlField008-23='s') or ($check008-29 and $controlField008-29='s')">
841
					<form authority="marcform">electronic</form>
842
				</xsl:when>
843
				<xsl:when test="($check008-23 and $controlField008-23='b') or ($check008-29 and $controlField008-29='b')">
844
					<form authority="marcform">microfiche</form>
845
				</xsl:when>
846
				<xsl:when test="($check008-23 and $controlField008-23='a') or ($check008-29 and $controlField008-29='a')">
847
					<form authority="marcform">microfilm</form>
848
				</xsl:when>
849
			</xsl:choose>
850
			<!-- 1/04 fix -->
851
			<xsl:if test="marc:datafield[@tag=130]/marc:subfield[@code='h']">
852
				<form authority="gmd">
853
					<xsl:call-template name="chopBrackets">
854
						<xsl:with-param name="chopString">
855
							<xsl:value-of select="marc:datafield[@tag=130]/marc:subfield[@code='h']"></xsl:value-of>
856
						</xsl:with-param>
857
					</xsl:call-template>
858
				</form>
859
			</xsl:if>
860
			<xsl:if test="marc:datafield[@tag=240]/marc:subfield[@code='h']">
861
				<form authority="gmd">
862
					<xsl:call-template name="chopBrackets">
863
						<xsl:with-param name="chopString">
864
							<xsl:value-of select="marc:datafield[@tag=240]/marc:subfield[@code='h']"></xsl:value-of>
865
						</xsl:with-param>
866
					</xsl:call-template>
867
				</form>
868
			</xsl:if>
869
			<xsl:if test="marc:datafield[@tag=242]/marc:subfield[@code='h']">
870
				<form authority="gmd">
871
					<xsl:call-template name="chopBrackets">
872
						<xsl:with-param name="chopString">
873
							<xsl:value-of select="marc:datafield[@tag=242]/marc:subfield[@code='h']"></xsl:value-of>
874
						</xsl:with-param>
875
					</xsl:call-template>
876
				</form>
877
			</xsl:if>
878
			<xsl:if test="marc:datafield[@tag=245]/marc:subfield[@code='h']">
879
				<form authority="gmd">
880
					<xsl:call-template name="chopBrackets">
881
						<xsl:with-param name="chopString">
882
							<xsl:value-of select="marc:datafield[@tag=245]/marc:subfield[@code='h']"></xsl:value-of>
883
						</xsl:with-param>
884
					</xsl:call-template>
885
				</form>
886
			</xsl:if>
887
			<xsl:if test="marc:datafield[@tag=246]/marc:subfield[@code='h']">
888
				<form authority="gmd">
889
					<xsl:call-template name="chopBrackets">
890
						<xsl:with-param name="chopString">
891
							<xsl:value-of select="marc:datafield[@tag=246]/marc:subfield[@code='h']"></xsl:value-of>
892
						</xsl:with-param>
893
					</xsl:call-template>
894
				</form>
895
			</xsl:if>
896
			<xsl:if test="marc:datafield[@tag=730]/marc:subfield[@code='h']">
897
				<form authority="gmd">
898
					<xsl:call-template name="chopBrackets">
899
						<xsl:with-param name="chopString">
900
							<xsl:value-of select="marc:datafield[@tag=730]/marc:subfield[@code='h']"></xsl:value-of>
901
						</xsl:with-param>
902
					</xsl:call-template>
903
				</form>
904
			</xsl:if>
905
			<xsl:for-each select="marc:datafield[@tag=256]/marc:subfield[@code='a']">
906
				<form>
907
					<xsl:value-of select="."></xsl:value-of>
908
				</form>
909
			</xsl:for-each>
910
			<xsl:for-each select="marc:controlfield[@tag=007][substring(text(),1,1)='c']">
911
				<xsl:choose>
912
					<xsl:when test="substring(text(),14,1)='a'">
913
						<reformattingQuality>access</reformattingQuality>
914
					</xsl:when>
915
					<xsl:when test="substring(text(),14,1)='p'">
916
						<reformattingQuality>preservation</reformattingQuality>
917
					</xsl:when>
918
					<xsl:when test="substring(text(),14,1)='r'">
919
						<reformattingQuality>replacement</reformattingQuality>
920
					</xsl:when>
921
				</xsl:choose>
922
			</xsl:for-each>
923
			<!--3.2 change tmee 007/01 -->
924
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='b']">
925
				<form authority="smd">chip cartridge</form>
926
			</xsl:if>
927
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='c']">
928
				<form authority="smd">computer optical disc cartridge</form>
929
			</xsl:if>
930
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='j']">
931
				<form authority="smd">magnetic disc</form>
932
			</xsl:if>
933
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='m']">
934
				<form authority="smd">magneto-optical disc</form>
935
			</xsl:if>
936
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='o']">
937
				<form authority="smd">optical disc</form>
938
			</xsl:if>
939
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='r']">
940
				<form authority="smd">remote</form>
941
			</xsl:if>
942
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='a']">
943
				<form authority="smd">tape cartridge</form>
944
			</xsl:if>
945
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='f']">
946
				<form authority="smd">tape cassette</form>
947
			</xsl:if>
948
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='h']">
949
				<form authority="smd">tape reel</form>
950
			</xsl:if>
951
			
952
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='a']">
953
				<form authority="smd">celestial globe</form>
954
			</xsl:if>
955
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='e']">
956
				<form authority="smd">earth moon globe</form>
957
			</xsl:if>
958
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='b']">
959
				<form authority="smd">planetary or lunar globe</form>
960
			</xsl:if>
961
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='c']">
962
				<form authority="smd">terrestrial globe</form>
963
			</xsl:if>
964
			
965
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='o'][substring(text(),2,1)='o']">
966
				<form authority="smd">kit</form>
967
			</xsl:if>
968
			
969
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']">
970
				<form authority="smd">atlas</form>
971
			</xsl:if>
972
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='g']">
973
				<form authority="smd">diagram</form>
974
			</xsl:if>
975
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='j']">
976
				<form authority="smd">map</form>
977
			</xsl:if>
978
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']">
979
				<form authority="smd">model</form>
980
			</xsl:if>
981
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='k']">
982
				<form authority="smd">profile</form>
983
			</xsl:if>
984
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='r']">
985
				<form authority="smd">remote-sensing image</form>
986
			</xsl:if>
987
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='s']">
988
				<form authority="smd">section</form>
989
			</xsl:if>
990
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='y']">
991
				<form authority="smd">view</form>
992
			</xsl:if>
993
			
994
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='a']">
995
				<form authority="smd">aperture card</form>
996
			</xsl:if>
997
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='e']">
998
				<form authority="smd">microfiche</form>
999
			</xsl:if>
1000
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='f']">
1001
				<form authority="smd">microfiche cassette</form>
1002
			</xsl:if>
1003
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='b']">
1004
				<form authority="smd">microfilm cartridge</form>
1005
			</xsl:if>
1006
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='c']">
1007
				<form authority="smd">microfilm cassette</form>
1008
			</xsl:if>
1009
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='d']">
1010
				<form authority="smd">microfilm reel</form>
1011
			</xsl:if>
1012
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='g']">
1013
				<form authority="smd">microopaque</form>
1014
			</xsl:if>
1015
			
1016
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='c']">
1017
				<form authority="smd">film cartridge</form>
1018
			</xsl:if>
1019
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='f']">
1020
				<form authority="smd">film cassette</form>
1021
			</xsl:if>
1022
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='r']">
1023
				<form authority="smd">film reel</form>
1024
			</xsl:if>
1025
			
1026
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='n']">
1027
				<form authority="smd">chart</form>
1028
			</xsl:if>
1029
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='c']">
1030
				<form authority="smd">collage</form>
1031
			</xsl:if>
1032
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='d']">
1033
				<form authority="smd">drawing</form>
1034
			</xsl:if>
1035
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='o']">
1036
				<form authority="smd">flash card</form>
1037
			</xsl:if>
1038
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='e']">
1039
				<form authority="smd">painting</form>
1040
			</xsl:if>
1041
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='f']">
1042
				<form authority="smd">photomechanical print</form>
1043
			</xsl:if>
1044
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='g']">
1045
				<form authority="smd">photonegative</form>
1046
			</xsl:if>
1047
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='h']">
1048
				<form authority="smd">photoprint</form>
1049
			</xsl:if>
1050
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='i']">
1051
				<form authority="smd">picture</form>
1052
			</xsl:if>
1053
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='j']">
1054
				<form authority="smd">print</form>
1055
			</xsl:if>
1056
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='l']">
1057
				<form authority="smd">technical drawing</form>
1058
			</xsl:if>
1059
			
1060
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='q'][substring(text(),2,1)='q']">
1061
				<form authority="smd">notated music</form>
1062
			</xsl:if>
1063
			
1064
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='d']">
1065
				<form authority="smd">filmslip</form>
1066
			</xsl:if>
1067
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='c']">
1068
				<form authority="smd">filmstrip cartridge</form>
1069
			</xsl:if>
1070
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='o']">
1071
				<form authority="smd">filmstrip roll</form>
1072
			</xsl:if>
1073
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='f']">
1074
				<form authority="smd">other filmstrip type</form>
1075
			</xsl:if>
1076
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='s']">
1077
				<form authority="smd">slide</form>
1078
			</xsl:if>
1079
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='t']">
1080
				<form authority="smd">transparency</form>
1081
			</xsl:if>
1082
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='r'][substring(text(),2,1)='r']">
1083
				<form authority="smd">remote-sensing image</form>
1084
			</xsl:if>
1085
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='e']">
1086
				<form authority="smd">cylinder</form>
1087
			</xsl:if>
1088
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='q']">
1089
				<form authority="smd">roll</form>
1090
			</xsl:if>
1091
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='g']">
1092
				<form authority="smd">sound cartridge</form>
1093
			</xsl:if>
1094
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='s']">
1095
				<form authority="smd">sound cassette</form>
1096
			</xsl:if>
1097
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='d']">
1098
				<form authority="smd">sound disc</form>
1099
			</xsl:if>
1100
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='t']">
1101
				<form authority="smd">sound-tape reel</form>
1102
			</xsl:if>
1103
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='i']">
1104
				<form authority="smd">sound-track film</form>
1105
			</xsl:if>
1106
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='w']">
1107
				<form authority="smd">wire recording</form>
1108
			</xsl:if>
1109
			
1110
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='c']">
1111
				<form authority="smd">braille</form>
1112
			</xsl:if>
1113
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='b']">
1114
				<form authority="smd">combination</form>
1115
			</xsl:if>
1116
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='a']">
1117
				<form authority="smd">moon</form>
1118
			</xsl:if>
1119
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='d']">
1120
				<form authority="smd">tactile, with no writing system</form>
1121
			</xsl:if>
1122
			
1123
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='c']">
1124
				<form authority="smd">braille</form>
1125
			</xsl:if>
1126
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='b']">
1127
				<form authority="smd">large print</form>
1128
			</xsl:if>
1129
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='a']">
1130
				<form authority="smd">regular print</form>
1131
			</xsl:if>
1132
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='d']">
1133
				<form authority="smd">text in looseleaf binder</form>
1134
			</xsl:if>
1135
			
1136
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='c']">
1137
				<form authority="smd">videocartridge</form>
1138
			</xsl:if>
1139
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='f']">
1140
				<form authority="smd">videocassette</form>
1141
			</xsl:if>
1142
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='d']">
1143
				<form authority="smd">videodisc</form>
1144
			</xsl:if>
1145
			<xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='r']">
1146
				<form authority="smd">videoreel</form>
1147
			</xsl:if>
1148
			
1149
			<xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='q'][string-length(.)>1]">
1150
				<internetMediaType>
1151
					<xsl:value-of select="."></xsl:value-of>
1152
				</internetMediaType>
1153
			</xsl:for-each>
1154
			<xsl:for-each select="marc:datafield[@tag=300]">
1155
				<extent>
1156
					<xsl:call-template name="subfieldSelect">
1157
						<xsl:with-param name="codes">abce</xsl:with-param>
1158
					</xsl:call-template>
1159
				</extent>
1160
			</xsl:for-each>
1161
		</xsl:variable>
1162
		<xsl:if test="string-length(normalize-space($physicalDescription))">
1163
			<physicalDescription>
1164
				<xsl:copy-of select="$physicalDescription"></xsl:copy-of>
1165
			</physicalDescription>
1166
		</xsl:if>
1167
		<xsl:for-each select="marc:datafield[@tag=520]">
1168
			<abstract>
1169
				<xsl:call-template name="uri"></xsl:call-template>
1170
				<xsl:call-template name="subfieldSelect">
1171
					<xsl:with-param name="codes">ab</xsl:with-param>
1172
				</xsl:call-template>
1173
			</abstract>
1174
		</xsl:for-each>
1175
		<xsl:for-each select="marc:datafield[@tag=505]">
1176
			<tableOfContents>
1177
				<xsl:call-template name="uri"></xsl:call-template>
1178
				<xsl:call-template name="subfieldSelect">
1179
					<xsl:with-param name="codes">agrt</xsl:with-param>
1180
				</xsl:call-template>
1181
			</tableOfContents>
1182
		</xsl:for-each>
1183
		<xsl:for-each select="marc:datafield[@tag=521]">
1184
			<targetAudience>
1185
				<xsl:call-template name="subfieldSelect">
1186
					<xsl:with-param name="codes">ab</xsl:with-param>
1187
				</xsl:call-template>
1188
			</targetAudience>
1189
		</xsl:for-each>
1190
		<xsl:if test="$typeOf008='BK' or $typeOf008='CF' or $typeOf008='MU' or $typeOf008='VM'">
1191
			<xsl:variable name="controlField008-22" select="substring($controlField008,23,1)"></xsl:variable>
1192
			<xsl:choose>
1193
				<!-- 01/04 fix -->
1194
				<xsl:when test="$controlField008-22='d'">
1195
					<targetAudience authority="marctarget">adolescent</targetAudience>
1196
				</xsl:when>
1197
				<xsl:when test="$controlField008-22='e'">
1198
					<targetAudience authority="marctarget">adult</targetAudience>
1199
				</xsl:when>
1200
				<xsl:when test="$controlField008-22='g'">
1201
					<targetAudience authority="marctarget">general</targetAudience>
1202
				</xsl:when>
1203
				<xsl:when test="$controlField008-22='b' or $controlField008-22='c' or $controlField008-22='j'">
1204
					<targetAudience authority="marctarget">juvenile</targetAudience>
1205
				</xsl:when>
1206
				<xsl:when test="$controlField008-22='a'">
1207
					<targetAudience authority="marctarget">preschool</targetAudience>
1208
				</xsl:when>
1209
				<xsl:when test="$controlField008-22='f'">
1210
					<targetAudience authority="marctarget">specialized</targetAudience>
1211
				</xsl:when>
1212
			</xsl:choose>
1213
		</xsl:if>
1214
		<xsl:for-each select="marc:datafield[@tag=245]/marc:subfield[@code='c']">
1215
			<note type="statement of responsibility">
1216
				<xsl:value-of select="."></xsl:value-of>
1217
			</note>
1218
		</xsl:for-each>
1219
		<xsl:for-each select="marc:datafield[@tag=500]">
1220
			<note>
1221
				<xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of>
1222
				<xsl:call-template name="uri"></xsl:call-template>
1223
			</note>
1224
		</xsl:for-each>
1225
		
1226
		<!--3.2 change tmee additional note fields-->
1227
		
1228
		<xsl:for-each select="marc:datafield[@tag=506]">
1229
			<note type="restrictions">
1230
				<xsl:call-template name="uri"></xsl:call-template>
1231
				<xsl:variable name="str">
1232
					<xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1233
						<xsl:value-of select="."></xsl:value-of>
1234
						<xsl:text> </xsl:text>
1235
					</xsl:for-each>
1236
				</xsl:variable>
1237
				<xsl:value-of select="substring($str,1,string-length($str)-1)"></xsl:value-of>
1238
			</note>
1239
		</xsl:for-each>
1240
		
1241
		<xsl:for-each select="marc:datafield[@tag=510]">
1242
			<note  type="citation/reference">
1243
				<xsl:call-template name="uri"></xsl:call-template>
1244
				<xsl:variable name="str">
1245
					<xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1246
						<xsl:value-of select="."></xsl:value-of>
1247
						<xsl:text> </xsl:text>
1248
					</xsl:for-each>
1249
				</xsl:variable>
1250
				<xsl:value-of select="substring($str,1,string-length($str)-1)"></xsl:value-of>
1251
			</note>
1252
		</xsl:for-each>
1253
		
1254
			
1255
		<xsl:for-each select="marc:datafield[@tag=511]">
1256
			<note type="performers">
1257
				<xsl:call-template name="uri"></xsl:call-template>
1258
				<xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of>
1259
			</note>
1260
		</xsl:for-each>
1261
		<xsl:for-each select="marc:datafield[@tag=518]">
1262
			<note type="venue">
1263
				<xsl:call-template name="uri"></xsl:call-template>
1264
				<xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of>
1265
			</note>
1266
		</xsl:for-each>
1267
		
1268
		<xsl:for-each select="marc:datafield[@tag=530]">
1269
			<note  type="additional physical form">
1270
				<xsl:call-template name="uri"></xsl:call-template>
1271
				<xsl:variable name="str">
1272
					<xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1273
						<xsl:value-of select="."></xsl:value-of>
1274
						<xsl:text> </xsl:text>
1275
					</xsl:for-each>
1276
				</xsl:variable>
1277
				<xsl:value-of select="substring($str,1,string-length($str)-1)"></xsl:value-of>
1278
			</note>
1279
		</xsl:for-each>
1280
		
1281
		<xsl:for-each select="marc:datafield[@tag=533]">
1282
			<note  type="reproduction">
1283
				<xsl:call-template name="uri"></xsl:call-template>
1284
				<xsl:variable name="str">
1285
					<xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1286
						<xsl:value-of select="."></xsl:value-of>
1287
						<xsl:text> </xsl:text>
1288
					</xsl:for-each>
1289
				</xsl:variable>
1290
				<xsl:value-of select="substring($str,1,string-length($str)-1)"></xsl:value-of>
1291
			</note>
1292
		</xsl:for-each>
1293
		
1294
		<xsl:for-each select="marc:datafield[@tag=534]">
1295
			<note  type="original version">
1296
				<xsl:call-template name="uri"></xsl:call-template>
1297
				<xsl:variable name="str">
1298
					<xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1299
						<xsl:value-of select="."></xsl:value-of>
1300
						<xsl:text> </xsl:text>
1301
					</xsl:for-each>
1302
				</xsl:variable>
1303
				<xsl:value-of select="substring($str,1,string-length($str)-1)"></xsl:value-of>
1304
			</note>
1305
		</xsl:for-each>
1306
		
1307
		<xsl:for-each select="marc:datafield[@tag=538]">
1308
			<note  type="system details">
1309
				<xsl:call-template name="uri"></xsl:call-template>
1310
				<xsl:variable name="str">
1311
					<xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1312
						<xsl:value-of select="."></xsl:value-of>
1313
						<xsl:text> </xsl:text>
1314
					</xsl:for-each>
1315
				</xsl:variable>
1316
				<xsl:value-of select="substring($str,1,string-length($str)-1)"></xsl:value-of>
1317
			</note>
1318
		</xsl:for-each>
1319
		
1320
		<xsl:for-each select="marc:datafield[@tag=583]">
1321
			<note type="action">
1322
				<xsl:call-template name="uri"></xsl:call-template>
1323
				<xsl:variable name="str">
1324
					<xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1325
						<xsl:value-of select="."></xsl:value-of>
1326
						<xsl:text> </xsl:text>
1327
					</xsl:for-each>
1328
				</xsl:variable>
1329
				<xsl:value-of select="substring($str,1,string-length($str)-1)"></xsl:value-of>
1330
			</note>
1331
		</xsl:for-each>
1332
		
1333
1334
		
1335
		
1336
		
1337
		<xsl:for-each select="marc:datafield[@tag=501 or @tag=502 or @tag=504 or @tag=507 or @tag=508 or  @tag=513 or @tag=514 or @tag=515 or @tag=516 or @tag=522 or @tag=524 or @tag=525 or @tag=526 or @tag=535 or @tag=536 or @tag=540 or @tag=541 or @tag=544 or @tag=545 or @tag=546 or @tag=547 or @tag=550 or @tag=552 or @tag=555 or @tag=556 or @tag=561 or @tag=562 or @tag=565 or @tag=567 or @tag=580 or @tag=581 or @tag=584 or @tag=585 or @tag=586]">
1338
			<note>
1339
				<xsl:call-template name="uri"></xsl:call-template>
1340
				<xsl:variable name="str">
1341
					<xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1342
						<xsl:value-of select="."></xsl:value-of>
1343
						<xsl:text> </xsl:text>
1344
					</xsl:for-each>
1345
				</xsl:variable>
1346
				<xsl:value-of select="substring($str,1,string-length($str)-1)"></xsl:value-of>
1347
			</note>
1348
		</xsl:for-each>
1349
		<xsl:for-each select="marc:datafield[@tag=034][marc:subfield[@code='d' or @code='e' or @code='f' or @code='g']]">
1350
			<subject>
1351
				<cartographics>
1352
					<coordinates>
1353
						<xsl:call-template name="subfieldSelect">
1354
							<xsl:with-param name="codes">defg</xsl:with-param>
1355
						</xsl:call-template>
1356
					</coordinates>
1357
				</cartographics>
1358
			</subject>
1359
		</xsl:for-each>
1360
		<xsl:for-each select="marc:datafield[@tag=043]">
1361
			<subject>
1362
				<xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']">
1363
					<geographicCode>
1364
						<xsl:attribute name="authority">
1365
							<xsl:if test="@code='a'">
1366
								<xsl:text>marcgac</xsl:text>
1367
							</xsl:if>
1368
							<xsl:if test="@code='b'">
1369
								<xsl:value-of select="following-sibling::marc:subfield[@code=2]"></xsl:value-of>
1370
							</xsl:if>
1371
							<xsl:if test="@code='c'">
1372
								<xsl:text>iso3166</xsl:text>
1373
							</xsl:if>
1374
						</xsl:attribute>
1375
						<xsl:value-of select="self::marc:subfield"></xsl:value-of>
1376
					</geographicCode>
1377
				</xsl:for-each>
1378
			</subject>
1379
		</xsl:for-each>
1380
		<!-- tmee 2006/11/27 -->
1381
		<xsl:for-each select="marc:datafield[@tag=255]">
1382
			<subject>
1383
				<xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']">
1384
				<cartographics>
1385
					<xsl:if test="@code='a'">
1386
						<scale>
1387
							<xsl:value-of select="."></xsl:value-of>
1388
						</scale>
1389
					</xsl:if>
1390
					<xsl:if test="@code='b'">
1391
						<projection>
1392
							<xsl:value-of select="."></xsl:value-of>
1393
						</projection>
1394
					</xsl:if>
1395
					<xsl:if test="@code='c'">
1396
						<coordinates>
1397
							<xsl:value-of select="."></xsl:value-of>
1398
						</coordinates>
1399
					</xsl:if>
1400
				</cartographics>
1401
				</xsl:for-each>
1402
			</subject>
1403
		</xsl:for-each>
1404
				
1405
		<xsl:apply-templates select="marc:datafield[653 >= @tag and @tag >= 600]"></xsl:apply-templates>
1406
		<xsl:apply-templates select="marc:datafield[@tag=656]"></xsl:apply-templates>
1407
		<xsl:for-each select="marc:datafield[@tag=752]">
1408
			<subject>
1409
				<hierarchicalGeographic>
1410
					<xsl:for-each select="marc:subfield[@code='a']">
1411
						<country>
1412
							<xsl:call-template name="chopPunctuation">
1413
								<xsl:with-param name="chopString" select="."></xsl:with-param>
1414
							</xsl:call-template>
1415
						</country>
1416
					</xsl:for-each>
1417
					<xsl:for-each select="marc:subfield[@code='b']">
1418
						<state>
1419
							<xsl:call-template name="chopPunctuation">
1420
								<xsl:with-param name="chopString" select="."></xsl:with-param>
1421
							</xsl:call-template>
1422
						</state>
1423
					</xsl:for-each>
1424
					<xsl:for-each select="marc:subfield[@code='c']">
1425
						<county>
1426
							<xsl:call-template name="chopPunctuation">
1427
								<xsl:with-param name="chopString" select="."></xsl:with-param>
1428
							</xsl:call-template>
1429
						</county>
1430
					</xsl:for-each>
1431
					<xsl:for-each select="marc:subfield[@code='d']">
1432
						<city>
1433
							<xsl:call-template name="chopPunctuation">
1434
								<xsl:with-param name="chopString" select="."></xsl:with-param>
1435
							</xsl:call-template>
1436
						</city>
1437
					</xsl:for-each>
1438
				</hierarchicalGeographic>
1439
			</subject>
1440
		</xsl:for-each>
1441
		<xsl:for-each select="marc:datafield[@tag=045][marc:subfield[@code='b']]">
1442
			<subject>
1443
				<xsl:choose>
1444
					<xsl:when test="@ind1=2">
1445
						<temporal encoding="iso8601" point="start">
1446
							<xsl:call-template name="chopPunctuation">
1447
								<xsl:with-param name="chopString">
1448
									<xsl:value-of select="marc:subfield[@code='b'][1]"></xsl:value-of>
1449
								</xsl:with-param>
1450
							</xsl:call-template>
1451
						</temporal>
1452
						<temporal encoding="iso8601" point="end">
1453
							<xsl:call-template name="chopPunctuation">
1454
								<xsl:with-param name="chopString">
1455
									<xsl:value-of select="marc:subfield[@code='b'][2]"></xsl:value-of>
1456
								</xsl:with-param>
1457
							</xsl:call-template>
1458
						</temporal>
1459
					</xsl:when>
1460
					<xsl:otherwise>
1461
						<xsl:for-each select="marc:subfield[@code='b']">
1462
							<temporal encoding="iso8601">
1463
								<xsl:call-template name="chopPunctuation">
1464
									<xsl:with-param name="chopString" select="."></xsl:with-param>
1465
								</xsl:call-template>
1466
							</temporal>
1467
						</xsl:for-each>
1468
					</xsl:otherwise>
1469
				</xsl:choose>
1470
			</subject>
1471
		</xsl:for-each>
1472
		<xsl:for-each select="marc:datafield[@tag=050]">
1473
			<xsl:for-each select="marc:subfield[@code='b']">
1474
				<classification authority="lcc">
1475
					<xsl:if test="../marc:subfield[@code='3']">
1476
						<xsl:attribute name="displayLabel">
1477
							<xsl:value-of select="../marc:subfield[@code='3']"></xsl:value-of>
1478
						</xsl:attribute>
1479
					</xsl:if>
1480
					<xsl:value-of select="preceding-sibling::marc:subfield[@code='a'][1]"></xsl:value-of>
1481
					<xsl:text> </xsl:text>
1482
					<xsl:value-of select="text()"></xsl:value-of>
1483
				</classification>
1484
			</xsl:for-each>
1485
			<xsl:for-each select="marc:subfield[@code='a'][not(following-sibling::marc:subfield[@code='b'])]">
1486
				<classification authority="lcc">
1487
					<xsl:if test="../marc:subfield[@code='3']">
1488
						<xsl:attribute name="displayLabel">
1489
							<xsl:value-of select="../marc:subfield[@code='3']"></xsl:value-of>
1490
						</xsl:attribute>
1491
					</xsl:if>
1492
					<xsl:value-of select="text()"></xsl:value-of>
1493
				</classification>
1494
			</xsl:for-each>
1495
		</xsl:for-each>
1496
		<xsl:for-each select="marc:datafield[@tag=082]">
1497
			<classification authority="ddc">
1498
				<xsl:if test="marc:subfield[@code='2']">
1499
					<xsl:attribute name="edition">
1500
						<xsl:value-of select="marc:subfield[@code='2']"></xsl:value-of>
1501
					</xsl:attribute>
1502
				</xsl:if>
1503
				<xsl:call-template name="subfieldSelect">
1504
					<xsl:with-param name="codes">ab</xsl:with-param>
1505
				</xsl:call-template>
1506
			</classification>
1507
		</xsl:for-each>
1508
		<xsl:for-each select="marc:datafield[@tag=080]">
1509
			<classification authority="udc">
1510
				<xsl:call-template name="subfieldSelect">
1511
					<xsl:with-param name="codes">abx</xsl:with-param>
1512
				</xsl:call-template>
1513
			</classification>
1514
		</xsl:for-each>
1515
		<xsl:for-each select="marc:datafield[@tag=060]">
1516
			<classification authority="nlm">
1517
				<xsl:call-template name="subfieldSelect">
1518
					<xsl:with-param name="codes">ab</xsl:with-param>
1519
				</xsl:call-template>
1520
			</classification>
1521
		</xsl:for-each>
1522
		<xsl:for-each select="marc:datafield[@tag=086][@ind1=0]">
1523
			<classification authority="sudocs">
1524
				<xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of>
1525
			</classification>
1526
		</xsl:for-each>
1527
		<xsl:for-each select="marc:datafield[@tag=086][@ind1=1]">
1528
			<classification authority="candoc">
1529
				<xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of>
1530
			</classification>
1531
		</xsl:for-each>
1532
		<xsl:for-each select="marc:datafield[@tag=086]">
1533
			<classification>
1534
				<xsl:attribute name="authority">
1535
					<xsl:value-of select="marc:subfield[@code='2']"></xsl:value-of>
1536
				</xsl:attribute>
1537
				<xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of>
1538
			</classification>
1539
		</xsl:for-each>
1540
		<xsl:for-each select="marc:datafield[@tag=084]">
1541
			<classification>
1542
				<xsl:attribute name="authority">
1543
					<xsl:value-of select="marc:subfield[@code='2']"></xsl:value-of>
1544
				</xsl:attribute>
1545
				<xsl:call-template name="subfieldSelect">
1546
					<xsl:with-param name="codes">ab</xsl:with-param>
1547
				</xsl:call-template>
1548
			</classification>
1549
		</xsl:for-each>
1550
		<xsl:for-each select="marc:datafield[@tag=440]">
1551
			<relatedItem type="series">
1552
				<titleInfo>
1553
					<title>
1554
						<xsl:call-template name="chopPunctuation">
1555
							<xsl:with-param name="chopString">
1556
								<xsl:call-template name="subfieldSelect">
1557
									<xsl:with-param name="codes">av</xsl:with-param>
1558
								</xsl:call-template>
1559
							</xsl:with-param>
1560
						</xsl:call-template>
1561
					</title>
1562
					<xsl:call-template name="part"></xsl:call-template>
1563
				</titleInfo>
1564
			</relatedItem>
1565
		</xsl:for-each>
1566
		<xsl:for-each select="marc:datafield[@tag=490][@ind1=0]">
1567
			<relatedItem type="series">
1568
				<titleInfo>
1569
					<title>
1570
						<xsl:call-template name="chopPunctuation">
1571
							<xsl:with-param name="chopString">
1572
								<xsl:call-template name="subfieldSelect">
1573
									<xsl:with-param name="codes">av</xsl:with-param>
1574
								</xsl:call-template>
1575
							</xsl:with-param>
1576
						</xsl:call-template>
1577
					</title>
1578
					<xsl:call-template name="part"></xsl:call-template>
1579
				</titleInfo>
1580
			</relatedItem>
1581
		</xsl:for-each>
1582
		<xsl:for-each select="marc:datafield[@tag=510]">
1583
			<relatedItem type="isReferencedBy">
1584
				<note>
1585
					<xsl:call-template name="subfieldSelect">
1586
						<xsl:with-param name="codes">abcx3</xsl:with-param>
1587
					</xsl:call-template>
1588
				</note>
1589
			</relatedItem>
1590
		</xsl:for-each>
1591
		<xsl:for-each select="marc:datafield[@tag=534]">
1592
			<relatedItem type="original">
1593
				<xsl:call-template name="relatedTitle"></xsl:call-template>
1594
				<xsl:call-template name="relatedName"></xsl:call-template>
1595
				<xsl:if test="marc:subfield[@code='b' or @code='c']">
1596
					<originInfo>
1597
						<xsl:for-each select="marc:subfield[@code='c']">
1598
							<publisher>
1599
								<xsl:value-of select="."></xsl:value-of>
1600
							</publisher>
1601
						</xsl:for-each>
1602
						<xsl:for-each select="marc:subfield[@code='b']">
1603
							<edition>
1604
								<xsl:value-of select="."></xsl:value-of>
1605
							</edition>
1606
						</xsl:for-each>
1607
					</originInfo>
1608
				</xsl:if>
1609
				<xsl:call-template name="relatedIdentifierISSN"></xsl:call-template>
1610
				<xsl:for-each select="marc:subfield[@code='z']">
1611
					<identifier type="isbn">
1612
						<xsl:value-of select="."></xsl:value-of>
1613
					</identifier>
1614
				</xsl:for-each>
1615
				<xsl:call-template name="relatedNote"></xsl:call-template>
1616
			</relatedItem>
1617
		</xsl:for-each>
1618
		<xsl:for-each select="marc:datafield[@tag=700][marc:subfield[@code='t']]">
1619
			<relatedItem>
1620
				<xsl:call-template name="constituentOrRelatedType"></xsl:call-template>
1621
				<titleInfo>
1622
					<title>
1623
						<xsl:call-template name="chopPunctuation">
1624
							<xsl:with-param name="chopString">
1625
								<xsl:call-template name="specialSubfieldSelect">
1626
									<xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
1627
									<xsl:with-param name="axis">t</xsl:with-param>
1628
									<xsl:with-param name="afterCodes">g</xsl:with-param>
1629
								</xsl:call-template>
1630
							</xsl:with-param>
1631
						</xsl:call-template>
1632
					</title>
1633
					<xsl:call-template name="part"></xsl:call-template>
1634
				</titleInfo>
1635
				<name type="personal">
1636
					<namePart>
1637
						<xsl:call-template name="specialSubfieldSelect">
1638
							<xsl:with-param name="anyCodes">aq</xsl:with-param>
1639
							<xsl:with-param name="axis">t</xsl:with-param>
1640
							<xsl:with-param name="beforeCodes">g</xsl:with-param>
1641
						</xsl:call-template>
1642
					</namePart>
1643
					<xsl:call-template name="termsOfAddress"></xsl:call-template>
1644
					<xsl:call-template name="nameDate"></xsl:call-template>
1645
					<xsl:call-template name="role"></xsl:call-template>
1646
				</name>
1647
				<xsl:call-template name="relatedForm"></xsl:call-template>
1648
				<xsl:call-template name="relatedIdentifierISSN"></xsl:call-template>
1649
			</relatedItem>
1650
		</xsl:for-each>
1651
		<xsl:for-each select="marc:datafield[@tag=710][marc:subfield[@code='t']]">
1652
			<relatedItem>
1653
				<xsl:call-template name="constituentOrRelatedType"></xsl:call-template>
1654
				<titleInfo>
1655
					<title>
1656
						<xsl:call-template name="chopPunctuation">
1657
							<xsl:with-param name="chopString">
1658
								<xsl:call-template name="specialSubfieldSelect">
1659
									<xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
1660
									<xsl:with-param name="axis">t</xsl:with-param>
1661
									<xsl:with-param name="afterCodes">dg</xsl:with-param>
1662
								</xsl:call-template>
1663
							</xsl:with-param>
1664
						</xsl:call-template>
1665
					</title>
1666
					<xsl:call-template name="relatedPartNumName"></xsl:call-template>
1667
				</titleInfo>
1668
				<name type="corporate">
1669
					<xsl:for-each select="marc:subfield[@code='a']">
1670
						<namePart>
1671
							<xsl:value-of select="."></xsl:value-of>
1672
						</namePart>
1673
					</xsl:for-each>
1674
					<xsl:for-each select="marc:subfield[@code='b']">
1675
						<namePart>
1676
							<xsl:value-of select="."></xsl:value-of>
1677
						</namePart>
1678
					</xsl:for-each>
1679
					<xsl:variable name="tempNamePart">
1680
						<xsl:call-template name="specialSubfieldSelect">
1681
							<xsl:with-param name="anyCodes">c</xsl:with-param>
1682
							<xsl:with-param name="axis">t</xsl:with-param>
1683
							<xsl:with-param name="beforeCodes">dgn</xsl:with-param>
1684
						</xsl:call-template>
1685
					</xsl:variable>
1686
					<xsl:if test="normalize-space($tempNamePart)">
1687
						<namePart>
1688
							<xsl:value-of select="$tempNamePart"></xsl:value-of>
1689
						</namePart>
1690
					</xsl:if>
1691
					<xsl:call-template name="role"></xsl:call-template>
1692
				</name>
1693
				<xsl:call-template name="relatedForm"></xsl:call-template>
1694
				<xsl:call-template name="relatedIdentifierISSN"></xsl:call-template>
1695
			</relatedItem>
1696
		</xsl:for-each>
1697
		<xsl:for-each select="marc:datafield[@tag=711][marc:subfield[@code='t']]">
1698
			<relatedItem>
1699
				<xsl:call-template name="constituentOrRelatedType"></xsl:call-template>
1700
				<titleInfo>
1701
					<title>
1702
						<xsl:call-template name="chopPunctuation">
1703
							<xsl:with-param name="chopString">
1704
								<xsl:call-template name="specialSubfieldSelect">
1705
									<xsl:with-param name="anyCodes">tfklsv</xsl:with-param>
1706
									<xsl:with-param name="axis">t</xsl:with-param>
1707
									<xsl:with-param name="afterCodes">g</xsl:with-param>
1708
								</xsl:call-template>
1709
							</xsl:with-param>
1710
						</xsl:call-template>
1711
					</title>
1712
					<xsl:call-template name="relatedPartNumName"></xsl:call-template>
1713
				</titleInfo>
1714
				<name type="conference">
1715
					<namePart>
1716
						<xsl:call-template name="specialSubfieldSelect">
1717
							<xsl:with-param name="anyCodes">aqdc</xsl:with-param>
1718
							<xsl:with-param name="axis">t</xsl:with-param>
1719
							<xsl:with-param name="beforeCodes">gn</xsl:with-param>
1720
						</xsl:call-template>
1721
					</namePart>
1722
				</name>
1723
				<xsl:call-template name="relatedForm"></xsl:call-template>
1724
				<xsl:call-template name="relatedIdentifierISSN"></xsl:call-template>
1725
			</relatedItem>
1726
		</xsl:for-each>
1727
		<xsl:for-each select="marc:datafield[@tag=730][@ind2=2]">
1728
			<relatedItem>
1729
				<xsl:call-template name="constituentOrRelatedType"></xsl:call-template>
1730
				<titleInfo>
1731
					<title>
1732
						<xsl:call-template name="chopPunctuation">
1733
							<xsl:with-param name="chopString">
1734
								<xsl:call-template name="subfieldSelect">
1735
									<xsl:with-param name="codes">adfgklmorsv</xsl:with-param>
1736
								</xsl:call-template>
1737
							</xsl:with-param>
1738
						</xsl:call-template>
1739
					</title>
1740
					<xsl:call-template name="part"></xsl:call-template>
1741
				</titleInfo>
1742
				<xsl:call-template name="relatedForm"></xsl:call-template>
1743
				<xsl:call-template name="relatedIdentifierISSN"></xsl:call-template>
1744
			</relatedItem>
1745
		</xsl:for-each>
1746
		<xsl:for-each select="marc:datafield[@tag=740][@ind2=2]">
1747
			<relatedItem>
1748
				<xsl:call-template name="constituentOrRelatedType"></xsl:call-template>
1749
				<titleInfo>
1750
					<title>
1751
						<xsl:call-template name="chopPunctuation">
1752
							<xsl:with-param name="chopString">
1753
								<xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of>
1754
							</xsl:with-param>
1755
						</xsl:call-template>
1756
					</title>
1757
					<xsl:call-template name="part"></xsl:call-template>
1758
				</titleInfo>
1759
				<xsl:call-template name="relatedForm"></xsl:call-template>
1760
			</relatedItem>
1761
		</xsl:for-each>
1762
		<xsl:for-each select="marc:datafield[@tag=760]|marc:datafield[@tag=762]">
1763
			<relatedItem type="series">
1764
				<xsl:call-template name="relatedItem76X-78X"></xsl:call-template>
1765
			</relatedItem>
1766
		</xsl:for-each>
1767
		<xsl:for-each select="marc:datafield[@tag=765]|marc:datafield[@tag=767]|marc:datafield[@tag=777]|marc:datafield[@tag=787]">
1768
			<relatedItem>
1769
				<xsl:call-template name="relatedItem76X-78X"></xsl:call-template>
1770
			</relatedItem>
1771
		</xsl:for-each>
1772
		<xsl:for-each select="marc:datafield[@tag=775]">
1773
			<relatedItem type="otherVersion">
1774
				<xsl:call-template name="relatedItem76X-78X"></xsl:call-template>
1775
			</relatedItem>
1776
		</xsl:for-each>
1777
		<xsl:for-each select="marc:datafield[@tag=770]|marc:datafield[@tag=774]">
1778
			<relatedItem type="constituent">
1779
				<xsl:call-template name="relatedItem76X-78X"></xsl:call-template>
1780
			</relatedItem>
1781
		</xsl:for-each>
1782
		<xsl:for-each select="marc:datafield[@tag=772]|marc:datafield[@tag=773]">
1783
			<relatedItem type="host">
1784
				<xsl:call-template name="relatedItem76X-78X"></xsl:call-template>
1785
			</relatedItem>
1786
		</xsl:for-each>
1787
		<xsl:for-each select="marc:datafield[@tag=776]">
1788
			<relatedItem type="otherFormat">
1789
				<xsl:call-template name="relatedItem76X-78X"></xsl:call-template>
1790
			</relatedItem>
1791
		</xsl:for-each>
1792
		<xsl:for-each select="marc:datafield[@tag=780]">
1793
			<relatedItem type="preceding">
1794
				<xsl:call-template name="relatedItem76X-78X"></xsl:call-template>
1795
			</relatedItem>
1796
		</xsl:for-each>
1797
		<xsl:for-each select="marc:datafield[@tag=785]">
1798
			<relatedItem type="succeeding">
1799
				<xsl:call-template name="relatedItem76X-78X"></xsl:call-template>
1800
			</relatedItem>
1801
		</xsl:for-each>
1802
		<xsl:for-each select="marc:datafield[@tag=786]">
1803
			<relatedItem type="original">
1804
				<xsl:call-template name="relatedItem76X-78X"></xsl:call-template>
1805
			</relatedItem>
1806
		</xsl:for-each>
1807
		<xsl:for-each select="marc:datafield[@tag=800]">
1808
			<relatedItem type="series">
1809
				<titleInfo>
1810
					<title>
1811
						<xsl:call-template name="chopPunctuation">
1812
							<xsl:with-param name="chopString">
1813
								<xsl:call-template name="specialSubfieldSelect">
1814
									<xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
1815
									<xsl:with-param name="axis">t</xsl:with-param>
1816
									<xsl:with-param name="afterCodes">g</xsl:with-param>
1817
								</xsl:call-template>
1818
							</xsl:with-param>
1819
						</xsl:call-template>
1820
					</title>
1821
					<xsl:call-template name="part"></xsl:call-template>
1822
				</titleInfo>
1823
				<name type="personal">
1824
					<namePart>
1825
						<xsl:call-template name="chopPunctuation">
1826
							<xsl:with-param name="chopString">
1827
								<xsl:call-template name="specialSubfieldSelect">
1828
									<xsl:with-param name="anyCodes">aq</xsl:with-param>
1829
									<xsl:with-param name="axis">t</xsl:with-param>
1830
									<xsl:with-param name="beforeCodes">g</xsl:with-param>
1831
								</xsl:call-template>
1832
							</xsl:with-param>
1833
						</xsl:call-template>
1834
					</namePart>
1835
					<xsl:call-template name="termsOfAddress"></xsl:call-template>
1836
					<xsl:call-template name="nameDate"></xsl:call-template>
1837
					<xsl:call-template name="role"></xsl:call-template>
1838
				</name>
1839
				<xsl:call-template name="relatedForm"></xsl:call-template>
1840
			</relatedItem>
1841
		</xsl:for-each>
1842
		<xsl:for-each select="marc:datafield[@tag=810]">
1843
			<relatedItem type="series">
1844
				<titleInfo>
1845
					<title>
1846
						<xsl:call-template name="chopPunctuation">
1847
							<xsl:with-param name="chopString">
1848
								<xsl:call-template name="specialSubfieldSelect">
1849
									<xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
1850
									<xsl:with-param name="axis">t</xsl:with-param>
1851
									<xsl:with-param name="afterCodes">dg</xsl:with-param>
1852
								</xsl:call-template>
1853
							</xsl:with-param>
1854
						</xsl:call-template>
1855
					</title>
1856
					<xsl:call-template name="relatedPartNumName"></xsl:call-template>
1857
				</titleInfo>
1858
				<name type="corporate">
1859
					<xsl:for-each select="marc:subfield[@code='a']">
1860
						<namePart>
1861
							<xsl:value-of select="."></xsl:value-of>
1862
						</namePart>
1863
					</xsl:for-each>
1864
					<xsl:for-each select="marc:subfield[@code='b']">
1865
						<namePart>
1866
							<xsl:value-of select="."></xsl:value-of>
1867
						</namePart>
1868
					</xsl:for-each>
1869
					<namePart>
1870
						<xsl:call-template name="specialSubfieldSelect">
1871
							<xsl:with-param name="anyCodes">c</xsl:with-param>
1872
							<xsl:with-param name="axis">t</xsl:with-param>
1873
							<xsl:with-param name="beforeCodes">dgn</xsl:with-param>
1874
						</xsl:call-template>
1875
					</namePart>
1876
					<xsl:call-template name="role"></xsl:call-template>
1877
				</name>
1878
				<xsl:call-template name="relatedForm"></xsl:call-template>
1879
			</relatedItem>
1880
		</xsl:for-each>
1881
		<xsl:for-each select="marc:datafield[@tag=811]">
1882
			<relatedItem type="series">
1883
				<titleInfo>
1884
					<title>
1885
						<xsl:call-template name="chopPunctuation">
1886
							<xsl:with-param name="chopString">
1887
								<xsl:call-template name="specialSubfieldSelect">
1888
									<xsl:with-param name="anyCodes">tfklsv</xsl:with-param>
1889
									<xsl:with-param name="axis">t</xsl:with-param>
1890
									<xsl:with-param name="afterCodes">g</xsl:with-param>
1891
								</xsl:call-template>
1892
							</xsl:with-param>
1893
						</xsl:call-template>
1894
					</title>
1895
					<xsl:call-template name="relatedPartNumName"/>
1896
				</titleInfo>
1897
				<name type="conference">
1898
					<namePart>
1899
						<xsl:call-template name="specialSubfieldSelect">
1900
							<xsl:with-param name="anyCodes">aqdc</xsl:with-param>
1901
							<xsl:with-param name="axis">t</xsl:with-param>
1902
							<xsl:with-param name="beforeCodes">gn</xsl:with-param>
1903
						</xsl:call-template>
1904
					</namePart>
1905
					<xsl:call-template name="role"/>
1906
				</name>
1907
				<xsl:call-template name="relatedForm"/>
1908
			</relatedItem>
1909
		</xsl:for-each>
1910
		<xsl:for-each select="marc:datafield[@tag='830']">
1911
			<relatedItem type="series">
1912
				<titleInfo>
1913
					<title>
1914
						<xsl:call-template name="chopPunctuation">
1915
							<xsl:with-param name="chopString">
1916
								<xsl:call-template name="subfieldSelect">
1917
									<xsl:with-param name="codes">adfgklmorsv</xsl:with-param>
1918
								</xsl:call-template>
1919
							</xsl:with-param>
1920
						</xsl:call-template>
1921
					</title>
1922
					<xsl:call-template name="part"/>
1923
				</titleInfo>
1924
				<xsl:call-template name="relatedForm"/>
1925
			</relatedItem>
1926
		</xsl:for-each>
1927
		<xsl:for-each select="marc:datafield[@tag='856'][@ind2='2']/marc:subfield[@code='q']">
1928
			<relatedItem>
1929
				<internetMediaType>
1930
					<xsl:value-of select="."/>
1931
				</internetMediaType>
1932
			</relatedItem>
1933
		</xsl:for-each>
1934
		<xsl:for-each select="marc:datafield[@tag='020']">
1935
			<xsl:call-template name="isInvalid">
1936
				<xsl:with-param name="type">isbn</xsl:with-param>
1937
			</xsl:call-template>
1938
			<xsl:if test="marc:subfield[@code='a']">
1939
				<identifier type="isbn">
1940
					<xsl:value-of select="marc:subfield[@code='a']"/>
1941
				</identifier>
1942
			</xsl:if>
1943
		</xsl:for-each>
1944
		<xsl:for-each select="marc:datafield[@tag='024'][@ind1='0']">
1945
			<xsl:call-template name="isInvalid">
1946
				<xsl:with-param name="type">isrc</xsl:with-param>
1947
			</xsl:call-template>
1948
			<xsl:if test="marc:subfield[@code='a']">
1949
				<identifier type="isrc">
1950
					<xsl:value-of select="marc:subfield[@code='a']"/>
1951
				</identifier>
1952
			</xsl:if>
1953
		</xsl:for-each>
1954
		<xsl:for-each select="marc:datafield[@tag='024'][@ind1='2']">
1955
			<xsl:call-template name="isInvalid">
1956
				<xsl:with-param name="type">ismn</xsl:with-param>
1957
			</xsl:call-template>
1958
			<xsl:if test="marc:subfield[@code='a']">
1959
				<identifier type="ismn">
1960
					<xsl:value-of select="marc:subfield[@code='a']"/>
1961
				</identifier>
1962
			</xsl:if>
1963
		</xsl:for-each>
1964
		<xsl:for-each select="marc:datafield[@tag='024'][@ind1='4']">
1965
			<xsl:call-template name="isInvalid">
1966
				<xsl:with-param name="type">sici</xsl:with-param>
1967
			</xsl:call-template>
1968
			<identifier type="sici">
1969
				<xsl:call-template name="subfieldSelect">
1970
					<xsl:with-param name="codes">ab</xsl:with-param>
1971
				</xsl:call-template>
1972
			</identifier>
1973
		</xsl:for-each>
1974
		<xsl:for-each select="marc:datafield[@tag='022']">
1975
			<xsl:call-template name="isInvalid">
1976
				<xsl:with-param name="type">issn</xsl:with-param>
1977
			</xsl:call-template>
1978
			<identifier type="issn">
1979
				<xsl:value-of select="marc:subfield[@code='a']"/>
1980
			</identifier>
1981
		</xsl:for-each>
1982
		<xsl:for-each select="marc:datafield[@tag='010']">
1983
			<xsl:call-template name="isInvalid">
1984
				<xsl:with-param name="type">lccn</xsl:with-param>
1985
			</xsl:call-template>
1986
			<identifier type="lccn">
1987
				<xsl:value-of select="normalize-space(marc:subfield[@code='a'])"/>
1988
			</identifier>
1989
		</xsl:for-each>
1990
		<xsl:for-each select="marc:datafield[@tag='028']">
1991
			<identifier>
1992
				<xsl:attribute name="type">
1993
					<xsl:choose>
1994
						<xsl:when test="@ind1='0'">issue number</xsl:when>
1995
						<xsl:when test="@ind1='1'">matrix number</xsl:when>
1996
						<xsl:when test="@ind1='2'">music plate</xsl:when>
1997
						<xsl:when test="@ind1='3'">music publisher</xsl:when>
1998
						<xsl:when test="@ind1='4'">videorecording identifier</xsl:when>
1999
					</xsl:choose>
2000
				</xsl:attribute>
2001
				<!--<xsl:call-template name="isInvalid"/>--> <!-- no $z in 028 -->
2002
				<xsl:call-template name="subfieldSelect">
2003
					<xsl:with-param name="codes">
2004
						<xsl:choose>
2005
							<xsl:when test="@ind1='0'">ba</xsl:when>
2006
							<xsl:otherwise>ab</xsl:otherwise>
2007
						</xsl:choose>
2008
					</xsl:with-param>
2009
				</xsl:call-template>
2010
			</identifier>
2011
		</xsl:for-each>
2012
		<xsl:for-each select="marc:datafield[@tag='037']">
2013
			<identifier type="stock number">
2014
				<!--<xsl:call-template name="isInvalid"/>--> <!-- no $z in 037 -->
2015
				<xsl:call-template name="subfieldSelect">
2016
					<xsl:with-param name="codes">ab</xsl:with-param>
2017
				</xsl:call-template>
2018
			</identifier>
2019
		</xsl:for-each>
2020
		<xsl:for-each select="marc:datafield[@tag='856'][marc:subfield[@code='u']]">
2021
			<identifier>
2022
				<xsl:attribute name="type">
2023
					<xsl:choose>
2024
						<xsl:when test="starts-with(marc:subfield[@code='u'],'urn:doi') or starts-with(marc:subfield[@code='u'],'doi')">doi</xsl:when>
2025
						<xsl:when test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl') or starts-with(marc:subfield[@code='u'],'http://hdl.loc.gov')">hdl</xsl:when>
2026
						<xsl:otherwise>uri</xsl:otherwise>
2027
					</xsl:choose>
2028
				</xsl:attribute>
2029
				<xsl:choose>
2030
					<xsl:when test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl') or starts-with(marc:subfield[@code='u'],'http://hdl.loc.gov') ">
2031
						<xsl:value-of select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))"></xsl:value-of>
2032
					</xsl:when>
2033
					<xsl:otherwise>
2034
						<xsl:value-of select="marc:subfield[@code='u']"></xsl:value-of>
2035
					</xsl:otherwise>
2036
				</xsl:choose>
2037
			</identifier>
2038
			<xsl:if test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl')">
2039
				<identifier type="hdl">
2040
					<xsl:if test="marc:subfield[@code='y' or @code='3' or @code='z']">
2041
						<xsl:attribute name="displayLabel">
2042
							<xsl:call-template name="subfieldSelect">
2043
								<xsl:with-param name="codes">y3z</xsl:with-param>
2044
							</xsl:call-template>
2045
						</xsl:attribute>
2046
					</xsl:if>
2047
					<xsl:value-of select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))"></xsl:value-of>
2048
				</identifier>
2049
			</xsl:if>
2050
		</xsl:for-each>
2051
		<xsl:for-each select="marc:datafield[@tag=024][@ind1=1]">
2052
			<identifier type="upc">
2053
				<xsl:call-template name="isInvalid"/>
2054
				<xsl:value-of select="marc:subfield[@code='a']"/>
2055
			</identifier>
2056
		</xsl:for-each>
2057
		<!-- 1/04 fix added $y -->
2058
		<xsl:for-each select="marc:datafield[@tag=856][marc:subfield[@code='u']]">
2059
			<location>
2060
				<url>
2061
					<xsl:if test="marc:subfield[@code='y' or @code='3']">
2062
						<xsl:attribute name="displayLabel">
2063
							<xsl:call-template name="subfieldSelect">
2064
								<xsl:with-param name="codes">y3</xsl:with-param>
2065
							</xsl:call-template>
2066
						</xsl:attribute>
2067
					</xsl:if>
2068
					<xsl:if test="marc:subfield[@code='z' ]">
2069
						<xsl:attribute name="note">
2070
							<xsl:call-template name="subfieldSelect">
2071
								<xsl:with-param name="codes">z</xsl:with-param>
2072
							</xsl:call-template>
2073
						</xsl:attribute>
2074
					</xsl:if>
2075
					<xsl:value-of select="marc:subfield[@code='u']"></xsl:value-of>
2076
2077
				</url>
2078
			</location>
2079
		</xsl:for-each>
2080
			
2081
			<!-- 3.2 change tmee 856z  -->
2082
2083
		
2084
		<xsl:for-each select="marc:datafield[@tag=852]">
2085
			<location>
2086
				<physicalLocation>
2087
					<xsl:call-template name="displayLabel"></xsl:call-template>
2088
					<xsl:call-template name="subfieldSelect">
2089
						<xsl:with-param name="codes">abje</xsl:with-param>
2090
					</xsl:call-template>
2091
				</physicalLocation>
2092
			</location>
2093
		</xsl:for-each>
2094
		<xsl:for-each select="marc:datafield[@tag=506]">
2095
			<accessCondition type="restrictionOnAccess">
2096
				<xsl:call-template name="subfieldSelect">
2097
					<xsl:with-param name="codes">abcd35</xsl:with-param>
2098
				</xsl:call-template>
2099
			</accessCondition>
2100
		</xsl:for-each>
2101
		<xsl:for-each select="marc:datafield[@tag=540]">
2102
			<accessCondition type="useAndReproduction">
2103
				<xsl:call-template name="subfieldSelect">
2104
					<xsl:with-param name="codes">abcde35</xsl:with-param>
2105
				</xsl:call-template>
2106
			</accessCondition>
2107
		</xsl:for-each>
2108
		<recordInfo>
2109
			<xsl:for-each select="marc:datafield[@tag=040]">
2110
				<recordContentSource authority="marcorg">
2111
					<xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of>
2112
				</recordContentSource>
2113
			</xsl:for-each>
2114
			<xsl:for-each select="marc:controlfield[@tag=008]">
2115
				<recordCreationDate encoding="marc">
2116
					<xsl:value-of select="substring(.,1,6)"></xsl:value-of>
2117
				</recordCreationDate>
2118
			</xsl:for-each>
2119
			<xsl:for-each select="marc:controlfield[@tag=005]">
2120
				<recordChangeDate encoding="iso8601">
2121
					<xsl:value-of select="."></xsl:value-of>
2122
				</recordChangeDate>
2123
			</xsl:for-each>
2124
			<xsl:for-each select="marc:controlfield[@tag=001]">
2125
				<recordIdentifier>
2126
					<xsl:if test="../marc:controlfield[@tag=003]">
2127
						<xsl:attribute name="source">
2128
							<xsl:value-of select="../marc:controlfield[@tag=003]"></xsl:value-of>
2129
						</xsl:attribute>
2130
					</xsl:if>
2131
					<xsl:value-of select="."></xsl:value-of>
2132
				</recordIdentifier>
2133
			</xsl:for-each>
2134
			<xsl:for-each select="marc:datafield[@tag=040]/marc:subfield[@code='b']">
2135
				<languageOfCataloging>
2136
					<languageTerm authority="iso639-2b" type="code">
2137
						<xsl:value-of select="."></xsl:value-of>
2138
					</languageTerm>
2139
				</languageOfCataloging>
2140
			</xsl:for-each>
2141
		</recordInfo>
2142
	</xsl:template>
2143
	<xsl:template name="displayForm">
2144
		<xsl:for-each select="marc:subfield[@code='c']">
2145
			<displayForm>
2146
				<xsl:value-of select="."></xsl:value-of>
2147
			</displayForm>
2148
		</xsl:for-each>
2149
	</xsl:template>
2150
	<xsl:template name="affiliation">
2151
		<xsl:for-each select="marc:subfield[@code='u']">
2152
			<affiliation>
2153
				<xsl:value-of select="."></xsl:value-of>
2154
			</affiliation>
2155
		</xsl:for-each>
2156
	</xsl:template>
2157
	<xsl:template name="uri">
2158
		<xsl:for-each select="marc:subfield[@code='u']">
2159
			<xsl:attribute name="xlink:href">
2160
				<xsl:value-of select="."></xsl:value-of>
2161
			</xsl:attribute>
2162
		</xsl:for-each>
2163
	</xsl:template>
2164
	<xsl:template name="role">
2165
		<xsl:for-each select="marc:subfield[@code='e']">
2166
			<role>
2167
				<roleTerm type="text">
2168
					<xsl:value-of select="."></xsl:value-of>
2169
				</roleTerm>
2170
			</role>
2171
		</xsl:for-each>
2172
		<xsl:for-each select="marc:subfield[@code='4']">
2173
			<role>
2174
				<roleTerm authority="marcrelator" type="code">
2175
					<xsl:value-of select="."></xsl:value-of>
2176
				</roleTerm>
2177
			</role>
2178
		</xsl:for-each>
2179
	</xsl:template>
2180
	<xsl:template name="part">
2181
		<xsl:variable name="partNumber">
2182
			<xsl:call-template name="specialSubfieldSelect">
2183
				<xsl:with-param name="axis">n</xsl:with-param>
2184
				<xsl:with-param name="anyCodes">n</xsl:with-param>
2185
				<xsl:with-param name="afterCodes">fgkdlmor</xsl:with-param>
2186
			</xsl:call-template>
2187
		</xsl:variable>
2188
		<xsl:variable name="partName">
2189
			<xsl:call-template name="specialSubfieldSelect">
2190
				<xsl:with-param name="axis">p</xsl:with-param>
2191
				<xsl:with-param name="anyCodes">p</xsl:with-param>
2192
				<xsl:with-param name="afterCodes">fgkdlmor</xsl:with-param>
2193
			</xsl:call-template>
2194
		</xsl:variable>
2195
		<xsl:if test="string-length(normalize-space($partNumber))">
2196
			<partNumber>
2197
				<xsl:call-template name="chopPunctuation">
2198
					<xsl:with-param name="chopString" select="$partNumber"></xsl:with-param>
2199
				</xsl:call-template>
2200
			</partNumber>
2201
		</xsl:if>
2202
		<xsl:if test="string-length(normalize-space($partName))">
2203
			<partName>
2204
				<xsl:call-template name="chopPunctuation">
2205
					<xsl:with-param name="chopString" select="$partName"></xsl:with-param>
2206
				</xsl:call-template>
2207
			</partName>
2208
		</xsl:if>
2209
	</xsl:template>
2210
	<xsl:template name="relatedPart">
2211
		<xsl:if test="@tag=773">
2212
			<xsl:for-each select="marc:subfield[@code='g']">
2213
				<part>
2214
					<text>
2215
						<xsl:value-of select="."></xsl:value-of>
2216
					</text>
2217
				</part>
2218
			</xsl:for-each>
2219
			<xsl:for-each select="marc:subfield[@code='q']">
2220
				<part>
2221
					<xsl:call-template name="parsePart"></xsl:call-template>
2222
				</part>
2223
			</xsl:for-each>
2224
		</xsl:if>
2225
	</xsl:template>
2226
	<xsl:template name="relatedPartNumName">
2227
		<xsl:variable name="partNumber">
2228
			<xsl:call-template name="specialSubfieldSelect">
2229
				<xsl:with-param name="axis">g</xsl:with-param>
2230
				<xsl:with-param name="anyCodes">g</xsl:with-param>
2231
				<xsl:with-param name="afterCodes">pst</xsl:with-param>
2232
			</xsl:call-template>
2233
		</xsl:variable>
2234
		<xsl:variable name="partName">
2235
			<xsl:call-template name="specialSubfieldSelect">
2236
				<xsl:with-param name="axis">p</xsl:with-param>
2237
				<xsl:with-param name="anyCodes">p</xsl:with-param>
2238
				<xsl:with-param name="afterCodes">fgkdlmor</xsl:with-param>
2239
			</xsl:call-template>
2240
		</xsl:variable>
2241
		<xsl:if test="string-length(normalize-space($partNumber))">
2242
			<partNumber>
2243
				<xsl:value-of select="$partNumber"></xsl:value-of>
2244
			</partNumber>
2245
		</xsl:if>
2246
		<xsl:if test="string-length(normalize-space($partName))">
2247
			<partName>
2248
				<xsl:value-of select="$partName"></xsl:value-of>
2249
			</partName>
2250
		</xsl:if>
2251
	</xsl:template>
2252
	<xsl:template name="relatedName">
2253
		<xsl:for-each select="marc:subfield[@code='a']">
2254
			<name>
2255
				<namePart>
2256
					<xsl:value-of select="."></xsl:value-of>
2257
				</namePart>
2258
			</name>
2259
		</xsl:for-each>
2260
	</xsl:template>
2261
	<xsl:template name="relatedForm">
2262
		<xsl:for-each select="marc:subfield[@code='h']">
2263
			<physicalDescription>
2264
				<form>
2265
					<xsl:value-of select="."></xsl:value-of>
2266
				</form>
2267
			</physicalDescription>
2268
		</xsl:for-each>
2269
	</xsl:template>
2270
	<xsl:template name="relatedExtent">
2271
		<xsl:for-each select="marc:subfield[@code='h']">
2272
			<physicalDescription>
2273
				<extent>
2274
					<xsl:value-of select="."></xsl:value-of>
2275
				</extent>
2276
			</physicalDescription>
2277
		</xsl:for-each>
2278
	</xsl:template>
2279
	<xsl:template name="relatedNote">
2280
		<xsl:for-each select="marc:subfield[@code='n']">
2281
			<note>
2282
				<xsl:value-of select="."></xsl:value-of>
2283
			</note>
2284
		</xsl:for-each>
2285
	</xsl:template>
2286
	<xsl:template name="relatedSubject">
2287
		<xsl:for-each select="marc:subfield[@code='j']">
2288
			<subject>
2289
				<temporal encoding="iso8601">
2290
					<xsl:call-template name="chopPunctuation">
2291
						<xsl:with-param name="chopString" select="."></xsl:with-param>
2292
					</xsl:call-template>
2293
				</temporal>
2294
			</subject>
2295
		</xsl:for-each>
2296
	</xsl:template>
2297
	<xsl:template name="relatedIdentifierISSN">
2298
		<xsl:for-each select="marc:subfield[@code='x']">
2299
			<identifier type="issn">
2300
				<xsl:value-of select="."></xsl:value-of>
2301
			</identifier>
2302
		</xsl:for-each>
2303
	</xsl:template>
2304
	<xsl:template name="relatedIdentifierLocal">
2305
		<xsl:for-each select="marc:subfield[@code='w']">
2306
			<identifier type="local">
2307
				<xsl:value-of select="."></xsl:value-of>
2308
			</identifier>
2309
		</xsl:for-each>
2310
	</xsl:template>
2311
	<xsl:template name="relatedIdentifier">
2312
		<xsl:for-each select="marc:subfield[@code='o']">
2313
			<identifier>
2314
				<xsl:value-of select="."></xsl:value-of>
2315
			</identifier>
2316
		</xsl:for-each>
2317
	</xsl:template>
2318
	<xsl:template name="relatedItem76X-78X">
2319
		<xsl:call-template name="displayLabel"></xsl:call-template>
2320
		<xsl:call-template name="relatedTitle76X-78X"></xsl:call-template>
2321
		<xsl:call-template name="relatedName"></xsl:call-template>
2322
		<xsl:call-template name="relatedOriginInfo"></xsl:call-template>
2323
		<xsl:call-template name="relatedLanguage"></xsl:call-template>
2324
		<xsl:call-template name="relatedExtent"></xsl:call-template>
2325
		<xsl:call-template name="relatedNote"></xsl:call-template>
2326
		<xsl:call-template name="relatedSubject"></xsl:call-template>
2327
		<xsl:call-template name="relatedIdentifier"></xsl:call-template>
2328
		<xsl:call-template name="relatedIdentifierISSN"></xsl:call-template>
2329
		<xsl:call-template name="relatedIdentifierLocal"></xsl:call-template>
2330
		<xsl:call-template name="relatedPart"></xsl:call-template>
2331
	</xsl:template>
2332
	<xsl:template name="subjectGeographicZ">
2333
		<geographic>
2334
			<xsl:call-template name="chopPunctuation">
2335
				<xsl:with-param name="chopString" select="."></xsl:with-param>
2336
			</xsl:call-template>
2337
		</geographic>
2338
	</xsl:template>
2339
	<xsl:template name="subjectTemporalY">
2340
		<temporal>
2341
			<xsl:call-template name="chopPunctuation">
2342
				<xsl:with-param name="chopString" select="."></xsl:with-param>
2343
			</xsl:call-template>
2344
		</temporal>
2345
	</xsl:template>
2346
	<xsl:template name="subjectTopic">
2347
		<topic>
2348
			<xsl:call-template name="chopPunctuation">
2349
				<xsl:with-param name="chopString" select="."></xsl:with-param>
2350
			</xsl:call-template>
2351
		</topic>
2352
	</xsl:template>	
2353
	<!-- 3.2 change tmee 6xx $v genre -->
2354
	<xsl:template name="subjectGenre">
2355
		<genre>
2356
			<xsl:call-template name="chopPunctuation">
2357
				<xsl:with-param name="chopString" select="."></xsl:with-param>
2358
			</xsl:call-template>
2359
		</genre>
2360
	</xsl:template>
2361
	
2362
	<xsl:template name="nameABCDN">
2363
		<xsl:for-each select="marc:subfield[@code='a']">
2364
			<namePart>
2365
				<xsl:call-template name="chopPunctuation">
2366
					<xsl:with-param name="chopString" select="."></xsl:with-param>
2367
				</xsl:call-template>
2368
			</namePart>
2369
		</xsl:for-each>
2370
		<xsl:for-each select="marc:subfield[@code='b']">
2371
			<namePart>
2372
				<xsl:value-of select="."></xsl:value-of>
2373
			</namePart>
2374
		</xsl:for-each>
2375
		<xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
2376
			<namePart>
2377
				<xsl:call-template name="subfieldSelect">
2378
					<xsl:with-param name="codes">cdn</xsl:with-param>
2379
				</xsl:call-template>
2380
			</namePart>
2381
		</xsl:if>
2382
	</xsl:template>
2383
	<xsl:template name="nameABCDQ">
2384
		<namePart>
2385
			<xsl:call-template name="chopPunctuation">
2386
				<xsl:with-param name="chopString">
2387
					<xsl:call-template name="subfieldSelect">
2388
						<xsl:with-param name="codes">aq</xsl:with-param>
2389
					</xsl:call-template>
2390
				</xsl:with-param>
2391
				<xsl:with-param name="punctuation">
2392
					<xsl:text>:,;/ </xsl:text>
2393
				</xsl:with-param>
2394
			</xsl:call-template>
2395
		</namePart>
2396
		<xsl:call-template name="termsOfAddress"></xsl:call-template>
2397
		<xsl:call-template name="nameDate"></xsl:call-template>
2398
	</xsl:template>
2399
	<xsl:template name="nameACDEQ">
2400
		<namePart>
2401
			<xsl:call-template name="subfieldSelect">
2402
				<xsl:with-param name="codes">acdeq</xsl:with-param>
2403
			</xsl:call-template>
2404
		</namePart>
2405
	</xsl:template>
2406
	<xsl:template name="constituentOrRelatedType">
2407
		<xsl:if test="@ind2=2">
2408
			<xsl:attribute name="type">constituent</xsl:attribute>
2409
		</xsl:if>
2410
	</xsl:template>
2411
	<xsl:template name="relatedTitle">
2412
		<xsl:for-each select="marc:subfield[@code='t']">
2413
			<titleInfo>
2414
				<title>
2415
					<xsl:call-template name="chopPunctuation">
2416
						<xsl:with-param name="chopString">
2417
							<xsl:value-of select="."></xsl:value-of>
2418
						</xsl:with-param>
2419
					</xsl:call-template>
2420
				</title>
2421
			</titleInfo>
2422
		</xsl:for-each>
2423
	</xsl:template>
2424
	<xsl:template name="relatedTitle76X-78X">
2425
		<xsl:for-each select="marc:subfield[@code='t']">
2426
			<titleInfo>
2427
				<title>
2428
					<xsl:call-template name="chopPunctuation">
2429
						<xsl:with-param name="chopString">
2430
							<xsl:value-of select="."></xsl:value-of>
2431
						</xsl:with-param>
2432
					</xsl:call-template>
2433
				</title>
2434
				<xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
2435
					<xsl:call-template name="relatedPartNumName"></xsl:call-template>
2436
				</xsl:if>
2437
			</titleInfo>
2438
		</xsl:for-each>
2439
		<xsl:for-each select="marc:subfield[@code='p']">
2440
			<titleInfo type="abbreviated">
2441
				<title>
2442
					<xsl:call-template name="chopPunctuation">
2443
						<xsl:with-param name="chopString">
2444
							<xsl:value-of select="."></xsl:value-of>
2445
						</xsl:with-param>
2446
					</xsl:call-template>
2447
				</title>
2448
				<xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
2449
					<xsl:call-template name="relatedPartNumName"></xsl:call-template>
2450
				</xsl:if>
2451
			</titleInfo>
2452
		</xsl:for-each>
2453
		<xsl:for-each select="marc:subfield[@code='s']">
2454
			<titleInfo type="uniform">
2455
				<title>
2456
					<xsl:call-template name="chopPunctuation">
2457
						<xsl:with-param name="chopString">
2458
							<xsl:value-of select="."></xsl:value-of>
2459
						</xsl:with-param>
2460
					</xsl:call-template>
2461
				</title>
2462
				<xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
2463
					<xsl:call-template name="relatedPartNumName"></xsl:call-template>
2464
				</xsl:if>
2465
			</titleInfo>
2466
		</xsl:for-each>
2467
	</xsl:template>
2468
	<xsl:template name="relatedOriginInfo">
2469
		<xsl:if test="marc:subfield[@code='b' or @code='d'] or marc:subfield[@code='f']">
2470
			<originInfo>
2471
				<xsl:if test="@tag=775">
2472
					<xsl:for-each select="marc:subfield[@code='f']">
2473
						<place>
2474
							<placeTerm>
2475
								<xsl:attribute name="type">code</xsl:attribute>
2476
								<xsl:attribute name="authority">marcgac</xsl:attribute>
2477
								<xsl:value-of select="."></xsl:value-of>
2478
							</placeTerm>
2479
						</place>
2480
					</xsl:for-each>
2481
				</xsl:if>
2482
				<xsl:for-each select="marc:subfield[@code='d']">
2483
					<publisher>
2484
						<xsl:value-of select="."></xsl:value-of>
2485
					</publisher>
2486
				</xsl:for-each>
2487
				<xsl:for-each select="marc:subfield[@code='b']">
2488
					<edition>
2489
						<xsl:value-of select="."></xsl:value-of>
2490
					</edition>
2491
				</xsl:for-each>
2492
			</originInfo>
2493
		</xsl:if>
2494
	</xsl:template>
2495
	<xsl:template name="relatedLanguage">
2496
		<xsl:for-each select="marc:subfield[@code='e']">
2497
			<xsl:call-template name="getLanguage">
2498
				<xsl:with-param name="langString">
2499
					<xsl:value-of select="."></xsl:value-of>
2500
				</xsl:with-param>
2501
			</xsl:call-template>
2502
		</xsl:for-each>
2503
	</xsl:template>
2504
	<xsl:template name="nameDate">
2505
		<xsl:for-each select="marc:subfield[@code='d']">
2506
			<namePart type="date">
2507
				<xsl:call-template name="chopPunctuation">
2508
					<xsl:with-param name="chopString" select="."></xsl:with-param>
2509
				</xsl:call-template>
2510
			</namePart>
2511
		</xsl:for-each>
2512
	</xsl:template>
2513
	<xsl:template name="subjectAuthority">
2514
		<xsl:if test="@ind2!=4">
2515
			<xsl:if test="@ind2!=' '">
2516
				<xsl:if test="@ind2!=8">
2517
					<xsl:if test="@ind2!=9">
2518
						<xsl:attribute name="authority">
2519
							<xsl:choose>
2520
								<xsl:when test="@ind2=0">lcsh</xsl:when>
2521
								<xsl:when test="@ind2=1">lcshac</xsl:when>
2522
								<xsl:when test="@ind2=2">mesh</xsl:when>
2523
								<!-- 1/04 fix -->
2524
								<xsl:when test="@ind2=3">nal</xsl:when>
2525
								<xsl:when test="@ind2=5">csh</xsl:when>
2526
								<xsl:when test="@ind2=6">rvm</xsl:when>
2527
								<xsl:when test="@ind2=7">
2528
									<xsl:value-of select="marc:subfield[@code='2']"></xsl:value-of>
2529
								</xsl:when>
2530
							</xsl:choose>
2531
						</xsl:attribute>
2532
					</xsl:if>
2533
				</xsl:if>
2534
			</xsl:if>
2535
		</xsl:if>
2536
	</xsl:template>
2537
	<xsl:template name="subjectAnyOrder">
2538
		<xsl:for-each select="marc:subfield[@code='v' or @code='x' or @code='y' or @code='z']">
2539
			<xsl:choose>
2540
				<xsl:when test="@code='v'">
2541
					<xsl:call-template name="subjectGenre"></xsl:call-template>
2542
				</xsl:when>
2543
				<xsl:when test="@code='x'">
2544
					<xsl:call-template name="subjectTopic"></xsl:call-template>
2545
				</xsl:when>
2546
				<xsl:when test="@code='y'">
2547
					<xsl:call-template name="subjectTemporalY"></xsl:call-template>
2548
				</xsl:when>
2549
				<xsl:when test="@code='z'">
2550
					<xsl:call-template name="subjectGeographicZ"></xsl:call-template>
2551
				</xsl:when>
2552
			</xsl:choose>
2553
		</xsl:for-each>
2554
	</xsl:template>
2555
	<xsl:template name="specialSubfieldSelect">
2556
		<xsl:param name="anyCodes"></xsl:param>
2557
		<xsl:param name="axis"></xsl:param>
2558
		<xsl:param name="beforeCodes"></xsl:param>
2559
		<xsl:param name="afterCodes"></xsl:param>
2560
		<xsl:variable name="str">
2561
			<xsl:for-each select="marc:subfield">
2562
				<xsl:if test="contains($anyCodes, @code)      or (contains($beforeCodes,@code) and following-sibling::marc:subfield[@code=$axis])      or (contains($afterCodes,@code) and preceding-sibling::marc:subfield[@code=$axis])">
2563
					<xsl:value-of select="text()"></xsl:value-of>
2564
					<xsl:text> </xsl:text>
2565
				</xsl:if>
2566
			</xsl:for-each>
2567
		</xsl:variable>
2568
		<xsl:value-of select="substring($str,1,string-length($str)-1)"></xsl:value-of>
2569
	</xsl:template>
2570
	
2571
	<!-- 3.2 change tmee 6xx $v genre -->
2572
	<xsl:template match="marc:datafield[@tag=600]">
2573
		<subject>
2574
			<xsl:call-template name="subjectAuthority"></xsl:call-template>
2575
			<name type="personal">
2576
				<xsl:call-template name="termsOfAddress"></xsl:call-template>
2577
				<namePart>
2578
					<xsl:call-template name="chopPunctuation">
2579
						<xsl:with-param name="chopString">
2580
							<xsl:call-template name="subfieldSelect">
2581
								<xsl:with-param name="codes">aq</xsl:with-param>
2582
							</xsl:call-template>
2583
						</xsl:with-param>
2584
					</xsl:call-template>
2585
				</namePart>
2586
				<xsl:call-template name="nameDate"></xsl:call-template>
2587
				<xsl:call-template name="affiliation"></xsl:call-template>
2588
				<xsl:call-template name="role"></xsl:call-template>
2589
			</name>
2590
			<xsl:call-template name="subjectAnyOrder"></xsl:call-template>
2591
		</subject>
2592
	</xsl:template>
2593
	<xsl:template match="marc:datafield[@tag=610]">
2594
		<subject>
2595
			<xsl:call-template name="subjectAuthority"></xsl:call-template>
2596
			<name type="corporate">
2597
				<xsl:for-each select="marc:subfield[@code='a']">
2598
					<namePart>
2599
						<xsl:value-of select="."></xsl:value-of>
2600
					</namePart>
2601
				</xsl:for-each>
2602
				<xsl:for-each select="marc:subfield[@code='b']">
2603
					<namePart>
2604
						<xsl:value-of select="."></xsl:value-of>
2605
					</namePart>
2606
				</xsl:for-each>
2607
				<xsl:if test="marc:subfield[@code='c' or @code='d' or @code='n' or @code='p']">
2608
					<namePart>
2609
						<xsl:call-template name="subfieldSelect">
2610
							<xsl:with-param name="codes">cdnp</xsl:with-param>
2611
						</xsl:call-template>
2612
					</namePart>
2613
				</xsl:if>
2614
				<xsl:call-template name="role"></xsl:call-template>
2615
			</name>
2616
			<xsl:call-template name="subjectAnyOrder"></xsl:call-template>
2617
		</subject>
2618
	</xsl:template>
2619
	<xsl:template match="marc:datafield[@tag=611]">
2620
		<subject>
2621
			<xsl:call-template name="subjectAuthority"></xsl:call-template>
2622
			<name type="conference">
2623
				<namePart>
2624
					<xsl:call-template name="subfieldSelect">
2625
						<xsl:with-param name="codes">abcdeqnp</xsl:with-param>
2626
					</xsl:call-template>
2627
				</namePart>
2628
				<xsl:for-each select="marc:subfield[@code='4']">
2629
					<role>
2630
						<roleTerm authority="marcrelator" type="code">
2631
							<xsl:value-of select="."></xsl:value-of>
2632
						</roleTerm>
2633
					</role>
2634
				</xsl:for-each>
2635
			</name>
2636
			<xsl:call-template name="subjectAnyOrder"></xsl:call-template>
2637
		</subject>
2638
	</xsl:template>
2639
	<xsl:template match="marc:datafield[@tag=630]">
2640
		<subject>
2641
			<xsl:call-template name="subjectAuthority"></xsl:call-template>
2642
			<titleInfo>
2643
				<title>
2644
					<xsl:call-template name="chopPunctuation">
2645
						<xsl:with-param name="chopString">
2646
							<xsl:call-template name="subfieldSelect">
2647
								<xsl:with-param name="codes">adfhklor</xsl:with-param>
2648
							</xsl:call-template>
2649
						</xsl:with-param>
2650
					</xsl:call-template>
2651
					<xsl:call-template name="part"></xsl:call-template>
2652
				</title>
2653
			</titleInfo>
2654
			<xsl:call-template name="subjectAnyOrder"></xsl:call-template>
2655
		</subject>
2656
	</xsl:template>
2657
	<xsl:template match="marc:datafield[@tag=650]">
2658
		<subject>
2659
			<xsl:call-template name="subjectAuthority"></xsl:call-template>
2660
			<topic>
2661
				<xsl:call-template name="chopPunctuation">
2662
					<xsl:with-param name="chopString">
2663
						<xsl:call-template name="subfieldSelect">
2664
							<xsl:with-param name="codes">abcd</xsl:with-param>
2665
						</xsl:call-template>
2666
					</xsl:with-param>
2667
				</xsl:call-template>
2668
			</topic>
2669
			<xsl:call-template name="subjectAnyOrder"></xsl:call-template>
2670
		</subject>
2671
	</xsl:template>
2672
	<xsl:template match="marc:datafield[@tag=651]">
2673
		<subject>
2674
			<xsl:call-template name="subjectAuthority"></xsl:call-template>
2675
			<xsl:for-each select="marc:subfield[@code='a']">
2676
				<geographic>
2677
					<xsl:call-template name="chopPunctuation">
2678
						<xsl:with-param name="chopString" select="."></xsl:with-param>
2679
					</xsl:call-template>
2680
				</geographic>
2681
			</xsl:for-each>
2682
			<xsl:call-template name="subjectAnyOrder"></xsl:call-template>
2683
		</subject>
2684
	</xsl:template>
2685
	<xsl:template match="marc:datafield[@tag=653]">
2686
		<subject>
2687
			<xsl:for-each select="marc:subfield[@code='a']">
2688
				<topic>
2689
					<xsl:value-of select="."></xsl:value-of>
2690
				</topic>
2691
			</xsl:for-each>
2692
		</subject>
2693
	</xsl:template>
2694
	<xsl:template match="marc:datafield[@tag=656]">
2695
		<subject>
2696
			<xsl:if test="marc:subfield[@code=2]">
2697
				<xsl:attribute name="authority">
2698
					<xsl:value-of select="marc:subfield[@code=2]"></xsl:value-of>
2699
				</xsl:attribute>
2700
			</xsl:if>
2701
			<occupation>
2702
				<xsl:call-template name="chopPunctuation">
2703
					<xsl:with-param name="chopString">
2704
						<xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of>
2705
					</xsl:with-param>
2706
				</xsl:call-template>
2707
			</occupation>
2708
		</subject>
2709
	</xsl:template>
2710
	<xsl:template name="termsOfAddress">
2711
		<xsl:if test="marc:subfield[@code='b' or @code='c']">
2712
			<namePart type="termsOfAddress">
2713
				<xsl:call-template name="chopPunctuation">
2714
					<xsl:with-param name="chopString">
2715
						<xsl:call-template name="subfieldSelect">
2716
							<xsl:with-param name="codes">bc</xsl:with-param>
2717
						</xsl:call-template>
2718
					</xsl:with-param>
2719
				</xsl:call-template>
2720
			</namePart>
2721
		</xsl:if>
2722
	</xsl:template>
2723
	<xsl:template name="displayLabel">
2724
		<xsl:if test="marc:subfield[@code='i']">
2725
			<xsl:attribute name="displayLabel">
2726
				<xsl:value-of select="marc:subfield[@code='i']"></xsl:value-of>
2727
			</xsl:attribute>
2728
		</xsl:if>
2729
		<xsl:if test="marc:subfield[@code='3']">
2730
			<xsl:attribute name="displayLabel">
2731
				<xsl:value-of select="marc:subfield[@code='3']"></xsl:value-of>
2732
			</xsl:attribute>
2733
		</xsl:if>
2734
	</xsl:template>
2735
	<xsl:template name="isInvalid">
2736
		<xsl:param name="type"/>
2737
		<xsl:if test="marc:subfield[@code='z'] or marc:subfield[@code='y']">
2738
			<identifier>
2739
				<xsl:attribute name="type">
2740
					<xsl:value-of select="$type"/>
2741
				</xsl:attribute>
2742
				<xsl:attribute name="invalid">
2743
					<xsl:text>yes</xsl:text>
2744
				</xsl:attribute>
2745
				<xsl:if test="marc:subfield[@code='z']">
2746
					<xsl:value-of select="marc:subfield[@code='z']"/>
2747
				</xsl:if>
2748
				<xsl:if test="marc:subfield[@code='y']">
2749
					<xsl:value-of select="marc:subfield[@code='y']"/>
2750
				</xsl:if>
2751
			</identifier>
2752
		</xsl:if>
2753
	</xsl:template>
2754
	<xsl:template name="subtitle">
2755
		<xsl:if test="marc:subfield[@code='b']">
2756
			<subTitle>
2757
				<xsl:call-template name="chopPunctuation">
2758
					<xsl:with-param name="chopString">
2759
						<xsl:value-of select="marc:subfield[@code='b']"/>
2760
						<!--<xsl:call-template name="subfieldSelect">
2761
							<xsl:with-param name="codes">b</xsl:with-param>									
2762
						</xsl:call-template>-->
2763
					</xsl:with-param>
2764
				</xsl:call-template>
2765
			</subTitle>
2766
		</xsl:if>
2767
	</xsl:template>
2768
	<xsl:template name="script">
2769
		<xsl:param name="scriptCode"></xsl:param>
2770
		<xsl:attribute name="script">
2771
			<xsl:choose>
2772
				<xsl:when test="$scriptCode='(3'">Arabic</xsl:when>
2773
				<xsl:when test="$scriptCode='(B'">Latin</xsl:when>
2774
				<xsl:when test="$scriptCode='$1'">Chinese, Japanese, Korean</xsl:when>
2775
				<xsl:when test="$scriptCode='(N'">Cyrillic</xsl:when>
2776
				<xsl:when test="$scriptCode='(2'">Hebrew</xsl:when>
2777
				<xsl:when test="$scriptCode='(S'">Greek</xsl:when>
2778
			</xsl:choose>
2779
		</xsl:attribute>
2780
	</xsl:template>
2781
	<xsl:template name="parsePart">
2782
		<!-- assumes 773$q= 1:2:3<4
2783
		     with up to 3 levels and one optional start page
2784
		-->
2785
		<xsl:variable name="level1">
2786
			<xsl:choose>
2787
				<xsl:when test="contains(text(),':')">
2788
					<!-- 1:2 -->
2789
					<xsl:value-of select="substring-before(text(),':')"></xsl:value-of>
2790
				</xsl:when>
2791
				<xsl:when test="not(contains(text(),':'))">
2792
					<!-- 1 or 1<3 -->
2793
					<xsl:if test="contains(text(),'&lt;')">
2794
						<!-- 1<3 -->
2795
						<xsl:value-of select="substring-before(text(),'&lt;')"></xsl:value-of>
2796
					</xsl:if>
2797
					<xsl:if test="not(contains(text(),'&lt;'))">
2798
						<!-- 1 -->
2799
						<xsl:value-of select="text()"></xsl:value-of>
2800
					</xsl:if>
2801
				</xsl:when>
2802
			</xsl:choose>
2803
		</xsl:variable>
2804
		<xsl:variable name="sici2">
2805
			<xsl:choose>
2806
				<xsl:when test="starts-with(substring-after(text(),$level1),':')">
2807
					<xsl:value-of select="substring(substring-after(text(),$level1),2)"></xsl:value-of>
2808
				</xsl:when>
2809
				<xsl:otherwise>
2810
					<xsl:value-of select="substring-after(text(),$level1)"></xsl:value-of>
2811
				</xsl:otherwise>
2812
			</xsl:choose>
2813
		</xsl:variable>
2814
		<xsl:variable name="level2">
2815
			<xsl:choose>
2816
				<xsl:when test="contains($sici2,':')">
2817
					<!--  2:3<4  -->
2818
					<xsl:value-of select="substring-before($sici2,':')"></xsl:value-of>
2819
				</xsl:when>
2820
				<xsl:when test="contains($sici2,'&lt;')">
2821
					<!-- 1: 2<4 -->
2822
					<xsl:value-of select="substring-before($sici2,'&lt;')"></xsl:value-of>
2823
				</xsl:when>
2824
				<xsl:otherwise>
2825
					<xsl:value-of select="$sici2"></xsl:value-of>
2826
					<!-- 1:2 -->
2827
				</xsl:otherwise>
2828
			</xsl:choose>
2829
		</xsl:variable>
2830
		<xsl:variable name="sici3">
2831
			<xsl:choose>
2832
				<xsl:when test="starts-with(substring-after($sici2,$level2),':')">
2833
					<xsl:value-of select="substring(substring-after($sici2,$level2),2)"></xsl:value-of>
2834
				</xsl:when>
2835
				<xsl:otherwise>
2836
					<xsl:value-of select="substring-after($sici2,$level2)"></xsl:value-of>
2837
				</xsl:otherwise>
2838
			</xsl:choose>
2839
		</xsl:variable>
2840
		<xsl:variable name="level3">
2841
			<xsl:choose>
2842
				<xsl:when test="contains($sici3,'&lt;')">
2843
					<!-- 2<4 -->
2844
					<xsl:value-of select="substring-before($sici3,'&lt;')"></xsl:value-of>
2845
				</xsl:when>
2846
				<xsl:otherwise>
2847
					<xsl:value-of select="$sici3"></xsl:value-of>
2848
					<!-- 3 -->
2849
				</xsl:otherwise>
2850
			</xsl:choose>
2851
		</xsl:variable>
2852
		<xsl:variable name="page">
2853
			<xsl:if test="contains(text(),'&lt;')">
2854
				<xsl:value-of select="substring-after(text(),'&lt;')"></xsl:value-of>
2855
			</xsl:if>
2856
		</xsl:variable>
2857
		<xsl:if test="$level1">
2858
			<detail level="1">
2859
				<number>
2860
					<xsl:value-of select="$level1"></xsl:value-of>
2861
				</number>
2862
			</detail>
2863
		</xsl:if>
2864
		<xsl:if test="$level2">
2865
			<detail level="2">
2866
				<number>
2867
					<xsl:value-of select="$level2"></xsl:value-of>
2868
				</number>
2869
			</detail>
2870
		</xsl:if>
2871
		<xsl:if test="$level3">
2872
			<detail level="3">
2873
				<number>
2874
					<xsl:value-of select="$level3"></xsl:value-of>
2875
				</number>
2876
			</detail>
2877
		</xsl:if>
2878
		<xsl:if test="$page">
2879
			<extent unit="page">
2880
				<start>
2881
					<xsl:value-of select="$page"></xsl:value-of>
2882
				</start>
2883
			</extent>
2884
		</xsl:if>
2885
	</xsl:template>
2886
	<xsl:template name="getLanguage">
2887
		<xsl:param name="langString"></xsl:param>
2888
		<xsl:param name="controlField008-35-37"></xsl:param>
2889
		<xsl:variable name="length" select="string-length($langString)"></xsl:variable>
2890
		<xsl:choose>
2891
			<xsl:when test="$length=0"></xsl:when>
2892
			<xsl:when test="$controlField008-35-37=substring($langString,1,3)">
2893
				<xsl:call-template name="getLanguage">
2894
					<xsl:with-param name="langString" select="substring($langString,4,$length)"></xsl:with-param>
2895
					<xsl:with-param name="controlField008-35-37" select="$controlField008-35-37"></xsl:with-param>
2896
				</xsl:call-template>
2897
			</xsl:when>
2898
			<xsl:otherwise>
2899
				<language>
2900
					<languageTerm authority="iso639-2b" type="code">
2901
						<xsl:value-of select="substring($langString,1,3)"></xsl:value-of>
2902
					</languageTerm>
2903
				</language>
2904
				<xsl:call-template name="getLanguage">
2905
					<xsl:with-param name="langString" select="substring($langString,4,$length)"></xsl:with-param>
2906
					<xsl:with-param name="controlField008-35-37" select="$controlField008-35-37"></xsl:with-param>
2907
				</xsl:call-template>
2908
			</xsl:otherwise>
2909
		</xsl:choose>
2910
	</xsl:template>
2911
	<xsl:template name="isoLanguage">
2912
		<xsl:param name="currentLanguage"></xsl:param>
2913
		<xsl:param name="usedLanguages"></xsl:param>
2914
		<xsl:param name="remainingLanguages"></xsl:param>
2915
		<xsl:choose>
2916
			<xsl:when test="string-length($currentLanguage)=0"></xsl:when>
2917
			<xsl:when test="not(contains($usedLanguages, $currentLanguage))">
2918
				<language>
2919
					<xsl:if test="@code!='a'">
2920
						<xsl:attribute name="objectPart">
2921
							<xsl:choose>
2922
								<xsl:when test="@code='b'">summary or subtitle</xsl:when>
2923
								<xsl:when test="@code='d'">sung or spoken text</xsl:when>
2924
								<xsl:when test="@code='e'">libretto</xsl:when>
2925
								<xsl:when test="@code='f'">table of contents</xsl:when>
2926
								<xsl:when test="@code='g'">accompanying material</xsl:when>
2927
								<xsl:when test="@code='h'">translation</xsl:when>
2928
							</xsl:choose>
2929
						</xsl:attribute>
2930
					</xsl:if>
2931
					<languageTerm authority="iso639-2b" type="code">
2932
						<xsl:value-of select="$currentLanguage"></xsl:value-of>
2933
					</languageTerm>
2934
				</language>
2935
				<xsl:call-template name="isoLanguage">
2936
					<xsl:with-param name="currentLanguage">
2937
						<xsl:value-of select="substring($remainingLanguages,1,3)"></xsl:value-of>
2938
					</xsl:with-param>
2939
					<xsl:with-param name="usedLanguages">
2940
						<xsl:value-of select="concat($usedLanguages,$currentLanguage)"></xsl:value-of>
2941
					</xsl:with-param>
2942
					<xsl:with-param name="remainingLanguages">
2943
						<xsl:value-of select="substring($remainingLanguages,4,string-length($remainingLanguages))"></xsl:value-of>
2944
					</xsl:with-param>
2945
				</xsl:call-template>
2946
			</xsl:when>
2947
			<xsl:otherwise>
2948
				<xsl:call-template name="isoLanguage">
2949
					<xsl:with-param name="currentLanguage">
2950
						<xsl:value-of select="substring($remainingLanguages,1,3)"></xsl:value-of>
2951
					</xsl:with-param>
2952
					<xsl:with-param name="usedLanguages">
2953
						<xsl:value-of select="concat($usedLanguages,$currentLanguage)"></xsl:value-of>
2954
					</xsl:with-param>
2955
					<xsl:with-param name="remainingLanguages">
2956
						<xsl:value-of select="substring($remainingLanguages,4,string-length($remainingLanguages))"></xsl:value-of>
2957
					</xsl:with-param>
2958
				</xsl:call-template>
2959
			</xsl:otherwise>
2960
		</xsl:choose>
2961
	</xsl:template>
2962
	<xsl:template name="chopBrackets">
2963
		<xsl:param name="chopString"></xsl:param>
2964
		<xsl:variable name="string">
2965
			<xsl:call-template name="chopPunctuation">
2966
				<xsl:with-param name="chopString" select="$chopString"></xsl:with-param>
2967
			</xsl:call-template>
2968
		</xsl:variable>
2969
		<xsl:if test="substring($string, 1,1)='['">
2970
			<xsl:value-of select="substring($string,2, string-length($string)-2)"></xsl:value-of>
2971
		</xsl:if>
2972
		<xsl:if test="substring($string, 1,1)!='['">
2973
			<xsl:value-of select="$string"></xsl:value-of>
2974
		</xsl:if>
2975
	</xsl:template>
2976
	<xsl:template name="rfcLanguages">
2977
		<xsl:param name="nodeNum"></xsl:param>
2978
		<xsl:param name="usedLanguages"></xsl:param>
2979
		<xsl:param name="controlField008-35-37"></xsl:param>
2980
		<xsl:variable name="currentLanguage" select="."></xsl:variable>
2981
		<xsl:choose>
2982
			<xsl:when test="not($currentLanguage)"></xsl:when>
2983
			<xsl:when test="$currentLanguage!=$controlField008-35-37 and $currentLanguage!='rfc3066'">
2984
				<xsl:if test="not(contains($usedLanguages,$currentLanguage))">
2985
					<language>
2986
						<xsl:if test="@code!='a'">
2987
							<xsl:attribute name="objectPart">
2988
								<xsl:choose>
2989
									<xsl:when test="@code='b'">summary or subtitle</xsl:when>
2990
									<xsl:when test="@code='d'">sung or spoken text</xsl:when>
2991
									<xsl:when test="@code='e'">libretto</xsl:when>
2992
									<xsl:when test="@code='f'">table of contents</xsl:when>
2993
									<xsl:when test="@code='g'">accompanying material</xsl:when>
2994
									<xsl:when test="@code='h'">translation</xsl:when>
2995
								</xsl:choose>
2996
							</xsl:attribute>
2997
						</xsl:if>
2998
						<languageTerm authority="rfc3066" type="code">
2999
							<xsl:value-of select="$currentLanguage"/>
3000
						</languageTerm>
3001
					</language>
3002
				</xsl:if>
3003
			</xsl:when>
3004
			<xsl:otherwise>
3005
			</xsl:otherwise>
3006
		</xsl:choose>
3007
	</xsl:template>
3008
</xsl:stylesheet>
3009
- 

Return to bug 29629