3 -- check whether patch can be applied
4 SELECT evergreen.upgrade_deps_block_check('0816', :eg_version);
6 -- To avoid problems with altering a table column after doing an
8 ALTER TABLE authority.control_set_authority_field
11 ALTER TABLE authority.control_set_authority_field
12 ADD COLUMN display_sf_list TEXT;
14 UPDATE authority.control_set_authority_field
15 SET display_sf_list = REGEXP_REPLACE(sf_list, '[w254]', '', 'g');
17 ALTER TABLE authority.control_set_authority_field
18 ALTER COLUMN display_sf_list SET NOT NULL;
20 ALTER TABLE authority.control_set_authority_field
23 ALTER TABLE metabib.browse_entry_def_map
24 ADD COLUMN authority BIGINT REFERENCES authority.record_entry (id)
27 ALTER TABLE config.metabib_field ADD COLUMN authority_xpath TEXT;
28 ALTER TABLE config.metabib_field ADD COLUMN browse_sort_xpath TEXT;
30 UPDATE config.metabib_field
31 SET authority_xpath = '//@xlink:href'
34 field_class IN ('subject','series','title','author') AND
37 ALTER TYPE metabib.field_entry_template ADD ATTRIBUTE authority BIGINT;
38 ALTER TYPE metabib.field_entry_template ADD ATTRIBUTE sort_value TEXT;
40 CREATE OR REPLACE FUNCTION metabib.reingest_metabib_field_entries( bib_id BIGINT, skip_facet BOOL DEFAULT FALSE, skip_browse BOOL DEFAULT FALSE, skip_search BOOL DEFAULT FALSE ) RETURNS VOID AS $func$
43 ind_data metabib.field_entry_template%ROWTYPE;
44 mbe_row metabib.browse_entry%ROWTYPE;
52 SELECT COALESCE(NULLIF(skip_facet, FALSE), EXISTS (SELECT enabled FROM config.internal_flag WHERE name = 'ingest.skip_facet_indexing' AND enabled)) INTO b_skip_facet;
53 SELECT COALESCE(NULLIF(skip_browse, FALSE), EXISTS (SELECT enabled FROM config.internal_flag WHERE name = 'ingest.skip_browse_indexing' AND enabled)) INTO b_skip_browse;
54 SELECT COALESCE(NULLIF(skip_search, FALSE), EXISTS (SELECT enabled FROM config.internal_flag WHERE name = 'ingest.skip_search_indexing' AND enabled)) INTO b_skip_search;
56 PERFORM * FROM config.internal_flag WHERE name = 'ingest.assume_inserts_only' AND enabled;
58 IF NOT b_skip_search THEN
59 FOR fclass IN SELECT * FROM config.metabib_class LOOP
60 -- RAISE NOTICE 'Emptying out %', fclass.name;
61 EXECUTE $$DELETE FROM metabib.$$ || fclass.name || $$_field_entry WHERE source = $$ || bib_id;
64 IF NOT b_skip_facet THEN
65 DELETE FROM metabib.facet_entry WHERE source = bib_id;
67 IF NOT b_skip_browse THEN
68 DELETE FROM metabib.browse_entry_def_map WHERE source = bib_id;
72 FOR ind_data IN SELECT * FROM biblio.extract_metabib_field_entry( bib_id ) LOOP
73 IF ind_data.field < 0 THEN
74 ind_data.field = -1 * ind_data.field;
77 IF ind_data.facet_field AND NOT b_skip_facet THEN
78 INSERT INTO metabib.facet_entry (field, source, value)
79 VALUES (ind_data.field, ind_data.source, ind_data.value);
82 IF ind_data.browse_field AND NOT b_skip_browse THEN
83 -- A caveat about this SELECT: this should take care of replacing
84 -- old mbe rows when data changes, but not if normalization (by
85 -- which I mean specifically the output of
86 -- evergreen.oils_tsearch2()) changes. It may or may not be
87 -- expensive to add a comparison of index_vector to index_vector
88 -- to the WHERE clause below.
90 value_prepped := metabib.browse_normalize(ind_data.value, ind_data.field);
91 SELECT INTO mbe_row * FROM metabib.browse_entry
92 WHERE value = value_prepped AND sort_value = ind_data.sort_value;
97 INSERT INTO metabib.browse_entry
98 ( value, sort_value ) VALUES
99 ( value_prepped, ind_data.sort_value );
101 mbe_id := CURRVAL('metabib.browse_entry_id_seq'::REGCLASS);
104 INSERT INTO metabib.browse_entry_def_map (entry, def, source, authority)
105 VALUES (mbe_id, ind_data.field, ind_data.source, ind_data.authority);
108 IF ind_data.search_field AND NOT b_skip_search THEN
110 INSERT INTO metabib.$$ || ind_data.field_class || $$_field_entry (field, source, value)
112 quote_literal(ind_data.field) || $$, $$ ||
113 quote_literal(ind_data.source) || $$, $$ ||
114 quote_literal(ind_data.value) ||
120 IF NOT b_skip_search THEN
121 PERFORM metabib.update_combined_index_vectors(bib_id);
126 $func$ LANGUAGE PLPGSQL;
129 CREATE OR REPLACE FUNCTION biblio.extract_metabib_field_entry ( rid BIGINT, default_joiner TEXT ) RETURNS SETOF metabib.field_entry_template AS $func$
131 bib biblio.record_entry%ROWTYPE;
132 idx config.metabib_field%ROWTYPE;
133 xfrm config.xml_transform%ROWTYPE;
135 transformed_xml TEXT;
137 xml_node_list TEXT[];
143 joiner TEXT := default_joiner; -- XXX will index defs supply a joiner?
145 authority_link BIGINT;
146 output_row metabib.field_entry_template%ROWTYPE;
150 SELECT INTO bib * FROM biblio.record_entry WHERE id = rid;
152 -- Loop over the indexing entries
153 FOR idx IN SELECT * FROM config.metabib_field ORDER BY format LOOP
155 SELECT INTO xfrm * from config.xml_transform WHERE name = idx.format;
157 -- See if we can skip the XSLT ... it's expensive
158 IF prev_xfrm IS NULL OR prev_xfrm <> xfrm.name THEN
159 -- Can't skip the transform
160 IF xfrm.xslt <> '---' THEN
161 transformed_xml := oils_xslt_process(bib.marc,xfrm.xslt);
163 transformed_xml := bib.marc;
166 prev_xfrm := xfrm.name;
169 xml_node_list := oils_xpath( idx.xpath, transformed_xml, ARRAY[ARRAY[xfrm.prefix, xfrm.namespace_uri]] );
172 FOR xml_node IN SELECT x FROM unnest(xml_node_list) AS x LOOP
173 CONTINUE WHEN xml_node !~ E'^\\s*<';
175 curr_text := ARRAY_TO_STRING(
176 oils_xpath( '//text()',
177 REGEXP_REPLACE( -- This escapes all &s not followed by "amp;". Data ise returned from oils_xpath (above) in UTF-8, not entity encoded
178 REGEXP_REPLACE( -- This escapes embeded <s
180 $re$(>[^<]+)(<)([^>]+<)$re$,
192 CONTINUE WHEN curr_text IS NULL OR curr_text = '';
194 IF raw_text IS NOT NULL THEN
195 raw_text := raw_text || joiner;
198 raw_text := COALESCE(raw_text,'') || curr_text;
200 -- autosuggest/metabib.browse_entry
201 IF idx.browse_field THEN
203 IF idx.browse_xpath IS NOT NULL AND idx.browse_xpath <> '' THEN
204 browse_text := oils_xpath_string( idx.browse_xpath, xml_node, joiner, ARRAY[ARRAY[xfrm.prefix, xfrm.namespace_uri]] );
206 browse_text := curr_text;
209 IF idx.browse_sort_xpath IS NOT NULL AND
210 idx.browse_sort_xpath <> '' THEN
212 sort_value := oils_xpath_string(
213 idx.browse_sort_xpath, xml_node, joiner,
214 ARRAY[ARRAY[xfrm.prefix, xfrm.namespace_uri]]
217 sort_value := browse_text;
220 output_row.field_class = idx.field_class;
221 output_row.field = idx.id;
222 output_row.source = rid;
223 output_row.value = BTRIM(REGEXP_REPLACE(browse_text, E'\\s+', ' ', 'g'));
224 output_row.sort_value :=
225 public.search_normalize(sort_value);
227 output_row.authority := NULL;
229 IF idx.authority_xpath IS NOT NULL AND idx.authority_xpath <> '' THEN
230 authority_text := oils_xpath_string(
231 idx.authority_xpath, xml_node, joiner,
233 ARRAY[xfrm.prefix, xfrm.namespace_uri],
234 ARRAY['xlink','http://www.w3.org/1999/xlink']
238 IF authority_text ~ '^\d+$' THEN
239 authority_link := authority_text::BIGINT;
240 PERFORM * FROM authority.record_entry WHERE id = authority_link;
242 output_row.authority := authority_link;
248 output_row.browse_field = TRUE;
249 RETURN NEXT output_row;
250 output_row.browse_field = FALSE;
251 output_row.sort_value := NULL;
254 -- insert raw node text for faceting
255 IF idx.facet_field THEN
257 IF idx.facet_xpath IS NOT NULL AND idx.facet_xpath <> '' THEN
258 facet_text := oils_xpath_string( idx.facet_xpath, xml_node, joiner, ARRAY[ARRAY[xfrm.prefix, xfrm.namespace_uri]] );
260 facet_text := curr_text;
263 output_row.field_class = idx.field_class;
264 output_row.field = -1 * idx.id;
265 output_row.source = rid;
266 output_row.value = BTRIM(REGEXP_REPLACE(facet_text, E'\\s+', ' ', 'g'));
268 output_row.facet_field = TRUE;
269 RETURN NEXT output_row;
270 output_row.facet_field = FALSE;
275 CONTINUE WHEN raw_text IS NULL OR raw_text = '';
277 -- insert combined node text for searching
278 IF idx.search_field THEN
279 output_row.field_class = idx.field_class;
280 output_row.field = idx.id;
281 output_row.source = rid;
282 output_row.value = BTRIM(REGEXP_REPLACE(raw_text, E'\\s+', ' ', 'g'));
284 output_row.search_field = TRUE;
285 RETURN NEXT output_row;
286 output_row.search_field = FALSE;
293 $func$ LANGUAGE PLPGSQL;
296 -- 953.data.MODS32-xsl.sql
297 UPDATE config.xml_transform SET xslt=$$<?xml version="1.0" encoding="UTF-8"?>
298 <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">
299 <xsl:output encoding="UTF-8" indent="yes" method="xml"/>
301 Revision 1.14 - Fixed template isValid and fields 010, 020, 022, 024, 028, and 037 to output additional identifier elements
302 with corresponding @type and @invalid eq 'yes' when subfields z or y (in the case of 022) exist in the MARCXML ::: 2007/01/04 17:35:20 cred
304 Revision 1.13 - Changed order of output under cartographics to reflect schema 2006/11/28 tmee
306 Revision 1.12 - Updated to reflect MODS 3.2 Mapping 2006/10/11 tmee
308 Revision 1.11 - The attribute objectPart moved from <languageTerm> to <language>
311 Revision 1.10 MODS 3.1 revisions to language and classification elements
312 (plus ability to find marc:collection embedded in wrapper elements such as SRU zs: wrappers)
315 Revision 1.9 subfield $y was added to field 242 2004/09/02 10:57 jrad
317 Revision 1.8 Subject chopPunctuation expanded and attribute fixes 2004/08/12 jrad
319 Revision 1.7 2004/03/25 08:29 jrad
321 Revision 1.6 various validation fixes 2004/02/20 ntra
323 Revision 1.5 2003/10/02 16:18:58 ntra
324 MODS2 to MODS3 updates, language unstacking and
325 de-duping, chopPunctuation expanded
327 Revision 1.3 2003/04/03 00:07:19 ntra
328 Revision 1.3 Additional Changes not related to MODS Version 2.0 by ntra
330 Revision 1.2 2003/03/24 19:37:42 ckeith
334 <xsl:template match="/">
336 <xsl:when test="//marc:collection">
337 <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">
338 <xsl:for-each select="//marc:collection/marc:record">
340 <xsl:call-template name="marcRecord"/>
346 <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">
347 <xsl:for-each select="//marc:record">
348 <xsl:call-template name="marcRecord"/>
354 <xsl:template name="marcRecord">
355 <xsl:variable name="leader" select="marc:leader"/>
356 <xsl:variable name="leader6" select="substring($leader,7,1)"/>
357 <xsl:variable name="leader7" select="substring($leader,8,1)"/>
358 <xsl:variable name="controlField008" select="marc:controlfield[@tag='008']"/>
359 <xsl:variable name="typeOf008">
361 <xsl:when test="$leader6='a'">
363 <xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
364 <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">SE</xsl:when>
367 <xsl:when test="$leader6='t'">BK</xsl:when>
368 <xsl:when test="$leader6='p'">MM</xsl:when>
369 <xsl:when test="$leader6='m'">CF</xsl:when>
370 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
371 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">VM</xsl:when>
372 <xsl:when test="$leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'">MU</xsl:when>
375 <xsl:for-each select="marc:datafield[@tag='245']">
377 <xsl:variable name="title">
379 <xsl:when test="marc:subfield[@code='b']">
380 <xsl:call-template name="specialSubfieldSelect">
381 <xsl:with-param name="axis">b</xsl:with-param>
382 <xsl:with-param name="beforeCodes">afgk</xsl:with-param>
386 <xsl:call-template name="subfieldSelect">
387 <xsl:with-param name="codes">abfgk</xsl:with-param>
392 <xsl:variable name="titleChop">
393 <xsl:call-template name="chopPunctuation">
394 <xsl:with-param name="chopString">
395 <xsl:value-of select="$title"/>
400 <xsl:when test="@ind2>0">
402 <xsl:value-of select="substring($titleChop,1,@ind2)"/>
405 <xsl:value-of select="substring($titleChop,@ind2+1)"/>
410 <xsl:value-of select="$titleChop"/>
414 <xsl:if test="marc:subfield[@code='b']">
416 <xsl:call-template name="chopPunctuation">
417 <xsl:with-param name="chopString">
418 <xsl:call-template name="specialSubfieldSelect">
419 <xsl:with-param name="axis">b</xsl:with-param>
420 <xsl:with-param name="anyCodes">b</xsl:with-param>
421 <xsl:with-param name="afterCodes">afgk</xsl:with-param>
427 <xsl:call-template name="part"></xsl:call-template>
429 <!-- A form of title that ignores non-filing characters; useful
430 for not converting "L'Oreal" into "L' Oreal" at index time -->
432 <xsl:variable name="title">
434 <xsl:when test="marc:subfield[@code='b']">
435 <xsl:call-template name="specialSubfieldSelect">
436 <xsl:with-param name="axis">b</xsl:with-param>
437 <xsl:with-param name="beforeCodes">afgk</xsl:with-param>
441 <xsl:call-template name="subfieldSelect">
442 <xsl:with-param name="codes">abfgk</xsl:with-param>
448 <xsl:value-of select="$title"/>
450 <xsl:if test="marc:subfield[@code='b']">
452 <xsl:call-template name="chopPunctuation">
453 <xsl:with-param name="chopString">
454 <xsl:call-template name="specialSubfieldSelect">
455 <xsl:with-param name="axis">b</xsl:with-param>
456 <xsl:with-param name="anyCodes">b</xsl:with-param>
457 <xsl:with-param name="afterCodes">afgk</xsl:with-param>
463 <xsl:call-template name="part"></xsl:call-template>
466 <xsl:for-each select="marc:datafield[@tag='210']">
467 <titleInfo type="abbreviated">
469 <xsl:call-template name="chopPunctuation">
470 <xsl:with-param name="chopString">
471 <xsl:call-template name="subfieldSelect">
472 <xsl:with-param name="codes">a</xsl:with-param>
477 <xsl:call-template name="subtitle"/>
480 <xsl:for-each select="marc:datafield[@tag='242']">
481 <xsl:variable name="titleChop">
482 <xsl:call-template name="chopPunctuation">
483 <xsl:with-param name="chopString">
484 <xsl:call-template name="subfieldSelect">
485 <!-- 1/04 removed $h, b -->
486 <xsl:with-param name="codes">a</xsl:with-param>
491 <titleInfo type="translated">
492 <!--09/01/04 Added subfield $y-->
493 <xsl:for-each select="marc:subfield[@code='y']">
494 <xsl:attribute name="lang">
495 <xsl:value-of select="text()"/>
499 <xsl:value-of select="$titleChop" />
502 <xsl:call-template name="subtitle"/>
503 <xsl:call-template name="part"/>
505 <titleInfo type="translated-nfi">
506 <xsl:for-each select="marc:subfield[@code='y']">
507 <xsl:attribute name="lang">
508 <xsl:value-of select="text()"/>
512 <xsl:when test="@ind2>0">
514 <xsl:value-of select="substring($titleChop,1,@ind2)"/>
517 <xsl:value-of select="substring($titleChop,@ind2+1)"/>
522 <xsl:value-of select="$titleChop" />
526 <xsl:call-template name="subtitle"/>
527 <xsl:call-template name="part"/>
530 <xsl:for-each select="marc:datafield[@tag='246']">
531 <titleInfo type="alternative">
532 <xsl:for-each select="marc:subfield[@code='i']">
533 <xsl:attribute name="displayLabel">
534 <xsl:value-of select="text()"/>
538 <xsl:call-template name="chopPunctuation">
539 <xsl:with-param name="chopString">
540 <xsl:call-template name="subfieldSelect">
541 <!-- 1/04 removed $h, $b -->
542 <xsl:with-param name="codes">af</xsl:with-param>
547 <xsl:call-template name="subtitle"/>
548 <xsl:call-template name="part"/>
551 <xsl:for-each select="marc:datafield[@tag='130']|marc:datafield[@tag='240']|marc:datafield[@tag='730'][@ind2!='2']">
552 <xsl:variable name="nfi">
554 <xsl:when test="@tag='240'">
555 <xsl:value-of select="@ind2"/>
558 <xsl:value-of select="@ind1"/>
562 <xsl:variable name="titleChop">
563 <xsl:call-template name="uri" />
564 <xsl:variable name="str">
565 <xsl:for-each select="marc:subfield">
566 <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'])))">
567 <xsl:value-of select="text()"/>
568 <xsl:text> </xsl:text>
572 <xsl:call-template name="chopPunctuation">
573 <xsl:with-param name="chopString">
574 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
578 <titleInfo type="uniform">
580 <xsl:value-of select="$titleChop"/>
582 <xsl:call-template name="part"/>
584 <titleInfo type="uniform-nfi">
586 <xsl:when test="$nfi>0">
588 <xsl:value-of select="substring($titleChop,1,$nfi)"/>
591 <xsl:value-of select="substring($titleChop,$nfi+1)"/>
596 <xsl:value-of select="$titleChop"/>
600 <xsl:call-template name="part"/>
603 <xsl:for-each select="marc:datafield[@tag='740'][@ind2!='2']">
604 <xsl:variable name="titleChop">
605 <xsl:call-template name="chopPunctuation">
606 <xsl:with-param name="chopString">
607 <xsl:call-template name="subfieldSelect">
608 <xsl:with-param name="codes">ah</xsl:with-param>
613 <titleInfo type="alternative">
615 <xsl:value-of select="$titleChop" />
617 <xsl:call-template name="part"/>
619 <titleInfo type="alternative-nfi">
621 <xsl:when test="@ind1>0">
623 <xsl:value-of select="substring($titleChop,1,@ind1)"/>
626 <xsl:value-of select="substring($titleChop,@ind1+1)"/>
631 <xsl:value-of select="$titleChop" />
635 <xsl:call-template name="part"/>
638 <xsl:for-each select="marc:datafield[@tag='100']">
639 <name type="personal">
640 <xsl:call-template name="uri" />
641 <xsl:call-template name="nameABCDQ"/>
642 <xsl:call-template name="affiliation"/>
644 <roleTerm authority="marcrelator" type="text">creator</roleTerm>
646 <xsl:call-template name="role"/>
649 <xsl:for-each select="marc:datafield[@tag='110']">
650 <name type="corporate">
651 <xsl:call-template name="uri" />
652 <xsl:call-template name="nameABCDN"/>
654 <roleTerm authority="marcrelator" type="text">creator</roleTerm>
656 <xsl:call-template name="role"/>
659 <xsl:for-each select="marc:datafield[@tag='111']">
660 <name type="conference">
661 <xsl:call-template name="uri" />
662 <xsl:call-template name="nameACDEQ"/>
664 <roleTerm authority="marcrelator" type="text">creator</roleTerm>
666 <xsl:call-template name="role"/>
669 <xsl:for-each select="marc:datafield[@tag='700'][not(marc:subfield[@code='t'])]">
670 <name type="personal">
671 <xsl:call-template name="uri" />
672 <xsl:call-template name="nameABCDQ"/>
673 <xsl:call-template name="affiliation"/>
674 <xsl:call-template name="role"/>
677 <xsl:for-each select="marc:datafield[@tag='710'][not(marc:subfield[@code='t'])]">
678 <name type="corporate">
679 <xsl:call-template name="uri" />
680 <xsl:call-template name="nameABCDN"/>
681 <xsl:call-template name="role"/>
684 <xsl:for-each select="marc:datafield[@tag='711'][not(marc:subfield[@code='t'])]">
685 <name type="conference">
686 <xsl:call-template name="uri" />
687 <xsl:call-template name="nameACDEQ"/>
688 <xsl:call-template name="role"/>
691 <xsl:for-each select="marc:datafield[@tag='720'][not(marc:subfield[@code='t'])]">
693 <xsl:if test="@ind1=1">
694 <xsl:attribute name="type">
695 <xsl:text>personal</xsl:text>
699 <xsl:value-of select="marc:subfield[@code='a']"/>
701 <xsl:call-template name="role"/>
705 <xsl:if test="$leader7='c'">
706 <xsl:attribute name="collection">yes</xsl:attribute>
708 <xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'">
709 <xsl:attribute name="manuscript">yes</xsl:attribute>
712 <xsl:when test="$leader6='a' or $leader6='t'">text</xsl:when>
713 <xsl:when test="$leader6='e' or $leader6='f'">cartographic</xsl:when>
714 <xsl:when test="$leader6='c' or $leader6='d'">notated music</xsl:when>
715 <xsl:when test="$leader6='i'">sound recording-nonmusical</xsl:when>
716 <xsl:when test="$leader6='j'">sound recording-musical</xsl:when>
717 <xsl:when test="$leader6='k'">still image</xsl:when>
718 <xsl:when test="$leader6='g'">moving image</xsl:when>
719 <xsl:when test="$leader6='r'">three dimensional object</xsl:when>
720 <xsl:when test="$leader6='m'">software, multimedia</xsl:when>
721 <xsl:when test="$leader6='p'">mixed material</xsl:when>
724 <xsl:if test="substring($controlField008,26,1)='d'">
725 <genre authority="marc">globe</genre>
727 <xsl:if test="marc:controlfield[@tag='007'][substring(text(),1,1)='a'][substring(text(),2,1)='r']">
728 <genre authority="marc">remote sensing image</genre>
730 <xsl:if test="$typeOf008='MP'">
731 <xsl:variable name="controlField008-25" select="substring($controlField008,26,1)"></xsl:variable>
733 <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']">
734 <genre authority="marc">map</genre>
736 <xsl:when test="$controlField008-25='e' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']">
737 <genre authority="marc">atlas</genre>
741 <xsl:if test="$typeOf008='SE'">
742 <xsl:variable name="controlField008-21" select="substring($controlField008,22,1)"></xsl:variable>
744 <xsl:when test="$controlField008-21='d'">
745 <genre authority="marc">database</genre>
747 <xsl:when test="$controlField008-21='l'">
748 <genre authority="marc">loose-leaf</genre>
750 <xsl:when test="$controlField008-21='m'">
751 <genre authority="marc">series</genre>
753 <xsl:when test="$controlField008-21='n'">
754 <genre authority="marc">newspaper</genre>
756 <xsl:when test="$controlField008-21='p'">
757 <genre authority="marc">periodical</genre>
759 <xsl:when test="$controlField008-21='w'">
760 <genre authority="marc">web site</genre>
764 <xsl:if test="$typeOf008='BK' or $typeOf008='SE'">
765 <xsl:variable name="controlField008-24" select="substring($controlField008,25,4)"></xsl:variable>
767 <xsl:when test="contains($controlField008-24,'a')">
768 <genre authority="marc">abstract or summary</genre>
770 <xsl:when test="contains($controlField008-24,'b')">
771 <genre authority="marc">bibliography</genre>
773 <xsl:when test="contains($controlField008-24,'c')">
774 <genre authority="marc">catalog</genre>
776 <xsl:when test="contains($controlField008-24,'d')">
777 <genre authority="marc">dictionary</genre>
779 <xsl:when test="contains($controlField008-24,'e')">
780 <genre authority="marc">encyclopedia</genre>
782 <xsl:when test="contains($controlField008-24,'f')">
783 <genre authority="marc">handbook</genre>
785 <xsl:when test="contains($controlField008-24,'g')">
786 <genre authority="marc">legal article</genre>
788 <xsl:when test="contains($controlField008-24,'i')">
789 <genre authority="marc">index</genre>
791 <xsl:when test="contains($controlField008-24,'k')">
792 <genre authority="marc">discography</genre>
794 <xsl:when test="contains($controlField008-24,'l')">
795 <genre authority="marc">legislation</genre>
797 <xsl:when test="contains($controlField008-24,'m')">
798 <genre authority="marc">theses</genre>
800 <xsl:when test="contains($controlField008-24,'n')">
801 <genre authority="marc">survey of literature</genre>
803 <xsl:when test="contains($controlField008-24,'o')">
804 <genre authority="marc">review</genre>
806 <xsl:when test="contains($controlField008-24,'p')">
807 <genre authority="marc">programmed text</genre>
809 <xsl:when test="contains($controlField008-24,'q')">
810 <genre authority="marc">filmography</genre>
812 <xsl:when test="contains($controlField008-24,'r')">
813 <genre authority="marc">directory</genre>
815 <xsl:when test="contains($controlField008-24,'s')">
816 <genre authority="marc">statistics</genre>
818 <xsl:when test="contains($controlField008-24,'t')">
819 <genre authority="marc">technical report</genre>
821 <xsl:when test="contains($controlField008-24,'v')">
822 <genre authority="marc">legal case and case notes</genre>
824 <xsl:when test="contains($controlField008-24,'w')">
825 <genre authority="marc">law report or digest</genre>
827 <xsl:when test="contains($controlField008-24,'z')">
828 <genre authority="marc">treaty</genre>
831 <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"></xsl:variable>
833 <xsl:when test="$controlField008-29='1'">
834 <genre authority="marc">conference publication</genre>
838 <xsl:if test="$typeOf008='CF'">
839 <xsl:variable name="controlField008-26" select="substring($controlField008,27,1)"></xsl:variable>
841 <xsl:when test="$controlField008-26='a'">
842 <genre authority="marc">numeric data</genre>
844 <xsl:when test="$controlField008-26='e'">
845 <genre authority="marc">database</genre>
847 <xsl:when test="$controlField008-26='f'">
848 <genre authority="marc">font</genre>
850 <xsl:when test="$controlField008-26='g'">
851 <genre authority="marc">game</genre>
855 <xsl:if test="$typeOf008='BK'">
856 <xsl:if test="substring($controlField008,25,1)='j'">
857 <genre authority="marc">patent</genre>
859 <xsl:if test="substring($controlField008,31,1)='1'">
860 <genre authority="marc">festschrift</genre>
862 <xsl:variable name="controlField008-34" select="substring($controlField008,35,1)"></xsl:variable>
863 <xsl:if test="$controlField008-34='a' or $controlField008-34='b' or $controlField008-34='c' or $controlField008-34='d'">
864 <genre authority="marc">biography</genre>
866 <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"></xsl:variable>
868 <xsl:when test="$controlField008-33='e'">
869 <genre authority="marc">essay</genre>
871 <xsl:when test="$controlField008-33='d'">
872 <genre authority="marc">drama</genre>
874 <xsl:when test="$controlField008-33='c'">
875 <genre authority="marc">comic strip</genre>
877 <xsl:when test="$controlField008-33='l'">
878 <genre authority="marc">fiction</genre>
880 <xsl:when test="$controlField008-33='h'">
881 <genre authority="marc">humor, satire</genre>
883 <xsl:when test="$controlField008-33='i'">
884 <genre authority="marc">letter</genre>
886 <xsl:when test="$controlField008-33='f'">
887 <genre authority="marc">novel</genre>
889 <xsl:when test="$controlField008-33='j'">
890 <genre authority="marc">short story</genre>
892 <xsl:when test="$controlField008-33='s'">
893 <genre authority="marc">speech</genre>
897 <xsl:if test="$typeOf008='MU'">
898 <xsl:variable name="controlField008-30-31" select="substring($controlField008,31,2)"></xsl:variable>
899 <xsl:if test="contains($controlField008-30-31,'b')">
900 <genre authority="marc">biography</genre>
902 <xsl:if test="contains($controlField008-30-31,'c')">
903 <genre authority="marc">conference publication</genre>
905 <xsl:if test="contains($controlField008-30-31,'d')">
906 <genre authority="marc">drama</genre>
908 <xsl:if test="contains($controlField008-30-31,'e')">
909 <genre authority="marc">essay</genre>
911 <xsl:if test="contains($controlField008-30-31,'f')">
912 <genre authority="marc">fiction</genre>
914 <xsl:if test="contains($controlField008-30-31,'o')">
915 <genre authority="marc">folktale</genre>
917 <xsl:if test="contains($controlField008-30-31,'h')">
918 <genre authority="marc">history</genre>
920 <xsl:if test="contains($controlField008-30-31,'k')">
921 <genre authority="marc">humor, satire</genre>
923 <xsl:if test="contains($controlField008-30-31,'m')">
924 <genre authority="marc">memoir</genre>
926 <xsl:if test="contains($controlField008-30-31,'p')">
927 <genre authority="marc">poetry</genre>
929 <xsl:if test="contains($controlField008-30-31,'r')">
930 <genre authority="marc">rehearsal</genre>
932 <xsl:if test="contains($controlField008-30-31,'g')">
933 <genre authority="marc">reporting</genre>
935 <xsl:if test="contains($controlField008-30-31,'s')">
936 <genre authority="marc">sound</genre>
938 <xsl:if test="contains($controlField008-30-31,'l')">
939 <genre authority="marc">speech</genre>
942 <xsl:if test="$typeOf008='VM'">
943 <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"></xsl:variable>
945 <xsl:when test="$controlField008-33='a'">
946 <genre authority="marc">art original</genre>
948 <xsl:when test="$controlField008-33='b'">
949 <genre authority="marc">kit</genre>
951 <xsl:when test="$controlField008-33='c'">
952 <genre authority="marc">art reproduction</genre>
954 <xsl:when test="$controlField008-33='d'">
955 <genre authority="marc">diorama</genre>
957 <xsl:when test="$controlField008-33='f'">
958 <genre authority="marc">filmstrip</genre>
960 <xsl:when test="$controlField008-33='g'">
961 <genre authority="marc">legal article</genre>
963 <xsl:when test="$controlField008-33='i'">
964 <genre authority="marc">picture</genre>
966 <xsl:when test="$controlField008-33='k'">
967 <genre authority="marc">graphic</genre>
969 <xsl:when test="$controlField008-33='l'">
970 <genre authority="marc">technical drawing</genre>
972 <xsl:when test="$controlField008-33='m'">
973 <genre authority="marc">motion picture</genre>
975 <xsl:when test="$controlField008-33='n'">
976 <genre authority="marc">chart</genre>
978 <xsl:when test="$controlField008-33='o'">
979 <genre authority="marc">flash card</genre>
981 <xsl:when test="$controlField008-33='p'">
982 <genre authority="marc">microscope slide</genre>
984 <xsl:when test="$controlField008-33='q' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']">
985 <genre authority="marc">model</genre>
987 <xsl:when test="$controlField008-33='r'">
988 <genre authority="marc">realia</genre>
990 <xsl:when test="$controlField008-33='s'">
991 <genre authority="marc">slide</genre>
993 <xsl:when test="$controlField008-33='t'">
994 <genre authority="marc">transparency</genre>
996 <xsl:when test="$controlField008-33='v'">
997 <genre authority="marc">videorecording</genre>
999 <xsl:when test="$controlField008-33='w'">
1000 <genre authority="marc">toy</genre>
1004 <xsl:for-each select="marc:datafield[@tag=655]">
1005 <genre authority="marc">
1006 <xsl:attribute name="authority">
1007 <xsl:value-of select="marc:subfield[@code='2']"/>
1009 <xsl:call-template name="subfieldSelect">
1010 <xsl:with-param name="codes">abvxyz</xsl:with-param>
1011 <xsl:with-param name="delimeter">-</xsl:with-param>
1012 </xsl:call-template>
1016 <xsl:variable name="MARCpublicationCode" select="normalize-space(substring($controlField008,16,3))"></xsl:variable>
1017 <xsl:if test="translate($MARCpublicationCode,'|','')">
1020 <xsl:attribute name="type">code</xsl:attribute>
1021 <xsl:attribute name="authority">marccountry</xsl:attribute>
1022 <xsl:value-of select="$MARCpublicationCode"/>
1026 <xsl:for-each select="marc:datafield[@tag=044]/marc:subfield[@code='c']">
1029 <xsl:attribute name="type">code</xsl:attribute>
1030 <xsl:attribute name="authority">iso3166</xsl:attribute>
1031 <xsl:value-of select="."/>
1035 <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='a']">
1038 <xsl:attribute name="type">text</xsl:attribute>
1039 <xsl:call-template name="chopPunctuationFront">
1040 <xsl:with-param name="chopString">
1041 <xsl:call-template name="chopPunctuation">
1042 <xsl:with-param name="chopString" select="."/>
1043 </xsl:call-template>
1045 </xsl:call-template>
1049 <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='m']">
1050 <dateValid point="start">
1051 <xsl:value-of select="."/>
1054 <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='n']">
1055 <dateValid point="end">
1056 <xsl:value-of select="."/>
1059 <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='j']">
1061 <xsl:value-of select="."/>
1064 <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='b' or @code='c' or @code='g']">
1066 <xsl:when test="@code='b'">
1068 <xsl:call-template name="chopPunctuation">
1069 <xsl:with-param name="chopString" select="."/>
1070 <xsl:with-param name="punctuation">
1071 <xsl:text>:,;/ </xsl:text>
1073 </xsl:call-template>
1076 <xsl:when test="@code='c'">
1078 <xsl:call-template name="chopPunctuation">
1079 <xsl:with-param name="chopString" select="."/>
1080 </xsl:call-template>
1083 <xsl:when test="@code='g'">
1085 <xsl:value-of select="."/>
1090 <xsl:variable name="dataField260c">
1091 <xsl:call-template name="chopPunctuation">
1092 <xsl:with-param name="chopString" select="marc:datafield[@tag=260]/marc:subfield[@code='c']"></xsl:with-param>
1093 </xsl:call-template>
1095 <xsl:variable name="controlField008-7-10" select="normalize-space(substring($controlField008, 8, 4))"></xsl:variable>
1096 <xsl:variable name="controlField008-11-14" select="normalize-space(substring($controlField008, 12, 4))"></xsl:variable>
1097 <xsl:variable name="controlField008-6" select="normalize-space(substring($controlField008, 7, 1))"></xsl:variable>
1098 <xsl:if test="$controlField008-6='e' or $controlField008-6='p' or $controlField008-6='r' or $controlField008-6='t' or $controlField008-6='s'">
1099 <xsl:if test="$controlField008-7-10 and ($controlField008-7-10 != $dataField260c)">
1100 <dateIssued encoding="marc">
1101 <xsl:value-of select="$controlField008-7-10"/>
1105 <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'">
1106 <xsl:if test="$controlField008-7-10">
1107 <dateIssued encoding="marc" point="start">
1108 <xsl:value-of select="$controlField008-7-10"/>
1112 <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'">
1113 <xsl:if test="$controlField008-11-14">
1114 <dateIssued encoding="marc" point="end">
1115 <xsl:value-of select="$controlField008-11-14"/>
1119 <xsl:if test="$controlField008-6='q'">
1120 <xsl:if test="$controlField008-7-10">
1121 <dateIssued encoding="marc" point="start" qualifier="questionable">
1122 <xsl:value-of select="$controlField008-7-10"/>
1126 <xsl:if test="$controlField008-6='q'">
1127 <xsl:if test="$controlField008-11-14">
1128 <dateIssued encoding="marc" point="end" qualifier="questionable">
1129 <xsl:value-of select="$controlField008-11-14"/>
1133 <xsl:if test="$controlField008-6='t'">
1134 <xsl:if test="$controlField008-11-14">
1135 <copyrightDate encoding="marc">
1136 <xsl:value-of select="$controlField008-11-14"/>
1140 <xsl:for-each select="marc:datafield[@tag=033][@ind1=0 or @ind1=1]/marc:subfield[@code='a']">
1141 <dateCaptured encoding="iso8601">
1142 <xsl:value-of select="."/>
1145 <xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][1]">
1146 <dateCaptured encoding="iso8601" point="start">
1147 <xsl:value-of select="."/>
1150 <xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][2]">
1151 <dateCaptured encoding="iso8601" point="end">
1152 <xsl:value-of select="."/>
1155 <xsl:for-each select="marc:datafield[@tag=250]/marc:subfield[@code='a']">
1157 <xsl:value-of select="."/>
1160 <xsl:for-each select="marc:leader">
1163 <xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">monographic</xsl:when>
1164 <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">continuing</xsl:when>
1168 <xsl:for-each select="marc:datafield[@tag=310]|marc:datafield[@tag=321]">
1170 <xsl:call-template name="subfieldSelect">
1171 <xsl:with-param name="codes">ab</xsl:with-param>
1172 </xsl:call-template>
1176 <xsl:variable name="controlField008-35-37" select="normalize-space(translate(substring($controlField008,36,3),'|#',''))"></xsl:variable>
1177 <xsl:if test="$controlField008-35-37">
1179 <languageTerm authority="iso639-2b" type="code">
1180 <xsl:value-of select="substring($controlField008,36,3)"/>
1184 <xsl:for-each select="marc:datafield[@tag=041]">
1185 <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']">
1186 <xsl:variable name="langCodes" select="."/>
1188 <xsl:when test="../marc:subfield[@code='2']='rfc3066'">
1189 <!-- not stacked but could be repeated -->
1190 <xsl:call-template name="rfcLanguages">
1191 <xsl:with-param name="nodeNum">
1192 <xsl:value-of select="1"/>
1194 <xsl:with-param name="usedLanguages">
1195 <xsl:text></xsl:text>
1197 <xsl:with-param name="controlField008-35-37">
1198 <xsl:value-of select="$controlField008-35-37"></xsl:value-of>
1200 </xsl:call-template>
1204 <xsl:variable name="allLanguages">
1205 <xsl:copy-of select="$langCodes"></xsl:copy-of>
1207 <xsl:variable name="currentLanguage">
1208 <xsl:value-of select="substring($allLanguages,1,3)"></xsl:value-of>
1210 <xsl:call-template name="isoLanguage">
1211 <xsl:with-param name="currentLanguage">
1212 <xsl:value-of select="substring($allLanguages,1,3)"></xsl:value-of>
1214 <xsl:with-param name="remainingLanguages">
1215 <xsl:value-of select="substring($allLanguages,4,string-length($allLanguages)-3)"></xsl:value-of>
1217 <xsl:with-param name="usedLanguages">
1218 <xsl:if test="$controlField008-35-37">
1219 <xsl:value-of select="$controlField008-35-37"></xsl:value-of>
1222 </xsl:call-template>
1227 <xsl:variable name="physicalDescription">
1228 <!--3.2 change tmee 007/11 -->
1229 <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='a']">
1230 <digitalOrigin>reformatted digital</digitalOrigin>
1232 <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='b']">
1233 <digitalOrigin>digitized microfilm</digitalOrigin>
1235 <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='d']">
1236 <digitalOrigin>digitized other analog</digitalOrigin>
1238 <xsl:variable name="controlField008-23" select="substring($controlField008,24,1)"></xsl:variable>
1239 <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"></xsl:variable>
1240 <xsl:variable name="check008-23">
1241 <xsl:if test="$typeOf008='BK' or $typeOf008='MU' or $typeOf008='SE' or $typeOf008='MM'">
1242 <xsl:value-of select="true()"></xsl:value-of>
1245 <xsl:variable name="check008-29">
1246 <xsl:if test="$typeOf008='MP' or $typeOf008='VM'">
1247 <xsl:value-of select="true()"></xsl:value-of>
1251 <xsl:when test="($check008-23 and $controlField008-23='f') or ($check008-29 and $controlField008-29='f')">
1252 <form authority="marcform">braille</form>
1254 <xsl:when test="($controlField008-23=' ' and ($leader6='c' or $leader6='d')) or (($typeOf008='BK' or $typeOf008='SE') and ($controlField008-23=' ' or $controlField008='r'))">
1255 <form authority="marcform">print</form>
1257 <xsl:when test="$leader6 = 'm' or ($check008-23 and $controlField008-23='s') or ($check008-29 and $controlField008-29='s')">
1258 <form authority="marcform">electronic</form>
1260 <xsl:when test="($check008-23 and $controlField008-23='b') or ($check008-29 and $controlField008-29='b')">
1261 <form authority="marcform">microfiche</form>
1263 <xsl:when test="($check008-23 and $controlField008-23='a') or ($check008-29 and $controlField008-29='a')">
1264 <form authority="marcform">microfilm</form>
1268 <xsl:if test="marc:datafield[@tag=130]/marc:subfield[@code='h']">
1269 <form authority="gmd">
1270 <xsl:call-template name="chopBrackets">
1271 <xsl:with-param name="chopString">
1272 <xsl:value-of select="marc:datafield[@tag=130]/marc:subfield[@code='h']"></xsl:value-of>
1274 </xsl:call-template>
1277 <xsl:if test="marc:datafield[@tag=240]/marc:subfield[@code='h']">
1278 <form authority="gmd">
1279 <xsl:call-template name="chopBrackets">
1280 <xsl:with-param name="chopString">
1281 <xsl:value-of select="marc:datafield[@tag=240]/marc:subfield[@code='h']"></xsl:value-of>
1283 </xsl:call-template>
1286 <xsl:if test="marc:datafield[@tag=242]/marc:subfield[@code='h']">
1287 <form authority="gmd">
1288 <xsl:call-template name="chopBrackets">
1289 <xsl:with-param name="chopString">
1290 <xsl:value-of select="marc:datafield[@tag=242]/marc:subfield[@code='h']"></xsl:value-of>
1292 </xsl:call-template>
1295 <xsl:if test="marc:datafield[@tag=245]/marc:subfield[@code='h']">
1296 <form authority="gmd">
1297 <xsl:call-template name="chopBrackets">
1298 <xsl:with-param name="chopString">
1299 <xsl:value-of select="marc:datafield[@tag=245]/marc:subfield[@code='h']"></xsl:value-of>
1301 </xsl:call-template>
1304 <xsl:if test="marc:datafield[@tag=246]/marc:subfield[@code='h']">
1305 <form authority="gmd">
1306 <xsl:call-template name="chopBrackets">
1307 <xsl:with-param name="chopString">
1308 <xsl:value-of select="marc:datafield[@tag=246]/marc:subfield[@code='h']"></xsl:value-of>
1310 </xsl:call-template>
1313 <xsl:if test="marc:datafield[@tag=730]/marc:subfield[@code='h']">
1314 <form authority="gmd">
1315 <xsl:call-template name="chopBrackets">
1316 <xsl:with-param name="chopString">
1317 <xsl:value-of select="marc:datafield[@tag=730]/marc:subfield[@code='h']"></xsl:value-of>
1319 </xsl:call-template>
1322 <xsl:for-each select="marc:datafield[@tag=256]/marc:subfield[@code='a']">
1324 <xsl:value-of select="."></xsl:value-of>
1327 <xsl:for-each select="marc:controlfield[@tag=007][substring(text(),1,1)='c']">
1329 <xsl:when test="substring(text(),14,1)='a'">
1330 <reformattingQuality>access</reformattingQuality>
1332 <xsl:when test="substring(text(),14,1)='p'">
1333 <reformattingQuality>preservation</reformattingQuality>
1335 <xsl:when test="substring(text(),14,1)='r'">
1336 <reformattingQuality>replacement</reformattingQuality>
1340 <!--3.2 change tmee 007/01 -->
1341 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='b']">
1342 <form authority="smd">chip cartridge</form>
1344 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='c']">
1345 <form authority="smd">computer optical disc cartridge</form>
1347 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='j']">
1348 <form authority="smd">magnetic disc</form>
1350 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='m']">
1351 <form authority="smd">magneto-optical disc</form>
1353 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='o']">
1354 <form authority="smd">optical disc</form>
1356 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='r']">
1357 <form authority="smd">remote</form>
1359 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='a']">
1360 <form authority="smd">tape cartridge</form>
1362 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='f']">
1363 <form authority="smd">tape cassette</form>
1365 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='h']">
1366 <form authority="smd">tape reel</form>
1369 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='a']">
1370 <form authority="smd">celestial globe</form>
1372 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='e']">
1373 <form authority="smd">earth moon globe</form>
1375 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='b']">
1376 <form authority="smd">planetary or lunar globe</form>
1378 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='c']">
1379 <form authority="smd">terrestrial globe</form>
1382 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='o'][substring(text(),2,1)='o']">
1383 <form authority="smd">kit</form>
1386 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']">
1387 <form authority="smd">atlas</form>
1389 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='g']">
1390 <form authority="smd">diagram</form>
1392 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='j']">
1393 <form authority="smd">map</form>
1395 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']">
1396 <form authority="smd">model</form>
1398 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='k']">
1399 <form authority="smd">profile</form>
1401 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='r']">
1402 <form authority="smd">remote-sensing image</form>
1404 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='s']">
1405 <form authority="smd">section</form>
1407 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='y']">
1408 <form authority="smd">view</form>
1411 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='a']">
1412 <form authority="smd">aperture card</form>
1414 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='e']">
1415 <form authority="smd">microfiche</form>
1417 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='f']">
1418 <form authority="smd">microfiche cassette</form>
1420 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='b']">
1421 <form authority="smd">microfilm cartridge</form>
1423 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='c']">
1424 <form authority="smd">microfilm cassette</form>
1426 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='d']">
1427 <form authority="smd">microfilm reel</form>
1429 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='g']">
1430 <form authority="smd">microopaque</form>
1433 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='c']">
1434 <form authority="smd">film cartridge</form>
1436 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='f']">
1437 <form authority="smd">film cassette</form>
1439 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='r']">
1440 <form authority="smd">film reel</form>
1443 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='n']">
1444 <form authority="smd">chart</form>
1446 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='c']">
1447 <form authority="smd">collage</form>
1449 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='d']">
1450 <form authority="smd">drawing</form>
1452 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='o']">
1453 <form authority="smd">flash card</form>
1455 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='e']">
1456 <form authority="smd">painting</form>
1458 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='f']">
1459 <form authority="smd">photomechanical print</form>
1461 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='g']">
1462 <form authority="smd">photonegative</form>
1464 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='h']">
1465 <form authority="smd">photoprint</form>
1467 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='i']">
1468 <form authority="smd">picture</form>
1470 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='j']">
1471 <form authority="smd">print</form>
1473 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='l']">
1474 <form authority="smd">technical drawing</form>
1477 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='q'][substring(text(),2,1)='q']">
1478 <form authority="smd">notated music</form>
1481 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='d']">
1482 <form authority="smd">filmslip</form>
1484 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='c']">
1485 <form authority="smd">filmstrip cartridge</form>
1487 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='o']">
1488 <form authority="smd">filmstrip roll</form>
1490 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='f']">
1491 <form authority="smd">other filmstrip type</form>
1493 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='s']">
1494 <form authority="smd">slide</form>
1496 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='t']">
1497 <form authority="smd">transparency</form>
1499 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='r'][substring(text(),2,1)='r']">
1500 <form authority="smd">remote-sensing image</form>
1502 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='e']">
1503 <form authority="smd">cylinder</form>
1505 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='q']">
1506 <form authority="smd">roll</form>
1508 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='g']">
1509 <form authority="smd">sound cartridge</form>
1511 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='s']">
1512 <form authority="smd">sound cassette</form>
1514 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='d']">
1515 <form authority="smd">sound disc</form>
1517 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='t']">
1518 <form authority="smd">sound-tape reel</form>
1520 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='i']">
1521 <form authority="smd">sound-track film</form>
1523 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='w']">
1524 <form authority="smd">wire recording</form>
1527 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='c']">
1528 <form authority="smd">braille</form>
1530 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='b']">
1531 <form authority="smd">combination</form>
1533 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='a']">
1534 <form authority="smd">moon</form>
1536 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='d']">
1537 <form authority="smd">tactile, with no writing system</form>
1540 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='c']">
1541 <form authority="smd">braille</form>
1543 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='b']">
1544 <form authority="smd">large print</form>
1546 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='a']">
1547 <form authority="smd">regular print</form>
1549 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='d']">
1550 <form authority="smd">text in looseleaf binder</form>
1553 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='c']">
1554 <form authority="smd">videocartridge</form>
1556 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='f']">
1557 <form authority="smd">videocassette</form>
1559 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='d']">
1560 <form authority="smd">videodisc</form>
1562 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='r']">
1563 <form authority="smd">videoreel</form>
1566 <xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='q'][string-length(.)>1]">
1568 <xsl:value-of select="."></xsl:value-of>
1569 </internetMediaType>
1571 <xsl:for-each select="marc:datafield[@tag=300]">
1573 <xsl:call-template name="subfieldSelect">
1574 <xsl:with-param name="codes">abce</xsl:with-param>
1575 </xsl:call-template>
1579 <xsl:if test="string-length(normalize-space($physicalDescription))">
1580 <physicalDescription>
1581 <xsl:copy-of select="$physicalDescription"></xsl:copy-of>
1582 </physicalDescription>
1584 <xsl:for-each select="marc:datafield[@tag=520]">
1586 <xsl:call-template name="uri"></xsl:call-template>
1587 <xsl:call-template name="subfieldSelect">
1588 <xsl:with-param name="codes">ab</xsl:with-param>
1589 </xsl:call-template>
1592 <xsl:for-each select="marc:datafield[@tag=505]">
1594 <xsl:call-template name="uri"></xsl:call-template>
1595 <xsl:call-template name="subfieldSelect">
1596 <xsl:with-param name="codes">agrt</xsl:with-param>
1597 </xsl:call-template>
1600 <xsl:for-each select="marc:datafield[@tag=521]">
1602 <xsl:call-template name="subfieldSelect">
1603 <xsl:with-param name="codes">ab</xsl:with-param>
1604 </xsl:call-template>
1607 <xsl:if test="$typeOf008='BK' or $typeOf008='CF' or $typeOf008='MU' or $typeOf008='VM'">
1608 <xsl:variable name="controlField008-22" select="substring($controlField008,23,1)"></xsl:variable>
1611 <xsl:when test="$controlField008-22='d'">
1612 <targetAudience authority="marctarget">adolescent</targetAudience>
1614 <xsl:when test="$controlField008-22='e'">
1615 <targetAudience authority="marctarget">adult</targetAudience>
1617 <xsl:when test="$controlField008-22='g'">
1618 <targetAudience authority="marctarget">general</targetAudience>
1620 <xsl:when test="$controlField008-22='b' or $controlField008-22='c' or $controlField008-22='j'">
1621 <targetAudience authority="marctarget">juvenile</targetAudience>
1623 <xsl:when test="$controlField008-22='a'">
1624 <targetAudience authority="marctarget">preschool</targetAudience>
1626 <xsl:when test="$controlField008-22='f'">
1627 <targetAudience authority="marctarget">specialized</targetAudience>
1631 <xsl:for-each select="marc:datafield[@tag=245]/marc:subfield[@code='c']">
1632 <note type="statement of responsibility">
1633 <xsl:value-of select="."></xsl:value-of>
1636 <xsl:for-each select="marc:datafield[@tag=500]">
1638 <xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of>
1639 <xsl:call-template name="uri"></xsl:call-template>
1643 <!--3.2 change tmee additional note fields-->
1645 <xsl:for-each select="marc:datafield[@tag=506]">
1646 <note type="restrictions">
1647 <xsl:call-template name="uri"></xsl:call-template>
1648 <xsl:variable name="str">
1649 <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1650 <xsl:value-of select="."></xsl:value-of>
1651 <xsl:text> </xsl:text>
1654 <xsl:value-of select="substring($str,1,string-length($str)-1)"></xsl:value-of>
1658 <xsl:for-each select="marc:datafield[@tag=510]">
1659 <note type="citation/reference">
1660 <xsl:call-template name="uri"></xsl:call-template>
1661 <xsl:variable name="str">
1662 <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1663 <xsl:value-of select="."></xsl:value-of>
1664 <xsl:text> </xsl:text>
1667 <xsl:value-of select="substring($str,1,string-length($str)-1)"></xsl:value-of>
1672 <xsl:for-each select="marc:datafield[@tag=511]">
1673 <note type="performers">
1674 <xsl:call-template name="uri"></xsl:call-template>
1675 <xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of>
1678 <xsl:for-each select="marc:datafield[@tag=518]">
1680 <xsl:call-template name="uri"></xsl:call-template>
1681 <xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of>
1685 <xsl:for-each select="marc:datafield[@tag=530]">
1686 <note type="additional physical form">
1687 <xsl:call-template name="uri"></xsl:call-template>
1688 <xsl:variable name="str">
1689 <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1690 <xsl:value-of select="."></xsl:value-of>
1691 <xsl:text> </xsl:text>
1694 <xsl:value-of select="substring($str,1,string-length($str)-1)"></xsl:value-of>
1698 <xsl:for-each select="marc:datafield[@tag=533]">
1699 <note type="reproduction">
1700 <xsl:call-template name="uri"></xsl:call-template>
1701 <xsl:variable name="str">
1702 <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1703 <xsl:value-of select="."></xsl:value-of>
1704 <xsl:text> </xsl:text>
1707 <xsl:value-of select="substring($str,1,string-length($str)-1)"></xsl:value-of>
1711 <xsl:for-each select="marc:datafield[@tag=534]">
1712 <note type="original version">
1713 <xsl:call-template name="uri"></xsl:call-template>
1714 <xsl:variable name="str">
1715 <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1716 <xsl:value-of select="."></xsl:value-of>
1717 <xsl:text> </xsl:text>
1720 <xsl:value-of select="substring($str,1,string-length($str)-1)"></xsl:value-of>
1724 <xsl:for-each select="marc:datafield[@tag=538]">
1725 <note type="system details">
1726 <xsl:call-template name="uri"></xsl:call-template>
1727 <xsl:variable name="str">
1728 <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1729 <xsl:value-of select="."></xsl:value-of>
1730 <xsl:text> </xsl:text>
1733 <xsl:value-of select="substring($str,1,string-length($str)-1)"></xsl:value-of>
1737 <xsl:for-each select="marc:datafield[@tag=583]">
1738 <note type="action">
1739 <xsl:call-template name="uri"></xsl:call-template>
1740 <xsl:variable name="str">
1741 <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1742 <xsl:value-of select="."></xsl:value-of>
1743 <xsl:text> </xsl:text>
1746 <xsl:value-of select="substring($str,1,string-length($str)-1)"></xsl:value-of>
1754 <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]">
1756 <xsl:call-template name="uri"></xsl:call-template>
1757 <xsl:variable name="str">
1758 <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1759 <xsl:value-of select="."></xsl:value-of>
1760 <xsl:text> </xsl:text>
1763 <xsl:value-of select="substring($str,1,string-length($str)-1)"></xsl:value-of>
1766 <xsl:for-each select="marc:datafield[@tag=034][marc:subfield[@code='d' or @code='e' or @code='f' or @code='g']]">
1770 <xsl:call-template name="subfieldSelect">
1771 <xsl:with-param name="codes">defg</xsl:with-param>
1772 </xsl:call-template>
1777 <xsl:for-each select="marc:datafield[@tag=043]">
1779 <xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']">
1781 <xsl:attribute name="authority">
1782 <xsl:if test="@code='a'">
1783 <xsl:text>marcgac</xsl:text>
1785 <xsl:if test="@code='b'">
1786 <xsl:value-of select="following-sibling::marc:subfield[@code=2]"></xsl:value-of>
1788 <xsl:if test="@code='c'">
1789 <xsl:text>iso3166</xsl:text>
1792 <xsl:value-of select="self::marc:subfield"></xsl:value-of>
1797 <!-- tmee 2006/11/27 -->
1798 <xsl:for-each select="marc:datafield[@tag=255]">
1800 <xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']">
1802 <xsl:if test="@code='a'">
1804 <xsl:value-of select="."></xsl:value-of>
1807 <xsl:if test="@code='b'">
1809 <xsl:value-of select="."></xsl:value-of>
1812 <xsl:if test="@code='c'">
1814 <xsl:value-of select="."></xsl:value-of>
1822 <xsl:apply-templates select="marc:datafield[653 >= @tag and @tag >= 600]"></xsl:apply-templates>
1823 <xsl:apply-templates select="marc:datafield[@tag=656]"></xsl:apply-templates>
1824 <xsl:for-each select="marc:datafield[@tag=752]">
1826 <hierarchicalGeographic>
1827 <xsl:for-each select="marc:subfield[@code='a']">
1829 <xsl:call-template name="chopPunctuation">
1830 <xsl:with-param name="chopString" select="."></xsl:with-param>
1831 </xsl:call-template>
1834 <xsl:for-each select="marc:subfield[@code='b']">
1836 <xsl:call-template name="chopPunctuation">
1837 <xsl:with-param name="chopString" select="."></xsl:with-param>
1838 </xsl:call-template>
1841 <xsl:for-each select="marc:subfield[@code='c']">
1843 <xsl:call-template name="chopPunctuation">
1844 <xsl:with-param name="chopString" select="."></xsl:with-param>
1845 </xsl:call-template>
1848 <xsl:for-each select="marc:subfield[@code='d']">
1850 <xsl:call-template name="chopPunctuation">
1851 <xsl:with-param name="chopString" select="."></xsl:with-param>
1852 </xsl:call-template>
1855 </hierarchicalGeographic>
1858 <xsl:for-each select="marc:datafield[@tag=045][marc:subfield[@code='b']]">
1861 <xsl:when test="@ind1=2">
1862 <temporal encoding="iso8601" point="start">
1863 <xsl:call-template name="chopPunctuation">
1864 <xsl:with-param name="chopString">
1865 <xsl:value-of select="marc:subfield[@code='b'][1]"></xsl:value-of>
1867 </xsl:call-template>
1869 <temporal encoding="iso8601" point="end">
1870 <xsl:call-template name="chopPunctuation">
1871 <xsl:with-param name="chopString">
1872 <xsl:value-of select="marc:subfield[@code='b'][2]"></xsl:value-of>
1874 </xsl:call-template>
1878 <xsl:for-each select="marc:subfield[@code='b']">
1879 <temporal encoding="iso8601">
1880 <xsl:call-template name="chopPunctuation">
1881 <xsl:with-param name="chopString" select="."></xsl:with-param>
1882 </xsl:call-template>
1889 <xsl:for-each select="marc:datafield[@tag=050]">
1890 <xsl:for-each select="marc:subfield[@code='b']">
1891 <classification authority="lcc">
1892 <xsl:if test="../marc:subfield[@code='3']">
1893 <xsl:attribute name="displayLabel">
1894 <xsl:value-of select="../marc:subfield[@code='3']"></xsl:value-of>
1897 <xsl:value-of select="preceding-sibling::marc:subfield[@code='a'][1]"></xsl:value-of>
1898 <xsl:text> </xsl:text>
1899 <xsl:value-of select="text()"></xsl:value-of>
1902 <xsl:for-each select="marc:subfield[@code='a'][not(following-sibling::marc:subfield[@code='b'])]">
1903 <classification authority="lcc">
1904 <xsl:if test="../marc:subfield[@code='3']">
1905 <xsl:attribute name="displayLabel">
1906 <xsl:value-of select="../marc:subfield[@code='3']"></xsl:value-of>
1909 <xsl:value-of select="text()"></xsl:value-of>
1913 <xsl:for-each select="marc:datafield[@tag=082]">
1914 <classification authority="ddc">
1915 <xsl:if test="marc:subfield[@code='2']">
1916 <xsl:attribute name="edition">
1917 <xsl:value-of select="marc:subfield[@code='2']"></xsl:value-of>
1920 <xsl:call-template name="subfieldSelect">
1921 <xsl:with-param name="codes">ab</xsl:with-param>
1922 </xsl:call-template>
1925 <xsl:for-each select="marc:datafield[@tag=080]">
1926 <classification authority="udc">
1927 <xsl:call-template name="subfieldSelect">
1928 <xsl:with-param name="codes">abx</xsl:with-param>
1929 </xsl:call-template>
1932 <xsl:for-each select="marc:datafield[@tag=060]">
1933 <classification authority="nlm">
1934 <xsl:call-template name="subfieldSelect">
1935 <xsl:with-param name="codes">ab</xsl:with-param>
1936 </xsl:call-template>
1939 <xsl:for-each select="marc:datafield[@tag=086][@ind1=0]">
1940 <classification authority="sudocs">
1941 <xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of>
1944 <xsl:for-each select="marc:datafield[@tag=086][@ind1=1]">
1945 <classification authority="candoc">
1946 <xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of>
1949 <xsl:for-each select="marc:datafield[@tag=086]">
1951 <xsl:attribute name="authority">
1952 <xsl:value-of select="marc:subfield[@code='2']"></xsl:value-of>
1954 <xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of>
1957 <xsl:for-each select="marc:datafield[@tag=084]">
1959 <xsl:attribute name="authority">
1960 <xsl:value-of select="marc:subfield[@code='2']"></xsl:value-of>
1962 <xsl:call-template name="subfieldSelect">
1963 <xsl:with-param name="codes">ab</xsl:with-param>
1964 </xsl:call-template>
1967 <xsl:for-each select="marc:datafield[@tag=440]">
1968 <relatedItem type="series">
1969 <xsl:variable name="titleChop">
1970 <xsl:call-template name="chopPunctuation">
1971 <xsl:with-param name="chopString">
1972 <xsl:call-template name="subfieldSelect">
1973 <xsl:with-param name="codes">av</xsl:with-param>
1974 </xsl:call-template>
1976 </xsl:call-template>
1980 <xsl:value-of select="$titleChop" />
1982 <xsl:call-template name="part"></xsl:call-template>
1984 <titleInfo type="nfi">
1986 <xsl:when test="@ind2>0">
1988 <xsl:value-of select="substring($titleChop,1,@ind2)"/>
1991 <xsl:value-of select="substring($titleChop,@ind2+1)"/>
1993 <xsl:call-template name="part"/>
1997 <xsl:value-of select="$titleChop" />
2001 <xsl:call-template name="part"></xsl:call-template>
2005 <xsl:for-each select="marc:datafield[@tag=490][@ind1=0]">
2006 <relatedItem type="series">
2009 <xsl:call-template name="chopPunctuation">
2010 <xsl:with-param name="chopString">
2011 <xsl:call-template name="subfieldSelect">
2012 <xsl:with-param name="codes">av</xsl:with-param>
2013 </xsl:call-template>
2015 </xsl:call-template>
2017 <xsl:call-template name="part"></xsl:call-template>
2021 <xsl:for-each select="marc:datafield[@tag=510]">
2022 <relatedItem type="isReferencedBy">
2024 <xsl:call-template name="subfieldSelect">
2025 <xsl:with-param name="codes">abcx3</xsl:with-param>
2026 </xsl:call-template>
2030 <xsl:for-each select="marc:datafield[@tag=534]">
2031 <relatedItem type="original">
2032 <xsl:call-template name="relatedTitle"></xsl:call-template>
2033 <xsl:call-template name="relatedName"></xsl:call-template>
2034 <xsl:if test="marc:subfield[@code='b' or @code='c']">
2036 <xsl:for-each select="marc:subfield[@code='c']">
2038 <xsl:value-of select="."></xsl:value-of>
2041 <xsl:for-each select="marc:subfield[@code='b']">
2043 <xsl:value-of select="."></xsl:value-of>
2048 <xsl:call-template name="relatedIdentifierISSN"></xsl:call-template>
2049 <xsl:for-each select="marc:subfield[@code='z']">
2050 <identifier type="isbn">
2051 <xsl:value-of select="."></xsl:value-of>
2054 <xsl:call-template name="relatedNote"></xsl:call-template>
2057 <xsl:for-each select="marc:datafield[@tag=700][marc:subfield[@code='t']]">
2059 <xsl:call-template name="constituentOrRelatedType"></xsl:call-template>
2062 <xsl:call-template name="chopPunctuation">
2063 <xsl:with-param name="chopString">
2064 <xsl:call-template name="specialSubfieldSelect">
2065 <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
2066 <xsl:with-param name="axis">t</xsl:with-param>
2067 <xsl:with-param name="afterCodes">g</xsl:with-param>
2068 </xsl:call-template>
2070 </xsl:call-template>
2072 <xsl:call-template name="part"></xsl:call-template>
2074 <name type="personal">
2076 <xsl:call-template name="specialSubfieldSelect">
2077 <xsl:with-param name="anyCodes">aq</xsl:with-param>
2078 <xsl:with-param name="axis">t</xsl:with-param>
2079 <xsl:with-param name="beforeCodes">g</xsl:with-param>
2080 </xsl:call-template>
2082 <xsl:call-template name="termsOfAddress"></xsl:call-template>
2083 <xsl:call-template name="nameDate"></xsl:call-template>
2084 <xsl:call-template name="role"></xsl:call-template>
2086 <xsl:call-template name="relatedForm"></xsl:call-template>
2087 <xsl:call-template name="relatedIdentifierISSN"></xsl:call-template>
2090 <xsl:for-each select="marc:datafield[@tag=710][marc:subfield[@code='t']]">
2092 <xsl:call-template name="constituentOrRelatedType"></xsl:call-template>
2095 <xsl:call-template name="chopPunctuation">
2096 <xsl:with-param name="chopString">
2097 <xsl:call-template name="specialSubfieldSelect">
2098 <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
2099 <xsl:with-param name="axis">t</xsl:with-param>
2100 <xsl:with-param name="afterCodes">dg</xsl:with-param>
2101 </xsl:call-template>
2103 </xsl:call-template>
2105 <xsl:call-template name="relatedPartNumName"></xsl:call-template>
2107 <name type="corporate">
2108 <xsl:for-each select="marc:subfield[@code='a']">
2110 <xsl:value-of select="."></xsl:value-of>
2113 <xsl:for-each select="marc:subfield[@code='b']">
2115 <xsl:value-of select="."></xsl:value-of>
2118 <xsl:variable name="tempNamePart">
2119 <xsl:call-template name="specialSubfieldSelect">
2120 <xsl:with-param name="anyCodes">c</xsl:with-param>
2121 <xsl:with-param name="axis">t</xsl:with-param>
2122 <xsl:with-param name="beforeCodes">dgn</xsl:with-param>
2123 </xsl:call-template>
2125 <xsl:if test="normalize-space($tempNamePart)">
2127 <xsl:value-of select="$tempNamePart"></xsl:value-of>
2130 <xsl:call-template name="role"></xsl:call-template>
2132 <xsl:call-template name="relatedForm"></xsl:call-template>
2133 <xsl:call-template name="relatedIdentifierISSN"></xsl:call-template>
2136 <xsl:for-each select="marc:datafield[@tag=711][marc:subfield[@code='t']]">
2138 <xsl:call-template name="constituentOrRelatedType"></xsl:call-template>
2141 <xsl:call-template name="chopPunctuation">
2142 <xsl:with-param name="chopString">
2143 <xsl:call-template name="specialSubfieldSelect">
2144 <xsl:with-param name="anyCodes">tfklsv</xsl:with-param>
2145 <xsl:with-param name="axis">t</xsl:with-param>
2146 <xsl:with-param name="afterCodes">g</xsl:with-param>
2147 </xsl:call-template>
2149 </xsl:call-template>
2151 <xsl:call-template name="relatedPartNumName"></xsl:call-template>
2153 <name type="conference">
2155 <xsl:call-template name="specialSubfieldSelect">
2156 <xsl:with-param name="anyCodes">aqdc</xsl:with-param>
2157 <xsl:with-param name="axis">t</xsl:with-param>
2158 <xsl:with-param name="beforeCodes">gn</xsl:with-param>
2159 </xsl:call-template>
2162 <xsl:call-template name="relatedForm"></xsl:call-template>
2163 <xsl:call-template name="relatedIdentifierISSN"></xsl:call-template>
2166 <xsl:for-each select="marc:datafield[@tag=730][@ind2=2]">
2168 <xsl:call-template name="constituentOrRelatedType"></xsl:call-template>
2171 <xsl:call-template name="chopPunctuation">
2172 <xsl:with-param name="chopString">
2173 <xsl:call-template name="subfieldSelect">
2174 <xsl:with-param name="codes">adfgklmorsv</xsl:with-param>
2175 </xsl:call-template>
2177 </xsl:call-template>
2179 <xsl:call-template name="part"></xsl:call-template>
2181 <xsl:call-template name="relatedForm"></xsl:call-template>
2182 <xsl:call-template name="relatedIdentifierISSN"></xsl:call-template>
2185 <xsl:for-each select="marc:datafield[@tag=740][@ind2=2]">
2187 <xsl:call-template name="constituentOrRelatedType"></xsl:call-template>
2188 <xsl:variable name="titleChop">
2189 <xsl:call-template name="chopPunctuation">
2190 <xsl:with-param name="chopString">
2191 <xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of>
2193 </xsl:call-template>
2197 <xsl:value-of select="$titleChop" />
2199 <xsl:call-template name="part"></xsl:call-template>
2201 <titleInfo type="nfi">
2203 <xsl:when test="@ind1>0">
2205 <xsl:value-of select="substring($titleChop,1,@ind1)"/>
2208 <xsl:value-of select="substring($titleChop,@ind1+1)"/>
2213 <xsl:value-of select="$titleChop" />
2217 <xsl:call-template name="part"></xsl:call-template>
2219 <xsl:call-template name="relatedForm"></xsl:call-template>
2222 <xsl:for-each select="marc:datafield[@tag=760]|marc:datafield[@tag=762]">
2223 <relatedItem type="series">
2224 <xsl:call-template name="relatedItem76X-78X"></xsl:call-template>
2227 <xsl:for-each select="marc:datafield[@tag=765]|marc:datafield[@tag=767]|marc:datafield[@tag=777]|marc:datafield[@tag=787]">
2229 <xsl:call-template name="relatedItem76X-78X"></xsl:call-template>
2232 <xsl:for-each select="marc:datafield[@tag=775]">
2233 <relatedItem type="otherVersion">
2234 <xsl:call-template name="relatedItem76X-78X"></xsl:call-template>
2237 <xsl:for-each select="marc:datafield[@tag=770]|marc:datafield[@tag=774]">
2238 <relatedItem type="constituent">
2239 <xsl:call-template name="relatedItem76X-78X"></xsl:call-template>
2242 <xsl:for-each select="marc:datafield[@tag=772]|marc:datafield[@tag=773]">
2243 <relatedItem type="host">
2244 <xsl:call-template name="relatedItem76X-78X"></xsl:call-template>
2247 <xsl:for-each select="marc:datafield[@tag=776]">
2248 <relatedItem type="otherFormat">
2249 <xsl:call-template name="relatedItem76X-78X"></xsl:call-template>
2252 <xsl:for-each select="marc:datafield[@tag=780]">
2253 <relatedItem type="preceding">
2254 <xsl:call-template name="relatedItem76X-78X"></xsl:call-template>
2257 <xsl:for-each select="marc:datafield[@tag=785]">
2258 <relatedItem type="succeeding">
2259 <xsl:call-template name="relatedItem76X-78X"></xsl:call-template>
2262 <xsl:for-each select="marc:datafield[@tag=786]">
2263 <relatedItem type="original">
2264 <xsl:call-template name="relatedItem76X-78X"></xsl:call-template>
2267 <xsl:for-each select="marc:datafield[@tag=800]">
2268 <relatedItem type="series">
2271 <xsl:call-template name="chopPunctuation">
2272 <xsl:with-param name="chopString">
2273 <xsl:call-template name="specialSubfieldSelect">
2274 <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
2275 <xsl:with-param name="axis">t</xsl:with-param>
2276 <xsl:with-param name="afterCodes">g</xsl:with-param>
2277 </xsl:call-template>
2279 </xsl:call-template>
2281 <xsl:call-template name="part"></xsl:call-template>
2283 <name type="personal">
2285 <xsl:call-template name="chopPunctuation">
2286 <xsl:with-param name="chopString">
2287 <xsl:call-template name="specialSubfieldSelect">
2288 <xsl:with-param name="anyCodes">aq</xsl:with-param>
2289 <xsl:with-param name="axis">t</xsl:with-param>
2290 <xsl:with-param name="beforeCodes">g</xsl:with-param>
2291 </xsl:call-template>
2293 </xsl:call-template>
2295 <xsl:call-template name="termsOfAddress"></xsl:call-template>
2296 <xsl:call-template name="nameDate"></xsl:call-template>
2297 <xsl:call-template name="role"></xsl:call-template>
2299 <xsl:call-template name="relatedForm"></xsl:call-template>
2302 <xsl:for-each select="marc:datafield[@tag=810]">
2303 <relatedItem type="series">
2306 <xsl:call-template name="chopPunctuation">
2307 <xsl:with-param name="chopString">
2308 <xsl:call-template name="specialSubfieldSelect">
2309 <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
2310 <xsl:with-param name="axis">t</xsl:with-param>
2311 <xsl:with-param name="afterCodes">dg</xsl:with-param>
2312 </xsl:call-template>
2314 </xsl:call-template>
2316 <xsl:call-template name="relatedPartNumName"></xsl:call-template>
2318 <name type="corporate">
2319 <xsl:for-each select="marc:subfield[@code='a']">
2321 <xsl:value-of select="."></xsl:value-of>
2324 <xsl:for-each select="marc:subfield[@code='b']">
2326 <xsl:value-of select="."></xsl:value-of>
2330 <xsl:call-template name="specialSubfieldSelect">
2331 <xsl:with-param name="anyCodes">c</xsl:with-param>
2332 <xsl:with-param name="axis">t</xsl:with-param>
2333 <xsl:with-param name="beforeCodes">dgn</xsl:with-param>
2334 </xsl:call-template>
2336 <xsl:call-template name="role"></xsl:call-template>
2338 <xsl:call-template name="relatedForm"></xsl:call-template>
2341 <xsl:for-each select="marc:datafield[@tag=811]">
2342 <relatedItem type="series">
2345 <xsl:call-template name="chopPunctuation">
2346 <xsl:with-param name="chopString">
2347 <xsl:call-template name="specialSubfieldSelect">
2348 <xsl:with-param name="anyCodes">tfklsv</xsl:with-param>
2349 <xsl:with-param name="axis">t</xsl:with-param>
2350 <xsl:with-param name="afterCodes">g</xsl:with-param>
2351 </xsl:call-template>
2353 </xsl:call-template>
2355 <xsl:call-template name="relatedPartNumName"/>
2357 <name type="conference">
2359 <xsl:call-template name="specialSubfieldSelect">
2360 <xsl:with-param name="anyCodes">aqdc</xsl:with-param>
2361 <xsl:with-param name="axis">t</xsl:with-param>
2362 <xsl:with-param name="beforeCodes">gn</xsl:with-param>
2363 </xsl:call-template>
2365 <xsl:call-template name="role"/>
2367 <xsl:call-template name="relatedForm"/>
2370 <xsl:for-each select="marc:datafield[@tag='830']">
2371 <relatedItem type="series">
2372 <xsl:variable name="titleChop">
2373 <xsl:call-template name="chopPunctuation">
2374 <xsl:with-param name="chopString">
2375 <xsl:call-template name="subfieldSelect">
2376 <xsl:with-param name="codes">adfgklmorsv</xsl:with-param>
2377 </xsl:call-template>
2379 </xsl:call-template>
2383 <xsl:value-of select="$titleChop" />
2385 <xsl:call-template name="part"/>
2387 <titleInfo type="nfi">
2389 <xsl:when test="@ind2>0">
2391 <xsl:value-of select="substring($titleChop,1,@ind2)"/>
2394 <xsl:value-of select="substring($titleChop,@ind2+1)"/>
2399 <xsl:value-of select="$titleChop" />
2403 <xsl:call-template name="part"/>
2405 <xsl:call-template name="relatedForm"/>
2408 <xsl:for-each select="marc:datafield[@tag='856'][@ind2='2']/marc:subfield[@code='q']">
2411 <xsl:value-of select="."/>
2412 </internetMediaType>
2415 <xsl:for-each select="marc:datafield[@tag='020']">
2416 <xsl:call-template name="isInvalid">
2417 <xsl:with-param name="type">isbn</xsl:with-param>
2418 </xsl:call-template>
2419 <xsl:if test="marc:subfield[@code='a']">
2420 <identifier type="isbn">
2421 <xsl:value-of select="marc:subfield[@code='a']"/>
2425 <xsl:for-each select="marc:datafield[@tag='024'][@ind1='0']">
2426 <xsl:call-template name="isInvalid">
2427 <xsl:with-param name="type">isrc</xsl:with-param>
2428 </xsl:call-template>
2429 <xsl:if test="marc:subfield[@code='a']">
2430 <identifier type="isrc">
2431 <xsl:value-of select="marc:subfield[@code='a']"/>
2435 <xsl:for-each select="marc:datafield[@tag='024'][@ind1='2']">
2436 <xsl:call-template name="isInvalid">
2437 <xsl:with-param name="type">ismn</xsl:with-param>
2438 </xsl:call-template>
2439 <xsl:if test="marc:subfield[@code='a']">
2440 <identifier type="ismn">
2441 <xsl:value-of select="marc:subfield[@code='a']"/>
2445 <xsl:for-each select="marc:datafield[@tag='024'][@ind1='4']">
2446 <xsl:call-template name="isInvalid">
2447 <xsl:with-param name="type">sici</xsl:with-param>
2448 </xsl:call-template>
2449 <identifier type="sici">
2450 <xsl:call-template name="subfieldSelect">
2451 <xsl:with-param name="codes">ab</xsl:with-param>
2452 </xsl:call-template>
2455 <xsl:for-each select="marc:datafield[@tag='022']">
2456 <xsl:call-template name="isInvalid">
2457 <xsl:with-param name="type">issn</xsl:with-param>
2458 </xsl:call-template>
2459 <identifier type="issn">
2460 <xsl:value-of select="marc:subfield[@code='a']"/>
2463 <xsl:for-each select="marc:datafield[@tag='010']">
2464 <xsl:call-template name="isInvalid">
2465 <xsl:with-param name="type">lccn</xsl:with-param>
2466 </xsl:call-template>
2467 <identifier type="lccn">
2468 <xsl:value-of select="normalize-space(marc:subfield[@code='a'])"/>
2471 <xsl:for-each select="marc:datafield[@tag='028']">
2473 <xsl:attribute name="type">
2475 <xsl:when test="@ind1='0'">issue number</xsl:when>
2476 <xsl:when test="@ind1='1'">matrix number</xsl:when>
2477 <xsl:when test="@ind1='2'">music plate</xsl:when>
2478 <xsl:when test="@ind1='3'">music publisher</xsl:when>
2479 <xsl:when test="@ind1='4'">videorecording identifier</xsl:when>
2482 <!--<xsl:call-template name="isInvalid"/>--> <!-- no $z in 028 -->
2483 <xsl:call-template name="subfieldSelect">
2484 <xsl:with-param name="codes">
2486 <xsl:when test="@ind1='0'">ba</xsl:when>
2487 <xsl:otherwise>ab</xsl:otherwise>
2490 </xsl:call-template>
2493 <xsl:for-each select="marc:datafield[@tag='037']">
2494 <identifier type="stock number">
2495 <!--<xsl:call-template name="isInvalid"/>--> <!-- no $z in 037 -->
2496 <xsl:call-template name="subfieldSelect">
2497 <xsl:with-param name="codes">ab</xsl:with-param>
2498 </xsl:call-template>
2501 <xsl:for-each select="marc:datafield[@tag='856'][marc:subfield[@code='u']]">
2503 <xsl:attribute name="type">
2505 <xsl:when test="starts-with(marc:subfield[@code='u'],'urn:doi') or starts-with(marc:subfield[@code='u'],'doi')">doi</xsl:when>
2506 <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>
2507 <xsl:otherwise>uri</xsl:otherwise>
2511 <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') ">
2512 <xsl:value-of select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))"></xsl:value-of>
2515 <xsl:value-of select="marc:subfield[@code='u']"></xsl:value-of>
2519 <xsl:if test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl')">
2520 <identifier type="hdl">
2521 <xsl:if test="marc:subfield[@code='y' or @code='3' or @code='z']">
2522 <xsl:attribute name="displayLabel">
2523 <xsl:call-template name="subfieldSelect">
2524 <xsl:with-param name="codes">y3z</xsl:with-param>
2525 </xsl:call-template>
2528 <xsl:value-of select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))"></xsl:value-of>
2532 <xsl:for-each select="marc:datafield[@tag=024][@ind1=1]">
2533 <identifier type="upc">
2534 <xsl:call-template name="isInvalid"/>
2535 <xsl:value-of select="marc:subfield[@code='a']"/>
2538 <!-- 1/04 fix added $y -->
2539 <xsl:for-each select="marc:datafield[@tag=856][marc:subfield[@code='u']]">
2542 <xsl:if test="marc:subfield[@code='y' or @code='3']">
2543 <xsl:attribute name="displayLabel">
2544 <xsl:call-template name="subfieldSelect">
2545 <xsl:with-param name="codes">y3</xsl:with-param>
2546 </xsl:call-template>
2549 <xsl:if test="marc:subfield[@code='z' ]">
2550 <xsl:attribute name="note">
2551 <xsl:call-template name="subfieldSelect">
2552 <xsl:with-param name="codes">z</xsl:with-param>
2553 </xsl:call-template>
2556 <xsl:value-of select="marc:subfield[@code='u']"></xsl:value-of>
2562 <!-- 3.2 change tmee 856z -->
2565 <xsl:for-each select="marc:datafield[@tag=852]">
2568 <xsl:call-template name="displayLabel"></xsl:call-template>
2569 <xsl:call-template name="subfieldSelect">
2570 <xsl:with-param name="codes">abje</xsl:with-param>
2571 </xsl:call-template>
2575 <xsl:for-each select="marc:datafield[@tag=506]">
2576 <accessCondition type="restrictionOnAccess">
2577 <xsl:call-template name="subfieldSelect">
2578 <xsl:with-param name="codes">abcd35</xsl:with-param>
2579 </xsl:call-template>
2582 <xsl:for-each select="marc:datafield[@tag=540]">
2583 <accessCondition type="useAndReproduction">
2584 <xsl:call-template name="subfieldSelect">
2585 <xsl:with-param name="codes">abcde35</xsl:with-param>
2586 </xsl:call-template>
2590 <xsl:for-each select="marc:datafield[@tag=040]">
2591 <recordContentSource authority="marcorg">
2592 <xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of>
2593 </recordContentSource>
2595 <xsl:for-each select="marc:controlfield[@tag=008]">
2596 <recordCreationDate encoding="marc">
2597 <xsl:value-of select="substring(.,1,6)"></xsl:value-of>
2598 </recordCreationDate>
2600 <xsl:for-each select="marc:controlfield[@tag=005]">
2601 <recordChangeDate encoding="iso8601">
2602 <xsl:value-of select="."></xsl:value-of>
2605 <xsl:for-each select="marc:controlfield[@tag=001]">
2607 <xsl:if test="../marc:controlfield[@tag=003]">
2608 <xsl:attribute name="source">
2609 <xsl:value-of select="../marc:controlfield[@tag=003]"></xsl:value-of>
2612 <xsl:value-of select="."></xsl:value-of>
2615 <xsl:for-each select="marc:datafield[@tag=040]/marc:subfield[@code='b']">
2616 <languageOfCataloging>
2617 <languageTerm authority="iso639-2b" type="code">
2618 <xsl:value-of select="."></xsl:value-of>
2620 </languageOfCataloging>
2624 <xsl:template name="displayForm">
2625 <xsl:for-each select="marc:subfield[@code='c']">
2627 <xsl:value-of select="."></xsl:value-of>
2631 <xsl:template name="affiliation">
2632 <xsl:for-each select="marc:subfield[@code='u']">
2634 <xsl:value-of select="."></xsl:value-of>
2638 <xsl:template name="uri">
2639 <xsl:for-each select="marc:subfield[@code='u']">
2640 <xsl:attribute name="xlink:href">
2641 <xsl:value-of select="."></xsl:value-of>
2644 <xsl:for-each select="marc:subfield[@code='0']">
2646 <xsl:when test="contains(text(), ')')">
2647 <xsl:attribute name="xlink:href">
2648 <xsl:value-of select="substring-after(text(), ')')"></xsl:value-of>
2652 <xsl:attribute name="xlink:href">
2653 <xsl:value-of select="."></xsl:value-of>
2659 <xsl:template name="role">
2660 <xsl:for-each select="marc:subfield[@code='e']">
2662 <roleTerm type="text">
2663 <xsl:value-of select="."></xsl:value-of>
2667 <xsl:for-each select="marc:subfield[@code='4']">
2669 <roleTerm authority="marcrelator" type="code">
2670 <xsl:value-of select="."></xsl:value-of>
2675 <xsl:template name="part">
2676 <xsl:variable name="partNumber">
2677 <xsl:call-template name="specialSubfieldSelect">
2678 <xsl:with-param name="axis">n</xsl:with-param>
2679 <xsl:with-param name="anyCodes">n</xsl:with-param>
2680 <xsl:with-param name="afterCodes">fgkdlmor</xsl:with-param>
2681 </xsl:call-template>
2683 <xsl:variable name="partName">
2684 <xsl:call-template name="specialSubfieldSelect">
2685 <xsl:with-param name="axis">p</xsl:with-param>
2686 <xsl:with-param name="anyCodes">p</xsl:with-param>
2687 <xsl:with-param name="afterCodes">fgkdlmor</xsl:with-param>
2688 </xsl:call-template>
2690 <xsl:if test="string-length(normalize-space($partNumber))">
2692 <xsl:call-template name="chopPunctuation">
2693 <xsl:with-param name="chopString" select="$partNumber"></xsl:with-param>
2694 </xsl:call-template>
2697 <xsl:if test="string-length(normalize-space($partName))">
2699 <xsl:call-template name="chopPunctuation">
2700 <xsl:with-param name="chopString" select="$partName"></xsl:with-param>
2701 </xsl:call-template>
2705 <xsl:template name="relatedPart">
2706 <xsl:if test="@tag=773">
2707 <xsl:for-each select="marc:subfield[@code='g']">
2710 <xsl:value-of select="."></xsl:value-of>
2714 <xsl:for-each select="marc:subfield[@code='q']">
2716 <xsl:call-template name="parsePart"></xsl:call-template>
2721 <xsl:template name="relatedPartNumName">
2722 <xsl:variable name="partNumber">
2723 <xsl:call-template name="specialSubfieldSelect">
2724 <xsl:with-param name="axis">g</xsl:with-param>
2725 <xsl:with-param name="anyCodes">g</xsl:with-param>
2726 <xsl:with-param name="afterCodes">pst</xsl:with-param>
2727 </xsl:call-template>
2729 <xsl:variable name="partName">
2730 <xsl:call-template name="specialSubfieldSelect">
2731 <xsl:with-param name="axis">p</xsl:with-param>
2732 <xsl:with-param name="anyCodes">p</xsl:with-param>
2733 <xsl:with-param name="afterCodes">fgkdlmor</xsl:with-param>
2734 </xsl:call-template>
2736 <xsl:if test="string-length(normalize-space($partNumber))">
2738 <xsl:value-of select="$partNumber"></xsl:value-of>
2741 <xsl:if test="string-length(normalize-space($partName))">
2743 <xsl:value-of select="$partName"></xsl:value-of>
2747 <xsl:template name="relatedName">
2748 <xsl:for-each select="marc:subfield[@code='a']">
2751 <xsl:value-of select="."></xsl:value-of>
2756 <xsl:template name="relatedForm">
2757 <xsl:for-each select="marc:subfield[@code='h']">
2758 <physicalDescription>
2760 <xsl:value-of select="."></xsl:value-of>
2762 </physicalDescription>
2765 <xsl:template name="relatedExtent">
2766 <xsl:for-each select="marc:subfield[@code='h']">
2767 <physicalDescription>
2769 <xsl:value-of select="."></xsl:value-of>
2771 </physicalDescription>
2774 <xsl:template name="relatedNote">
2775 <xsl:for-each select="marc:subfield[@code='n']">
2777 <xsl:value-of select="."></xsl:value-of>
2781 <xsl:template name="relatedSubject">
2782 <xsl:for-each select="marc:subfield[@code='j']">
2784 <temporal encoding="iso8601">
2785 <xsl:call-template name="chopPunctuation">
2786 <xsl:with-param name="chopString" select="."></xsl:with-param>
2787 </xsl:call-template>
2792 <xsl:template name="relatedIdentifierISSN">
2793 <xsl:for-each select="marc:subfield[@code='x']">
2794 <identifier type="issn">
2795 <xsl:value-of select="."></xsl:value-of>
2799 <xsl:template name="relatedIdentifierLocal">
2800 <xsl:for-each select="marc:subfield[@code='w']">
2801 <identifier type="local">
2802 <xsl:value-of select="."></xsl:value-of>
2806 <xsl:template name="relatedIdentifier">
2807 <xsl:for-each select="marc:subfield[@code='o']">
2809 <xsl:value-of select="."></xsl:value-of>
2813 <xsl:template name="relatedItem76X-78X">
2814 <xsl:call-template name="displayLabel"></xsl:call-template>
2815 <xsl:call-template name="relatedTitle76X-78X"></xsl:call-template>
2816 <xsl:call-template name="relatedName"></xsl:call-template>
2817 <xsl:call-template name="relatedOriginInfo"></xsl:call-template>
2818 <xsl:call-template name="relatedLanguage"></xsl:call-template>
2819 <xsl:call-template name="relatedExtent"></xsl:call-template>
2820 <xsl:call-template name="relatedNote"></xsl:call-template>
2821 <xsl:call-template name="relatedSubject"></xsl:call-template>
2822 <xsl:call-template name="relatedIdentifier"></xsl:call-template>
2823 <xsl:call-template name="relatedIdentifierISSN"></xsl:call-template>
2824 <xsl:call-template name="relatedIdentifierLocal"></xsl:call-template>
2825 <xsl:call-template name="relatedPart"></xsl:call-template>
2827 <xsl:template name="subjectGeographicZ">
2829 <xsl:call-template name="chopPunctuation">
2830 <xsl:with-param name="chopString" select="."></xsl:with-param>
2831 </xsl:call-template>
2834 <xsl:template name="subjectTemporalY">
2836 <xsl:call-template name="chopPunctuation">
2837 <xsl:with-param name="chopString" select="."></xsl:with-param>
2838 </xsl:call-template>
2841 <xsl:template name="subjectTopic">
2843 <xsl:call-template name="chopPunctuation">
2844 <xsl:with-param name="chopString" select="."></xsl:with-param>
2845 </xsl:call-template>
2848 <!-- 3.2 change tmee 6xx $v genre -->
2849 <xsl:template name="subjectGenre">
2851 <xsl:call-template name="chopPunctuation">
2852 <xsl:with-param name="chopString" select="."></xsl:with-param>
2853 </xsl:call-template>
2857 <xsl:template name="nameABCDN">
2858 <xsl:for-each select="marc:subfield[@code='a']">
2860 <xsl:call-template name="chopPunctuation">
2861 <xsl:with-param name="chopString" select="."></xsl:with-param>
2862 </xsl:call-template>
2865 <xsl:for-each select="marc:subfield[@code='b']">
2867 <xsl:value-of select="."></xsl:value-of>
2870 <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
2872 <xsl:call-template name="subfieldSelect">
2873 <xsl:with-param name="codes">cdn</xsl:with-param>
2874 </xsl:call-template>
2878 <xsl:template name="nameABCDQ">
2880 <xsl:call-template name="chopPunctuation">
2881 <xsl:with-param name="chopString">
2882 <xsl:call-template name="subfieldSelect">
2883 <xsl:with-param name="codes">aq</xsl:with-param>
2884 </xsl:call-template>
2886 <xsl:with-param name="punctuation">
2887 <xsl:text>:,;/ </xsl:text>
2889 </xsl:call-template>
2891 <xsl:call-template name="termsOfAddress"></xsl:call-template>
2892 <xsl:call-template name="nameDate"></xsl:call-template>
2894 <xsl:template name="nameACDEQ">
2896 <xsl:call-template name="subfieldSelect">
2897 <xsl:with-param name="codes">acdeq</xsl:with-param>
2898 </xsl:call-template>
2901 <xsl:template name="constituentOrRelatedType">
2902 <xsl:if test="@ind2=2">
2903 <xsl:attribute name="type">constituent</xsl:attribute>
2906 <xsl:template name="relatedTitle">
2907 <xsl:for-each select="marc:subfield[@code='t']">
2910 <xsl:call-template name="chopPunctuation">
2911 <xsl:with-param name="chopString">
2912 <xsl:value-of select="."></xsl:value-of>
2914 </xsl:call-template>
2919 <xsl:template name="relatedTitle76X-78X">
2920 <xsl:for-each select="marc:subfield[@code='t']">
2923 <xsl:call-template name="chopPunctuation">
2924 <xsl:with-param name="chopString">
2925 <xsl:value-of select="."></xsl:value-of>
2927 </xsl:call-template>
2929 <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
2930 <xsl:call-template name="relatedPartNumName"></xsl:call-template>
2934 <xsl:for-each select="marc:subfield[@code='p']">
2935 <titleInfo type="abbreviated">
2937 <xsl:call-template name="chopPunctuation">
2938 <xsl:with-param name="chopString">
2939 <xsl:value-of select="."></xsl:value-of>
2941 </xsl:call-template>
2943 <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
2944 <xsl:call-template name="relatedPartNumName"></xsl:call-template>
2948 <xsl:for-each select="marc:subfield[@code='s']">
2949 <titleInfo type="uniform">
2951 <xsl:call-template name="chopPunctuation">
2952 <xsl:with-param name="chopString">
2953 <xsl:value-of select="."></xsl:value-of>
2955 </xsl:call-template>
2957 <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
2958 <xsl:call-template name="relatedPartNumName"></xsl:call-template>
2963 <xsl:template name="relatedOriginInfo">
2964 <xsl:if test="marc:subfield[@code='b' or @code='d'] or marc:subfield[@code='f']">
2966 <xsl:if test="@tag=775">
2967 <xsl:for-each select="marc:subfield[@code='f']">
2970 <xsl:attribute name="type">code</xsl:attribute>
2971 <xsl:attribute name="authority">marcgac</xsl:attribute>
2972 <xsl:value-of select="."></xsl:value-of>
2977 <xsl:for-each select="marc:subfield[@code='d']">
2979 <xsl:value-of select="."></xsl:value-of>
2982 <xsl:for-each select="marc:subfield[@code='b']">
2984 <xsl:value-of select="."></xsl:value-of>
2990 <xsl:template name="relatedLanguage">
2991 <xsl:for-each select="marc:subfield[@code='e']">
2992 <xsl:call-template name="getLanguage">
2993 <xsl:with-param name="langString">
2994 <xsl:value-of select="."></xsl:value-of>
2996 </xsl:call-template>
2999 <xsl:template name="nameDate">
3000 <xsl:for-each select="marc:subfield[@code='d']">
3001 <namePart type="date">
3002 <xsl:call-template name="chopPunctuation">
3003 <xsl:with-param name="chopString" select="."></xsl:with-param>
3004 </xsl:call-template>
3008 <xsl:template name="subjectAuthority">
3009 <xsl:if test="@ind2!=4">
3010 <xsl:if test="@ind2!=' '">
3011 <xsl:if test="@ind2!=8">
3012 <xsl:if test="@ind2!=9">
3013 <xsl:attribute name="authority">
3015 <xsl:when test="@ind2=0">lcsh</xsl:when>
3016 <xsl:when test="@ind2=1">lcshac</xsl:when>
3017 <xsl:when test="@ind2=2">mesh</xsl:when>
3019 <xsl:when test="@ind2=3">nal</xsl:when>
3020 <xsl:when test="@ind2=5">csh</xsl:when>
3021 <xsl:when test="@ind2=6">rvm</xsl:when>
3022 <xsl:when test="@ind2=7">
3023 <xsl:value-of select="marc:subfield[@code='2']"></xsl:value-of>
3032 <xsl:template name="subjectAnyOrder">
3033 <xsl:for-each select="marc:subfield[@code='v' or @code='x' or @code='y' or @code='z']">
3035 <xsl:when test="@code='v'">
3036 <xsl:call-template name="subjectGenre"></xsl:call-template>
3038 <xsl:when test="@code='x'">
3039 <xsl:call-template name="subjectTopic"></xsl:call-template>
3041 <xsl:when test="@code='y'">
3042 <xsl:call-template name="subjectTemporalY"></xsl:call-template>
3044 <xsl:when test="@code='z'">
3045 <xsl:call-template name="subjectGeographicZ"></xsl:call-template>
3050 <xsl:template name="specialSubfieldSelect">
3051 <xsl:param name="anyCodes"></xsl:param>
3052 <xsl:param name="axis"></xsl:param>
3053 <xsl:param name="beforeCodes"></xsl:param>
3054 <xsl:param name="afterCodes"></xsl:param>
3055 <xsl:variable name="str">
3056 <xsl:for-each select="marc:subfield">
3057 <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])">
3058 <xsl:value-of select="text()"></xsl:value-of>
3059 <xsl:text> </xsl:text>
3063 <xsl:value-of select="substring($str,1,string-length($str)-1)"></xsl:value-of>
3066 <!-- 3.2 change tmee 6xx $v genre -->
3067 <xsl:template match="marc:datafield[@tag=600]">
3069 <xsl:call-template name="subjectAuthority"></xsl:call-template>
3070 <name type="personal">
3071 <xsl:call-template name="uri" />
3072 <xsl:call-template name="termsOfAddress"></xsl:call-template>
3074 <xsl:call-template name="chopPunctuation">
3075 <xsl:with-param name="chopString">
3076 <xsl:call-template name="subfieldSelect">
3077 <xsl:with-param name="codes">aq</xsl:with-param>
3078 </xsl:call-template>
3080 </xsl:call-template>
3082 <xsl:call-template name="nameDate"></xsl:call-template>
3083 <xsl:call-template name="affiliation"></xsl:call-template>
3084 <xsl:call-template name="role"></xsl:call-template>
3086 <xsl:call-template name="subjectAnyOrder"></xsl:call-template>
3089 <xsl:template match="marc:datafield[@tag=610]">
3091 <xsl:call-template name="subjectAuthority"></xsl:call-template>
3092 <name type="corporate">
3093 <xsl:call-template name="uri" />
3094 <xsl:for-each select="marc:subfield[@code='a']">
3096 <xsl:value-of select="."></xsl:value-of>
3099 <xsl:for-each select="marc:subfield[@code='b']">
3101 <xsl:value-of select="."></xsl:value-of>
3104 <xsl:if test="marc:subfield[@code='c' or @code='d' or @code='n' or @code='p']">
3106 <xsl:call-template name="subfieldSelect">
3107 <xsl:with-param name="codes">cdnp</xsl:with-param>
3108 </xsl:call-template>
3111 <xsl:call-template name="role"></xsl:call-template>
3113 <xsl:call-template name="subjectAnyOrder"></xsl:call-template>
3116 <xsl:template match="marc:datafield[@tag=611]">
3118 <xsl:call-template name="subjectAuthority"></xsl:call-template>
3119 <name type="conference">
3120 <xsl:call-template name="uri" />
3122 <xsl:call-template name="subfieldSelect">
3123 <xsl:with-param name="codes">abcdeqnp</xsl:with-param>
3124 </xsl:call-template>
3126 <xsl:for-each select="marc:subfield[@code='4']">
3128 <roleTerm authority="marcrelator" type="code">
3129 <xsl:value-of select="."></xsl:value-of>
3134 <xsl:call-template name="subjectAnyOrder"></xsl:call-template>
3137 <xsl:template match="marc:datafield[@tag=630]">
3139 <xsl:call-template name="subjectAuthority"></xsl:call-template>
3140 <xsl:variable name="titleChop">
3141 <xsl:call-template name="chopPunctuation">
3142 <xsl:with-param name="chopString">
3143 <xsl:call-template name="subfieldSelect">
3144 <xsl:with-param name="codes">adfhklor</xsl:with-param>
3145 </xsl:call-template>
3147 </xsl:call-template>
3151 <xsl:value-of select="$titleChop" />
3153 <xsl:call-template name="part"></xsl:call-template>
3155 <titleInfo type="nfi">
3157 <xsl:when test="@ind1>0">
3159 <xsl:value-of select="substring($titleChop,1,@ind1)"/>
3162 <xsl:value-of select="substring($titleChop,@ind1+1)"/>
3164 <xsl:call-template name="part"/>
3168 <xsl:value-of select="$titleChop" />
3172 <xsl:call-template name="part"></xsl:call-template>
3174 <xsl:call-template name="subjectAnyOrder"></xsl:call-template>
3177 <xsl:template match="marc:datafield[@tag=650]">
3179 <xsl:call-template name="subjectAuthority"></xsl:call-template>
3181 <xsl:call-template name="uri" />
3182 <xsl:call-template name="chopPunctuation">
3183 <xsl:with-param name="chopString">
3184 <xsl:call-template name="subfieldSelect">
3185 <xsl:with-param name="codes">abcd</xsl:with-param>
3186 </xsl:call-template>
3188 </xsl:call-template>
3190 <xsl:call-template name="subjectAnyOrder"></xsl:call-template>
3193 <xsl:template match="marc:datafield[@tag=651]">
3195 <xsl:call-template name="subjectAuthority"></xsl:call-template>
3196 <xsl:for-each select="marc:subfield[@code='a']">
3198 <xsl:call-template name="uri" />
3199 <xsl:call-template name="chopPunctuation">
3200 <xsl:with-param name="chopString" select="."></xsl:with-param>
3201 </xsl:call-template>
3204 <xsl:call-template name="subjectAnyOrder"></xsl:call-template>
3207 <xsl:template match="marc:datafield[@tag=653]">
3209 <xsl:for-each select="marc:subfield[@code='a']">
3211 <xsl:call-template name="uri" />
3212 <xsl:value-of select="."></xsl:value-of>
3217 <xsl:template match="marc:datafield[@tag=656]">
3219 <xsl:if test="marc:subfield[@code=2]">
3220 <xsl:attribute name="authority">
3221 <xsl:value-of select="marc:subfield[@code=2]"></xsl:value-of>
3225 <xsl:call-template name="uri" />
3226 <xsl:call-template name="chopPunctuation">
3227 <xsl:with-param name="chopString">
3228 <xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of>
3230 </xsl:call-template>
3234 <xsl:template name="termsOfAddress">
3235 <xsl:if test="marc:subfield[@code='b' or @code='c']">
3236 <namePart type="termsOfAddress">
3237 <xsl:call-template name="chopPunctuation">
3238 <xsl:with-param name="chopString">
3239 <xsl:call-template name="subfieldSelect">
3240 <xsl:with-param name="codes">bc</xsl:with-param>
3241 </xsl:call-template>
3243 </xsl:call-template>
3247 <xsl:template name="displayLabel">
3248 <xsl:if test="marc:subfield[@code='i']">
3249 <xsl:attribute name="displayLabel">
3250 <xsl:value-of select="marc:subfield[@code='i']"></xsl:value-of>
3253 <xsl:if test="marc:subfield[@code='3']">
3254 <xsl:attribute name="displayLabel">
3255 <xsl:value-of select="marc:subfield[@code='3']"></xsl:value-of>
3259 <xsl:template name="isInvalid">
3260 <xsl:param name="type"/>
3261 <xsl:if test="marc:subfield[@code='z'] or marc:subfield[@code='y']">
3263 <xsl:attribute name="type">
3264 <xsl:value-of select="$type"/>
3266 <xsl:attribute name="invalid">
3267 <xsl:text>yes</xsl:text>
3269 <xsl:if test="marc:subfield[@code='z']">
3270 <xsl:value-of select="marc:subfield[@code='z']"/>
3272 <xsl:if test="marc:subfield[@code='y']">
3273 <xsl:value-of select="marc:subfield[@code='y']"/>
3278 <xsl:template name="subtitle">
3279 <xsl:if test="marc:subfield[@code='b']">
3281 <xsl:call-template name="chopPunctuation">
3282 <xsl:with-param name="chopString">
3283 <xsl:value-of select="marc:subfield[@code='b']"/>
3284 <!--<xsl:call-template name="subfieldSelect">
3285 <xsl:with-param name="codes">b</xsl:with-param>
3286 </xsl:call-template>-->
3288 </xsl:call-template>
3292 <xsl:template name="script">
3293 <xsl:param name="scriptCode"></xsl:param>
3294 <xsl:attribute name="script">
3296 <xsl:when test="$scriptCode='(3'">Arabic</xsl:when>
3297 <xsl:when test="$scriptCode='(B'">Latin</xsl:when>
3298 <xsl:when test="$scriptCode='$1'">Chinese, Japanese, Korean</xsl:when>
3299 <xsl:when test="$scriptCode='(N'">Cyrillic</xsl:when>
3300 <xsl:when test="$scriptCode='(2'">Hebrew</xsl:when>
3301 <xsl:when test="$scriptCode='(S'">Greek</xsl:when>
3305 <xsl:template name="parsePart">
3306 <!-- assumes 773$q= 1:2:3<4
3307 with up to 3 levels and one optional start page
3309 <xsl:variable name="level1">
3311 <xsl:when test="contains(text(),':')">
3313 <xsl:value-of select="substring-before(text(),':')"></xsl:value-of>
3315 <xsl:when test="not(contains(text(),':'))">
3317 <xsl:if test="contains(text(),'<')">
3319 <xsl:value-of select="substring-before(text(),'<')"></xsl:value-of>
3321 <xsl:if test="not(contains(text(),'<'))">
3323 <xsl:value-of select="text()"></xsl:value-of>
3328 <xsl:variable name="sici2">
3330 <xsl:when test="starts-with(substring-after(text(),$level1),':')">
3331 <xsl:value-of select="substring(substring-after(text(),$level1),2)"></xsl:value-of>
3334 <xsl:value-of select="substring-after(text(),$level1)"></xsl:value-of>
3338 <xsl:variable name="level2">
3340 <xsl:when test="contains($sici2,':')">
3342 <xsl:value-of select="substring-before($sici2,':')"></xsl:value-of>
3344 <xsl:when test="contains($sici2,'<')">
3346 <xsl:value-of select="substring-before($sici2,'<')"></xsl:value-of>
3349 <xsl:value-of select="$sici2"></xsl:value-of>
3354 <xsl:variable name="sici3">
3356 <xsl:when test="starts-with(substring-after($sici2,$level2),':')">
3357 <xsl:value-of select="substring(substring-after($sici2,$level2),2)"></xsl:value-of>
3360 <xsl:value-of select="substring-after($sici2,$level2)"></xsl:value-of>
3364 <xsl:variable name="level3">
3366 <xsl:when test="contains($sici3,'<')">
3368 <xsl:value-of select="substring-before($sici3,'<')"></xsl:value-of>
3371 <xsl:value-of select="$sici3"></xsl:value-of>
3376 <xsl:variable name="page">
3377 <xsl:if test="contains(text(),'<')">
3378 <xsl:value-of select="substring-after(text(),'<')"></xsl:value-of>
3381 <xsl:if test="$level1">
3384 <xsl:value-of select="$level1"></xsl:value-of>
3388 <xsl:if test="$level2">
3391 <xsl:value-of select="$level2"></xsl:value-of>
3395 <xsl:if test="$level3">
3398 <xsl:value-of select="$level3"></xsl:value-of>
3402 <xsl:if test="$page">
3403 <extent unit="page">
3405 <xsl:value-of select="$page"></xsl:value-of>
3410 <xsl:template name="getLanguage">
3411 <xsl:param name="langString"></xsl:param>
3412 <xsl:param name="controlField008-35-37"></xsl:param>
3413 <xsl:variable name="length" select="string-length($langString)"></xsl:variable>
3415 <xsl:when test="$length=0"></xsl:when>
3416 <xsl:when test="$controlField008-35-37=substring($langString,1,3)">
3417 <xsl:call-template name="getLanguage">
3418 <xsl:with-param name="langString" select="substring($langString,4,$length)"></xsl:with-param>
3419 <xsl:with-param name="controlField008-35-37" select="$controlField008-35-37"></xsl:with-param>
3420 </xsl:call-template>
3424 <languageTerm authority="iso639-2b" type="code">
3425 <xsl:value-of select="substring($langString,1,3)"></xsl:value-of>
3428 <xsl:call-template name="getLanguage">
3429 <xsl:with-param name="langString" select="substring($langString,4,$length)"></xsl:with-param>
3430 <xsl:with-param name="controlField008-35-37" select="$controlField008-35-37"></xsl:with-param>
3431 </xsl:call-template>
3435 <xsl:template name="isoLanguage">
3436 <xsl:param name="currentLanguage"></xsl:param>
3437 <xsl:param name="usedLanguages"></xsl:param>
3438 <xsl:param name="remainingLanguages"></xsl:param>
3440 <xsl:when test="string-length($currentLanguage)=0"></xsl:when>
3441 <xsl:when test="not(contains($usedLanguages, $currentLanguage))">
3443 <xsl:if test="@code!='a'">
3444 <xsl:attribute name="objectPart">
3446 <xsl:when test="@code='b'">summary or subtitle</xsl:when>
3447 <xsl:when test="@code='d'">sung or spoken text</xsl:when>
3448 <xsl:when test="@code='e'">libretto</xsl:when>
3449 <xsl:when test="@code='f'">table of contents</xsl:when>
3450 <xsl:when test="@code='g'">accompanying material</xsl:when>
3451 <xsl:when test="@code='h'">translation</xsl:when>
3455 <languageTerm authority="iso639-2b" type="code">
3456 <xsl:value-of select="$currentLanguage"></xsl:value-of>
3459 <xsl:call-template name="isoLanguage">
3460 <xsl:with-param name="currentLanguage">
3461 <xsl:value-of select="substring($remainingLanguages,1,3)"></xsl:value-of>
3463 <xsl:with-param name="usedLanguages">
3464 <xsl:value-of select="concat($usedLanguages,$currentLanguage)"></xsl:value-of>
3466 <xsl:with-param name="remainingLanguages">
3467 <xsl:value-of select="substring($remainingLanguages,4,string-length($remainingLanguages))"></xsl:value-of>
3469 </xsl:call-template>
3472 <xsl:call-template name="isoLanguage">
3473 <xsl:with-param name="currentLanguage">
3474 <xsl:value-of select="substring($remainingLanguages,1,3)"></xsl:value-of>
3476 <xsl:with-param name="usedLanguages">
3477 <xsl:value-of select="concat($usedLanguages,$currentLanguage)"></xsl:value-of>
3479 <xsl:with-param name="remainingLanguages">
3480 <xsl:value-of select="substring($remainingLanguages,4,string-length($remainingLanguages))"></xsl:value-of>
3482 </xsl:call-template>
3486 <xsl:template name="chopBrackets">
3487 <xsl:param name="chopString"></xsl:param>
3488 <xsl:variable name="string">
3489 <xsl:call-template name="chopPunctuation">
3490 <xsl:with-param name="chopString" select="$chopString"></xsl:with-param>
3491 </xsl:call-template>
3493 <xsl:if test="substring($string, 1,1)='['">
3494 <xsl:value-of select="substring($string,2, string-length($string)-2)"></xsl:value-of>
3496 <xsl:if test="substring($string, 1,1)!='['">
3497 <xsl:value-of select="$string"></xsl:value-of>
3500 <xsl:template name="rfcLanguages">
3501 <xsl:param name="nodeNum"></xsl:param>
3502 <xsl:param name="usedLanguages"></xsl:param>
3503 <xsl:param name="controlField008-35-37"></xsl:param>
3504 <xsl:variable name="currentLanguage" select="."></xsl:variable>
3506 <xsl:when test="not($currentLanguage)"></xsl:when>
3507 <xsl:when test="$currentLanguage!=$controlField008-35-37 and $currentLanguage!='rfc3066'">
3508 <xsl:if test="not(contains($usedLanguages,$currentLanguage))">
3510 <xsl:if test="@code!='a'">
3511 <xsl:attribute name="objectPart">
3513 <xsl:when test="@code='b'">summary or subtitle</xsl:when>
3514 <xsl:when test="@code='d'">sung or spoken text</xsl:when>
3515 <xsl:when test="@code='e'">libretto</xsl:when>
3516 <xsl:when test="@code='f'">table of contents</xsl:when>
3517 <xsl:when test="@code='g'">accompanying material</xsl:when>
3518 <xsl:when test="@code='h'">translation</xsl:when>
3522 <languageTerm authority="rfc3066" type="code">
3523 <xsl:value-of select="$currentLanguage"/>
3532 <xsl:template name="datafield">
3533 <xsl:param name="tag"/>
3534 <xsl:param name="ind1"><xsl:text> </xsl:text></xsl:param>
3535 <xsl:param name="ind2"><xsl:text> </xsl:text></xsl:param>
3536 <xsl:param name="subfields"/>
3537 <xsl:element name="marc:datafield">
3538 <xsl:attribute name="tag">
3539 <xsl:value-of select="$tag"/>
3541 <xsl:attribute name="ind1">
3542 <xsl:value-of select="$ind1"/>
3544 <xsl:attribute name="ind2">
3545 <xsl:value-of select="$ind2"/>
3547 <xsl:copy-of select="$subfields"/>
3551 <xsl:template name="subfieldSelect">
3552 <xsl:param name="codes"/>
3553 <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
3554 <xsl:variable name="str">
3555 <xsl:for-each select="marc:subfield">
3556 <xsl:if test="contains($codes, @code)">
3557 <xsl:value-of select="text()"/><xsl:value-of select="$delimeter"/>
3561 <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
3564 <xsl:template name="buildSpaces">
3565 <xsl:param name="spaces"/>
3566 <xsl:param name="char"><xsl:text> </xsl:text></xsl:param>
3567 <xsl:if test="$spaces>0">
3568 <xsl:value-of select="$char"/>
3569 <xsl:call-template name="buildSpaces">
3570 <xsl:with-param name="spaces" select="$spaces - 1"/>
3571 <xsl:with-param name="char" select="$char"/>
3572 </xsl:call-template>
3576 <xsl:template name="chopPunctuation">
3577 <xsl:param name="chopString"/>
3578 <xsl:param name="punctuation"><xsl:text>.:,;/ </xsl:text></xsl:param>
3579 <xsl:variable name="length" select="string-length($chopString)"/>
3581 <xsl:when test="$length=0"/>
3582 <xsl:when test="contains($punctuation, substring($chopString,$length,1))">
3583 <xsl:call-template name="chopPunctuation">
3584 <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
3585 <xsl:with-param name="punctuation" select="$punctuation"/>
3586 </xsl:call-template>
3588 <xsl:when test="not($chopString)"/>
3589 <xsl:otherwise><xsl:value-of select="$chopString"/></xsl:otherwise>
3593 <xsl:template name="chopPunctuationFront">
3594 <xsl:param name="chopString"/>
3595 <xsl:variable name="length" select="string-length($chopString)"/>
3597 <xsl:when test="$length=0"/>
3598 <xsl:when test="contains('.:,;/[ ', substring($chopString,1,1))">
3599 <xsl:call-template name="chopPunctuationFront">
3600 <xsl:with-param name="chopString" select="substring($chopString,2,$length - 1)"/>
3601 </xsl:call-template>
3603 <xsl:when test="not($chopString)"/>
3604 <xsl:otherwise><xsl:value-of select="$chopString"/></xsl:otherwise>
3607 </xsl:stylesheet>$$ WHERE name = 'mods32';
3610 -- 954.data.MODS33-xsl.sql
3611 UPDATE config.xml_transform SET xslt=$$<xsl:stylesheet xmlns="http://www.loc.gov/mods/v3" xmlns:marc="http://www.loc.gov/MARC21/slim"
3612 xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3613 exclude-result-prefixes="xlink marc" version="1.0">
3614 <xsl:output encoding="UTF-8" indent="yes" method="xml"/>
3616 <xsl:variable name="ascii">
3617 <xsl:text> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~</xsl:text>
3620 <xsl:variable name="latin1">
3621 <xsl:text> ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ</xsl:text>
3623 <!-- Characters that usually don't need to be escaped -->
3624 <xsl:variable name="safe">
3625 <xsl:text>!'()*-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~</xsl:text>
3628 <xsl:variable name="hex">0123456789ABCDEF</xsl:variable>
3630 <!-- Evergreen specific: revert Revision 1.23, so we can have those authority xlink attributes back. -->
3632 <!--MARC21slim2MODS3-3.xsl
3633 Revision 1.27 - Mapped 648 to <subject> 2009/03/13 tmee
3634 Revision 1.26 - Added subfield $s mapping for 130/240/730 2008/10/16 tmee
3635 Revision 1.25 - Mapped 040e to <descriptiveStandard> and Leader/18 to <descriptive standard>aacr2 2008/09/18 tmee
3636 Revision 1.24 - Mapped 852 subfields $h, $i, $j, $k, $l, $m, $t to <shelfLocation> and 852 subfield $u to <physicalLocation> with @xlink 2008/09/17 tmee
3637 Revision 1.23 - Commented out xlink/uri for subfield 0 for 130/240/730, 100/700, 110/710, 111/711 as these are currently unactionable 2008/09/17 tmee
3638 Revision 1.22 - Mapped 022 subfield $l to type "issn-l" subfield $m to output identifier element with corresponding @type and @invalid eq 'yes'2008/09/17 tmee
3639 Revision 1.21 - Mapped 856 ind2=1 or ind2=2 to <relatedItem><location><url> 2008/07/03 tmee
3640 Revision 1.20 - Added genre w/@auth="contents of 2" and type= "musical composition" 2008/07/01 tmee
3641 Revision 1.19 - Added genre offprint for 008/24+ BK code 2 2008/07/01 tmee
3642 Revision 1.18 - Added xlink/uri for subfield 0 for 130/240/730, 100/700, 110/710, 111/711 2008/06/26 tmee
3643 Revision 1.17 - Added mapping of 662 2008/05/14 tmee
3644 Revision 1.16 - Changed @authority from "marc" to "marcgt" for 007 and 008 codes mapped to a term in <genre> 2007/07/10 tmee
3645 Revision 1.15 - For field 630, moved call to part template outside title element 2007/07/10 tmee
3646 Revision 1.14 - Fixed template isValid and fields 010, 020, 022, 024, 028, and 037 to output additional identifier elements with corresponding @type and @invalid eq 'yes' when subfields z or y (in the case of 022) exist in the MARCXML ::: 2007/01/04 17:35:20 cred
3647 Revision 1.13 - Changed order of output under cartographics to reflect schema 2006/11/28 tmee
3648 Revision 1.12 - Updated to reflect MODS 3.2 Mapping 2006/10/11 tmee
3649 Revision 1.11 - The attribute objectPart moved from <languageTerm> to <language> 2006/04/08 jrad
3650 Revision 1.10 - MODS 3.1 revisions to language and classification elements (plus ability to find marc:collection embedded in wrapper elements such as SRU zs: wrappers) 2006/02/06 ggar
3651 Revision 1.9 - Subfield $y was added to field 242 2004/09/02 10:57 jrad
3652 Revision 1.8 - Subject chopPunctuation expanded and attribute fixes 2004/08/12 jrad
3653 Revision 1.7 - 2004/03/25 08:29 jrad
3654 Revision 1.6 - Various validation fixes 2004/02/20 ntra
3655 Revision 1.5 - MODS2 to MODS3 updates, language unstacking and de-duping, chopPunctuation expanded 2003/10/02 16:18:58 ntra
3656 Revision 1.3 - Additional Changes not related to MODS Version 2.0 by ntra
3657 Revision 1.2 - Added Log Comment 2003/03/24 19:37:42 ckeith
3659 <xsl:template match="/">
3661 <xsl:when test="//marc:collection">
3662 <modsCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3663 xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-2.xsd">
3664 <xsl:for-each select="//marc:collection/marc:record">
3665 <mods version="3.3">
3666 <xsl:call-template name="marcRecord"/>
3672 <mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.3"
3673 xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-2.xsd">
3674 <xsl:for-each select="//marc:record">
3675 <xsl:call-template name="marcRecord"/>
3681 <xsl:template name="marcRecord">
3682 <xsl:variable name="leader" select="marc:leader"/>
3683 <xsl:variable name="leader6" select="substring($leader,7,1)"/>
3684 <xsl:variable name="leader7" select="substring($leader,8,1)"/>
3685 <xsl:variable name="controlField008" select="marc:controlfield[@tag='008']"/>
3686 <xsl:variable name="typeOf008">
3688 <xsl:when test="$leader6='a'">
3691 test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
3692 <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">SE</xsl:when>
3695 <xsl:when test="$leader6='t'">BK</xsl:when>
3696 <xsl:when test="$leader6='p'">MM</xsl:when>
3697 <xsl:when test="$leader6='m'">CF</xsl:when>
3698 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
3699 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">VM</xsl:when>
3700 <xsl:when test="$leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'"
3704 <xsl:for-each select="marc:datafield[@tag='245']">
3706 <xsl:variable name="title">
3708 <xsl:when test="marc:subfield[@code='b']">
3709 <xsl:call-template name="specialSubfieldSelect">
3710 <xsl:with-param name="axis">b</xsl:with-param>
3711 <xsl:with-param name="beforeCodes">afgk</xsl:with-param>
3712 </xsl:call-template>
3715 <xsl:call-template name="subfieldSelect">
3716 <xsl:with-param name="codes">abfgk</xsl:with-param>
3717 </xsl:call-template>
3721 <xsl:variable name="titleChop">
3722 <xsl:call-template name="chopPunctuation">
3723 <xsl:with-param name="chopString">
3724 <xsl:value-of select="$title"/>
3726 </xsl:call-template>
3729 <xsl:when test="@ind2>0">
3731 <xsl:value-of select="substring($titleChop,1,@ind2)"/>
3734 <xsl:value-of select="substring($titleChop,@ind2+1)"/>
3739 <xsl:value-of select="$titleChop"/>
3743 <xsl:if test="marc:subfield[@code='b']">
3745 <xsl:call-template name="chopPunctuation">
3746 <xsl:with-param name="chopString">
3747 <xsl:call-template name="specialSubfieldSelect">
3748 <xsl:with-param name="axis">b</xsl:with-param>
3749 <xsl:with-param name="anyCodes">b</xsl:with-param>
3750 <xsl:with-param name="afterCodes">afgk</xsl:with-param>
3751 </xsl:call-template>
3753 </xsl:call-template>
3756 <xsl:call-template name="part"/>
3759 <xsl:for-each select="marc:datafield[@tag='210']">
3760 <titleInfo type="abbreviated">
3762 <xsl:call-template name="chopPunctuation">
3763 <xsl:with-param name="chopString">
3764 <xsl:call-template name="subfieldSelect">
3765 <xsl:with-param name="codes">a</xsl:with-param>
3766 </xsl:call-template>
3768 </xsl:call-template>
3770 <xsl:call-template name="subtitle"/>
3773 <xsl:for-each select="marc:datafield[@tag='242']">
3774 <titleInfo type="translated">
3775 <!--09/01/04 Added subfield $y-->
3776 <xsl:for-each select="marc:subfield[@code='y']">
3777 <xsl:attribute name="lang">
3778 <xsl:value-of select="text()"/>
3781 <xsl:for-each select="marc:subfield[@code='i']">
3782 <xsl:attribute name="displayLabel">
3783 <xsl:value-of select="text()"/>
3787 <xsl:call-template name="chopPunctuation">
3788 <xsl:with-param name="chopString">
3789 <xsl:call-template name="subfieldSelect">
3790 <!-- 1/04 removed $h, b -->
3791 <xsl:with-param name="codes">a</xsl:with-param>
3792 </xsl:call-template>
3794 </xsl:call-template>
3797 <xsl:call-template name="subtitle"/>
3798 <xsl:call-template name="part"/>
3801 <xsl:for-each select="marc:datafield[@tag='246']">
3802 <titleInfo type="alternative">
3803 <xsl:for-each select="marc:subfield[@code='i']">
3804 <xsl:attribute name="displayLabel">
3805 <xsl:value-of select="text()"/>
3809 <xsl:call-template name="chopPunctuation">
3810 <xsl:with-param name="chopString">
3811 <xsl:call-template name="subfieldSelect">
3812 <!-- 1/04 removed $h, $b -->
3813 <xsl:with-param name="codes">af</xsl:with-param>
3814 </xsl:call-template>
3816 </xsl:call-template>
3818 <xsl:call-template name="subtitle"/>
3819 <xsl:call-template name="part"/>
3823 select="marc:datafield[@tag='130']|marc:datafield[@tag='240']|marc:datafield[@tag='730'][@ind2!='2']">
3824 <titleInfo type="uniform">
3826 <xsl:call-template name="uri"/>
3828 <xsl:variable name="str">
3829 <xsl:for-each select="marc:subfield">
3831 test="(contains('adfklmors',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))">
3832 <xsl:value-of select="text()"/>
3833 <xsl:text> </xsl:text>
3837 <xsl:call-template name="chopPunctuation">
3838 <xsl:with-param name="chopString">
3839 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
3841 </xsl:call-template>
3843 <xsl:call-template name="part"/>
3846 <xsl:for-each select="marc:datafield[@tag='740'][@ind2!='2']">
3847 <titleInfo type="alternative">
3849 <xsl:call-template name="chopPunctuation">
3850 <xsl:with-param name="chopString">
3851 <xsl:call-template name="subfieldSelect">
3852 <xsl:with-param name="codes">ah</xsl:with-param>
3853 </xsl:call-template>
3855 </xsl:call-template>
3857 <xsl:call-template name="part"/>
3860 <xsl:for-each select="marc:datafield[@tag='100']">
3861 <name type="personal">
3863 <xsl:call-template name="uri"/>
3865 <xsl:call-template name="nameABCDQ"/>
3866 <xsl:call-template name="affiliation"/>
3868 <roleTerm authority="marcrelator" type="text">creator</roleTerm>
3870 <xsl:call-template name="role"/>
3873 <xsl:for-each select="marc:datafield[@tag='110']">
3874 <name type="corporate">
3876 <xsl:call-template name="uri"/>
3878 <xsl:call-template name="nameABCDN"/>
3880 <roleTerm authority="marcrelator" type="text">creator</roleTerm>
3882 <xsl:call-template name="role"/>
3885 <xsl:for-each select="marc:datafield[@tag='111']">
3886 <name type="conference">
3888 <xsl:call-template name="uri"/>
3890 <xsl:call-template name="nameACDEQ"/>
3892 <roleTerm authority="marcrelator" type="text">creator</roleTerm>
3894 <xsl:call-template name="role"/>
3897 <xsl:for-each select="marc:datafield[@tag='700'][not(marc:subfield[@code='t'])]">
3898 <name type="personal">
3900 <xsl:call-template name="uri"/>
3902 <xsl:call-template name="nameABCDQ"/>
3903 <xsl:call-template name="affiliation"/>
3904 <xsl:call-template name="role"/>
3907 <xsl:for-each select="marc:datafield[@tag='710'][not(marc:subfield[@code='t'])]">
3908 <name type="corporate">
3910 <xsl:call-template name="uri"/>
3912 <xsl:call-template name="nameABCDN"/>
3913 <xsl:call-template name="role"/>
3916 <xsl:for-each select="marc:datafield[@tag='711'][not(marc:subfield[@code='t'])]">
3917 <name type="conference">
3919 <xsl:call-template name="uri"/>
3921 <xsl:call-template name="nameACDEQ"/>
3922 <xsl:call-template name="role"/>
3925 <xsl:for-each select="marc:datafield[@tag='720'][not(marc:subfield[@code='t'])]">
3927 <xsl:if test="@ind1=1">
3928 <xsl:attribute name="type">
3929 <xsl:text>personal</xsl:text>
3933 <xsl:value-of select="marc:subfield[@code='a']"/>
3935 <xsl:call-template name="role"/>
3939 <xsl:if test="$leader7='c'">
3940 <xsl:attribute name="collection">yes</xsl:attribute>
3942 <xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'">
3943 <xsl:attribute name="manuscript">yes</xsl:attribute>
3946 <xsl:when test="$leader6='a' or $leader6='t'">text</xsl:when>
3947 <xsl:when test="$leader6='e' or $leader6='f'">cartographic</xsl:when>
3948 <xsl:when test="$leader6='c' or $leader6='d'">notated music</xsl:when>
3949 <xsl:when test="$leader6='i'">sound recording-nonmusical</xsl:when>
3950 <xsl:when test="$leader6='j'">sound recording-musical</xsl:when>
3951 <xsl:when test="$leader6='k'">still image</xsl:when>
3952 <xsl:when test="$leader6='g'">moving image</xsl:when>
3953 <xsl:when test="$leader6='r'">three dimensional object</xsl:when>
3954 <xsl:when test="$leader6='m'">software, multimedia</xsl:when>
3955 <xsl:when test="$leader6='p'">mixed material</xsl:when>
3958 <xsl:if test="substring($controlField008,26,1)='d'">
3959 <genre authority="marcgt">globe</genre>
3962 test="marc:controlfield[@tag='007'][substring(text(),1,1)='a'][substring(text(),2,1)='r']">
3963 <genre authority="marcgt">remote-sensing image</genre>
3965 <xsl:if test="$typeOf008='MP'">
3966 <xsl:variable name="controlField008-25" select="substring($controlField008,26,1)"/>
3969 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']">
3970 <genre authority="marcgt">map</genre>
3973 test="$controlField008-25='e' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']">
3974 <genre authority="marcgt">atlas</genre>
3978 <xsl:if test="$typeOf008='SE'">
3979 <xsl:variable name="controlField008-21" select="substring($controlField008,22,1)"/>
3981 <xsl:when test="$controlField008-21='d'">
3982 <genre authority="marcgt">database</genre>
3984 <xsl:when test="$controlField008-21='l'">
3985 <genre authority="marcgt">loose-leaf</genre>
3987 <xsl:when test="$controlField008-21='m'">
3988 <genre authority="marcgt">series</genre>
3990 <xsl:when test="$controlField008-21='n'">
3991 <genre authority="marcgt">newspaper</genre>
3993 <xsl:when test="$controlField008-21='p'">
3994 <genre authority="marcgt">periodical</genre>
3996 <xsl:when test="$controlField008-21='w'">
3997 <genre authority="marcgt">web site</genre>
4001 <xsl:if test="$typeOf008='BK' or $typeOf008='SE'">
4002 <xsl:variable name="controlField008-24" select="substring($controlField008,25,4)"/>
4004 <xsl:when test="contains($controlField008-24,'a')">
4005 <genre authority="marcgt">abstract or summary</genre>
4007 <xsl:when test="contains($controlField008-24,'b')">
4008 <genre authority="marcgt">bibliography</genre>
4010 <xsl:when test="contains($controlField008-24,'c')">
4011 <genre authority="marcgt">catalog</genre>
4013 <xsl:when test="contains($controlField008-24,'d')">
4014 <genre authority="marcgt">dictionary</genre>
4016 <xsl:when test="contains($controlField008-24,'e')">
4017 <genre authority="marcgt">encyclopedia</genre>
4019 <xsl:when test="contains($controlField008-24,'f')">
4020 <genre authority="marcgt">handbook</genre>
4022 <xsl:when test="contains($controlField008-24,'g')">
4023 <genre authority="marcgt">legal article</genre>
4025 <xsl:when test="contains($controlField008-24,'i')">
4026 <genre authority="marcgt">index</genre>
4028 <xsl:when test="contains($controlField008-24,'k')">
4029 <genre authority="marcgt">discography</genre>
4031 <xsl:when test="contains($controlField008-24,'l')">
4032 <genre authority="marcgt">legislation</genre>
4034 <xsl:when test="contains($controlField008-24,'m')">
4035 <genre authority="marcgt">theses</genre>
4037 <xsl:when test="contains($controlField008-24,'n')">
4038 <genre authority="marcgt">survey of literature</genre>
4040 <xsl:when test="contains($controlField008-24,'o')">
4041 <genre authority="marcgt">review</genre>
4043 <xsl:when test="contains($controlField008-24,'p')">
4044 <genre authority="marcgt">programmed text</genre>
4046 <xsl:when test="contains($controlField008-24,'q')">
4047 <genre authority="marcgt">filmography</genre>
4049 <xsl:when test="contains($controlField008-24,'r')">
4050 <genre authority="marcgt">directory</genre>
4052 <xsl:when test="contains($controlField008-24,'s')">
4053 <genre authority="marcgt">statistics</genre>
4055 <xsl:when test="contains($controlField008-24,'t')">
4056 <genre authority="marcgt">technical report</genre>
4058 <xsl:when test="contains($controlField008-24,'v')">
4059 <genre authority="marcgt">legal case and case notes</genre>
4061 <xsl:when test="contains($controlField008-24,'w')">
4062 <genre authority="marcgt">law report or digest</genre>
4064 <xsl:when test="contains($controlField008-24,'z')">
4065 <genre authority="marcgt">treaty</genre>
4068 <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/>
4070 <xsl:when test="$controlField008-29='1'">
4071 <genre authority="marcgt">conference publication</genre>
4075 <xsl:if test="$typeOf008='CF'">
4076 <xsl:variable name="controlField008-26" select="substring($controlField008,27,1)"/>
4078 <xsl:when test="$controlField008-26='a'">
4079 <genre authority="marcgt">numeric data</genre>
4081 <xsl:when test="$controlField008-26='e'">
4082 <genre authority="marcgt">database</genre>
4084 <xsl:when test="$controlField008-26='f'">
4085 <genre authority="marcgt">font</genre>
4087 <xsl:when test="$controlField008-26='g'">
4088 <genre authority="marcgt">game</genre>
4092 <xsl:if test="$typeOf008='BK'">
4093 <xsl:if test="substring($controlField008,25,1)='j'">
4094 <genre authority="marcgt">patent</genre>
4096 <xsl:if test="substring($controlField008,25,1)='2'">
4097 <genre authority="marcgt">offprint</genre>
4099 <xsl:if test="substring($controlField008,31,1)='1'">
4100 <genre authority="marcgt">festschrift</genre>
4102 <xsl:variable name="controlField008-34" select="substring($controlField008,35,1)"/>
4104 test="$controlField008-34='a' or $controlField008-34='b' or $controlField008-34='c' or $controlField008-34='d'">
4105 <genre authority="marcgt">biography</genre>
4107 <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/>
4109 <xsl:when test="$controlField008-33='e'">
4110 <genre authority="marcgt">essay</genre>
4112 <xsl:when test="$controlField008-33='d'">
4113 <genre authority="marcgt">drama</genre>
4115 <xsl:when test="$controlField008-33='c'">
4116 <genre authority="marcgt">comic strip</genre>
4118 <xsl:when test="$controlField008-33='l'">
4119 <genre authority="marcgt">fiction</genre>
4121 <xsl:when test="$controlField008-33='h'">
4122 <genre authority="marcgt">humor, satire</genre>
4124 <xsl:when test="$controlField008-33='i'">
4125 <genre authority="marcgt">letter</genre>
4127 <xsl:when test="$controlField008-33='f'">
4128 <genre authority="marcgt">novel</genre>
4130 <xsl:when test="$controlField008-33='j'">
4131 <genre authority="marcgt">short story</genre>
4133 <xsl:when test="$controlField008-33='s'">
4134 <genre authority="marcgt">speech</genre>
4138 <xsl:if test="$typeOf008='MU'">
4139 <xsl:variable name="controlField008-30-31" select="substring($controlField008,31,2)"/>
4140 <xsl:if test="contains($controlField008-30-31,'b')">
4141 <genre authority="marcgt">biography</genre>
4143 <xsl:if test="contains($controlField008-30-31,'c')">
4144 <genre authority="marcgt">conference publication</genre>
4146 <xsl:if test="contains($controlField008-30-31,'d')">
4147 <genre authority="marcgt">drama</genre>
4149 <xsl:if test="contains($controlField008-30-31,'e')">
4150 <genre authority="marcgt">essay</genre>
4152 <xsl:if test="contains($controlField008-30-31,'f')">
4153 <genre authority="marcgt">fiction</genre>
4155 <xsl:if test="contains($controlField008-30-31,'o')">
4156 <genre authority="marcgt">folktale</genre>
4158 <xsl:if test="contains($controlField008-30-31,'h')">
4159 <genre authority="marcgt">history</genre>
4161 <xsl:if test="contains($controlField008-30-31,'k')">
4162 <genre authority="marcgt">humor, satire</genre>
4164 <xsl:if test="contains($controlField008-30-31,'m')">
4165 <genre authority="marcgt">memoir</genre>
4167 <xsl:if test="contains($controlField008-30-31,'p')">
4168 <genre authority="marcgt">poetry</genre>
4170 <xsl:if test="contains($controlField008-30-31,'r')">
4171 <genre authority="marcgt">rehearsal</genre>
4173 <xsl:if test="contains($controlField008-30-31,'g')">
4174 <genre authority="marcgt">reporting</genre>
4176 <xsl:if test="contains($controlField008-30-31,'s')">
4177 <genre authority="marcgt">sound</genre>
4179 <xsl:if test="contains($controlField008-30-31,'l')">
4180 <genre authority="marcgt">speech</genre>
4183 <xsl:if test="$typeOf008='VM'">
4184 <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/>
4186 <xsl:when test="$controlField008-33='a'">
4187 <genre authority="marcgt">art original</genre>
4189 <xsl:when test="$controlField008-33='b'">
4190 <genre authority="marcgt">kit</genre>
4192 <xsl:when test="$controlField008-33='c'">
4193 <genre authority="marcgt">art reproduction</genre>
4195 <xsl:when test="$controlField008-33='d'">
4196 <genre authority="marcgt">diorama</genre>
4198 <xsl:when test="$controlField008-33='f'">
4199 <genre authority="marcgt">filmstrip</genre>
4201 <xsl:when test="$controlField008-33='g'">
4202 <genre authority="marcgt">legal article</genre>
4204 <xsl:when test="$controlField008-33='i'">
4205 <genre authority="marcgt">picture</genre>
4207 <xsl:when test="$controlField008-33='k'">
4208 <genre authority="marcgt">graphic</genre>
4210 <xsl:when test="$controlField008-33='l'">
4211 <genre authority="marcgt">technical drawing</genre>
4213 <xsl:when test="$controlField008-33='m'">
4214 <genre authority="marcgt">motion picture</genre>
4216 <xsl:when test="$controlField008-33='n'">
4217 <genre authority="marcgt">chart</genre>
4219 <xsl:when test="$controlField008-33='o'">
4220 <genre authority="marcgt">flash card</genre>
4222 <xsl:when test="$controlField008-33='p'">
4223 <genre authority="marcgt">microscope slide</genre>
4226 test="$controlField008-33='q' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']">
4227 <genre authority="marcgt">model</genre>
4229 <xsl:when test="$controlField008-33='r'">
4230 <genre authority="marcgt">realia</genre>
4232 <xsl:when test="$controlField008-33='s'">
4233 <genre authority="marcgt">slide</genre>
4235 <xsl:when test="$controlField008-33='t'">
4236 <genre authority="marcgt">transparency</genre>
4238 <xsl:when test="$controlField008-33='v'">
4239 <genre authority="marcgt">videorecording</genre>
4241 <xsl:when test="$controlField008-33='w'">
4242 <genre authority="marcgt">toy</genre>
4247 <!-- 1.20 047 genre tmee-->
4249 <xsl:for-each select="marc:datafield[@tag=047]">
4250 <genre authority="marcgt">
4251 <xsl:attribute name="authority">
4252 <xsl:value-of select="marc:subfield[@code='2']"/>
4254 <xsl:call-template name="subfieldSelect">
4255 <xsl:with-param name="codes">abcdef</xsl:with-param>
4256 <xsl:with-param name="delimeter">-</xsl:with-param>
4257 </xsl:call-template>
4260 <xsl:for-each select="marc:datafield[@tag=655]">
4261 <genre authority="marcgt">
4262 <xsl:attribute name="authority">
4263 <xsl:value-of select="marc:subfield[@code='2']"/>
4265 <xsl:call-template name="subfieldSelect">
4266 <xsl:with-param name="codes">abvxyz</xsl:with-param>
4267 <xsl:with-param name="delimeter">-</xsl:with-param>
4268 </xsl:call-template>
4272 <xsl:variable name="MARCpublicationCode"
4273 select="normalize-space(substring($controlField008,16,3))"/>
4274 <xsl:if test="translate($MARCpublicationCode,'|','')">
4277 <xsl:attribute name="type">code</xsl:attribute>
4278 <xsl:attribute name="authority">marccountry</xsl:attribute>
4279 <xsl:value-of select="$MARCpublicationCode"/>
4283 <xsl:for-each select="marc:datafield[@tag=044]/marc:subfield[@code='c']">
4286 <xsl:attribute name="type">code</xsl:attribute>
4287 <xsl:attribute name="authority">iso3166</xsl:attribute>
4288 <xsl:value-of select="."/>
4292 <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='a']">
4295 <xsl:attribute name="type">text</xsl:attribute>
4296 <xsl:call-template name="chopPunctuationFront">
4297 <xsl:with-param name="chopString">
4298 <xsl:call-template name="chopPunctuation">
4299 <xsl:with-param name="chopString" select="."/>
4300 </xsl:call-template>
4302 </xsl:call-template>
4306 <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='m']">
4307 <dateValid point="start">
4308 <xsl:value-of select="."/>
4311 <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='n']">
4312 <dateValid point="end">
4313 <xsl:value-of select="."/>
4316 <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='j']">
4318 <xsl:value-of select="."/>
4322 select="marc:datafield[@tag=260]/marc:subfield[@code='b' or @code='c' or @code='g']">
4324 <xsl:when test="@code='b'">
4326 <xsl:call-template name="chopPunctuation">
4327 <xsl:with-param name="chopString" select="."/>
4328 <xsl:with-param name="punctuation">
4329 <xsl:text>:,;/ </xsl:text>
4331 </xsl:call-template>
4334 <xsl:when test="@code='c'">
4336 <xsl:call-template name="chopPunctuation">
4337 <xsl:with-param name="chopString" select="."/>
4338 </xsl:call-template>
4341 <xsl:when test="@code='g'">
4343 <xsl:value-of select="."/>
4348 <xsl:variable name="dataField260c">
4349 <xsl:call-template name="chopPunctuation">
4350 <xsl:with-param name="chopString"
4351 select="marc:datafield[@tag=260]/marc:subfield[@code='c']"/>
4352 </xsl:call-template>
4354 <xsl:variable name="controlField008-7-10"
4355 select="normalize-space(substring($controlField008, 8, 4))"/>
4356 <xsl:variable name="controlField008-11-14"
4357 select="normalize-space(substring($controlField008, 12, 4))"/>
4358 <xsl:variable name="controlField008-6"
4359 select="normalize-space(substring($controlField008, 7, 1))"/>
4361 test="$controlField008-6='e' or $controlField008-6='p' or $controlField008-6='r' or $controlField008-6='t' or $controlField008-6='s'">
4362 <xsl:if test="$controlField008-7-10 and ($controlField008-7-10 != $dataField260c)">
4363 <dateIssued encoding="marc">
4364 <xsl:value-of select="$controlField008-7-10"/>
4369 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'">
4370 <xsl:if test="$controlField008-7-10">
4371 <dateIssued encoding="marc" point="start">
4372 <xsl:value-of select="$controlField008-7-10"/>
4377 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'">
4378 <xsl:if test="$controlField008-11-14">
4379 <dateIssued encoding="marc" point="end">
4380 <xsl:value-of select="$controlField008-11-14"/>
4384 <xsl:if test="$controlField008-6='q'">
4385 <xsl:if test="$controlField008-7-10">
4386 <dateIssued encoding="marc" point="start" qualifier="questionable">
4387 <xsl:value-of select="$controlField008-7-10"/>
4391 <xsl:if test="$controlField008-6='q'">
4392 <xsl:if test="$controlField008-11-14">
4393 <dateIssued encoding="marc" point="end" qualifier="questionable">
4394 <xsl:value-of select="$controlField008-11-14"/>
4398 <xsl:if test="$controlField008-6='t'">
4399 <xsl:if test="$controlField008-11-14">
4400 <copyrightDate encoding="marc">
4401 <xsl:value-of select="$controlField008-11-14"/>
4406 select="marc:datafield[@tag=033][@ind1=0 or @ind1=1]/marc:subfield[@code='a']">
4407 <dateCaptured encoding="iso8601">
4408 <xsl:value-of select="."/>
4411 <xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][1]">
4412 <dateCaptured encoding="iso8601" point="start">
4413 <xsl:value-of select="."/>
4416 <xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][2]">
4417 <dateCaptured encoding="iso8601" point="end">
4418 <xsl:value-of select="."/>
4421 <xsl:for-each select="marc:datafield[@tag=250]/marc:subfield[@code='a']">
4423 <xsl:value-of select="."/>
4426 <xsl:for-each select="marc:leader">
4430 test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'"
4431 >monographic</xsl:when>
4432 <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'"
4433 >continuing</xsl:when>
4437 <xsl:for-each select="marc:datafield[@tag=310]|marc:datafield[@tag=321]">
4439 <xsl:call-template name="subfieldSelect">
4440 <xsl:with-param name="codes">ab</xsl:with-param>
4441 </xsl:call-template>
4445 <xsl:variable name="controlField008-35-37"
4446 select="normalize-space(translate(substring($controlField008,36,3),'|#',''))"/>
4447 <xsl:if test="$controlField008-35-37">
4449 <languageTerm authority="iso639-2b" type="code">
4450 <xsl:value-of select="substring($controlField008,36,3)"/>
4454 <xsl:for-each select="marc:datafield[@tag=041]">
4456 select="marc:subfield[@code='a' or @code='b' or @code='d' or @code='e' or @code='f' or @code='g' or @code='h']">
4457 <xsl:variable name="langCodes" select="."/>
4459 <xsl:when test="../marc:subfield[@code='2']='rfc3066'">
4460 <!-- not stacked but could be repeated -->
4461 <xsl:call-template name="rfcLanguages">
4462 <xsl:with-param name="nodeNum">
4463 <xsl:value-of select="1"/>
4465 <xsl:with-param name="usedLanguages">
4468 <xsl:with-param name="controlField008-35-37">
4469 <xsl:value-of select="$controlField008-35-37"/>
4471 </xsl:call-template>
4475 <xsl:variable name="allLanguages">
4476 <xsl:copy-of select="$langCodes"/>
4478 <xsl:variable name="currentLanguage">
4479 <xsl:value-of select="substring($allLanguages,1,3)"/>
4481 <xsl:call-template name="isoLanguage">
4482 <xsl:with-param name="currentLanguage">
4483 <xsl:value-of select="substring($allLanguages,1,3)"/>
4485 <xsl:with-param name="remainingLanguages">
4487 select="substring($allLanguages,4,string-length($allLanguages)-3)"
4490 <xsl:with-param name="usedLanguages">
4491 <xsl:if test="$controlField008-35-37">
4492 <xsl:value-of select="$controlField008-35-37"/>
4495 </xsl:call-template>
4500 <xsl:variable name="physicalDescription">
4501 <!--3.2 change tmee 007/11 -->
4502 <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='a']">
4503 <digitalOrigin>reformatted digital</digitalOrigin>
4505 <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='b']">
4506 <digitalOrigin>digitized microfilm</digitalOrigin>
4508 <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='d']">
4509 <digitalOrigin>digitized other analog</digitalOrigin>
4511 <xsl:variable name="controlField008-23" select="substring($controlField008,24,1)"/>
4512 <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/>
4513 <xsl:variable name="check008-23">
4515 test="$typeOf008='BK' or $typeOf008='MU' or $typeOf008='SE' or $typeOf008='MM'">
4516 <xsl:value-of select="true()"/>
4519 <xsl:variable name="check008-29">
4520 <xsl:if test="$typeOf008='MP' or $typeOf008='VM'">
4521 <xsl:value-of select="true()"/>
4526 test="($check008-23 and $controlField008-23='f') or ($check008-29 and $controlField008-29='f')">
4527 <form authority="marcform">braille</form>
4530 test="($controlField008-23=' ' and ($leader6='c' or $leader6='d')) or (($typeOf008='BK' or $typeOf008='SE') and ($controlField008-23=' ' or $controlField008='r'))">
4531 <form authority="marcform">print</form>
4534 test="$leader6 = 'm' or ($check008-23 and $controlField008-23='s') or ($check008-29 and $controlField008-29='s')">
4535 <form authority="marcform">electronic</form>
4538 test="($check008-23 and $controlField008-23='b') or ($check008-29 and $controlField008-29='b')">
4539 <form authority="marcform">microfiche</form>
4542 test="($check008-23 and $controlField008-23='a') or ($check008-29 and $controlField008-29='a')">
4543 <form authority="marcform">microfilm</form>
4547 <xsl:if test="marc:datafield[@tag=130]/marc:subfield[@code='h']">
4548 <form authority="gmd">
4549 <xsl:call-template name="chopBrackets">
4550 <xsl:with-param name="chopString">
4551 <xsl:value-of select="marc:datafield[@tag=130]/marc:subfield[@code='h']"
4554 </xsl:call-template>
4557 <xsl:if test="marc:datafield[@tag=240]/marc:subfield[@code='h']">
4558 <form authority="gmd">
4559 <xsl:call-template name="chopBrackets">
4560 <xsl:with-param name="chopString">
4561 <xsl:value-of select="marc:datafield[@tag=240]/marc:subfield[@code='h']"
4564 </xsl:call-template>
4567 <xsl:if test="marc:datafield[@tag=242]/marc:subfield[@code='h']">
4568 <form authority="gmd">
4569 <xsl:call-template name="chopBrackets">
4570 <xsl:with-param name="chopString">
4571 <xsl:value-of select="marc:datafield[@tag=242]/marc:subfield[@code='h']"
4574 </xsl:call-template>
4577 <xsl:if test="marc:datafield[@tag=245]/marc:subfield[@code='h']">
4578 <form authority="gmd">
4579 <xsl:call-template name="chopBrackets">
4580 <xsl:with-param name="chopString">
4581 <xsl:value-of select="marc:datafield[@tag=245]/marc:subfield[@code='h']"
4584 </xsl:call-template>
4587 <xsl:if test="marc:datafield[@tag=246]/marc:subfield[@code='h']">
4588 <form authority="gmd">
4589 <xsl:call-template name="chopBrackets">
4590 <xsl:with-param name="chopString">
4591 <xsl:value-of select="marc:datafield[@tag=246]/marc:subfield[@code='h']"
4594 </xsl:call-template>
4597 <xsl:if test="marc:datafield[@tag=730]/marc:subfield[@code='h']">
4598 <form authority="gmd">
4599 <xsl:call-template name="chopBrackets">
4600 <xsl:with-param name="chopString">
4601 <xsl:value-of select="marc:datafield[@tag=730]/marc:subfield[@code='h']"
4604 </xsl:call-template>
4607 <xsl:for-each select="marc:datafield[@tag=256]/marc:subfield[@code='a']">
4609 <xsl:value-of select="."/>
4612 <xsl:for-each select="marc:controlfield[@tag=007][substring(text(),1,1)='c']">
4614 <xsl:when test="substring(text(),14,1)='a'">
4615 <reformattingQuality>access</reformattingQuality>
4617 <xsl:when test="substring(text(),14,1)='p'">
4618 <reformattingQuality>preservation</reformattingQuality>
4620 <xsl:when test="substring(text(),14,1)='r'">
4621 <reformattingQuality>replacement</reformattingQuality>
4625 <!--3.2 change tmee 007/01 -->
4627 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='b']">
4628 <form authority="smd">chip cartridge</form>
4631 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='c']">
4632 <form authority="smd">computer optical disc cartridge</form>
4635 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='j']">
4636 <form authority="smd">magnetic disc</form>
4639 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='m']">
4640 <form authority="smd">magneto-optical disc</form>
4643 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='o']">
4644 <form authority="smd">optical disc</form>
4647 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='r']">
4648 <form authority="smd">remote</form>
4651 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='a']">
4652 <form authority="smd">tape cartridge</form>
4655 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='f']">
4656 <form authority="smd">tape cassette</form>
4659 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='h']">
4660 <form authority="smd">tape reel</form>
4664 test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='a']">
4665 <form authority="smd">celestial globe</form>
4668 test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='e']">
4669 <form authority="smd">earth moon globe</form>
4672 test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='b']">
4673 <form authority="smd">planetary or lunar globe</form>
4676 test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='c']">
4677 <form authority="smd">terrestrial globe</form>
4681 test="marc:controlfield[@tag=007][substring(text(),1,1)='o'][substring(text(),2,1)='o']">
4682 <form authority="smd">kit</form>
4686 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']">
4687 <form authority="smd">atlas</form>
4690 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='g']">
4691 <form authority="smd">diagram</form>
4694 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='j']">
4695 <form authority="smd">map</form>
4698 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']">
4699 <form authority="smd">model</form>
4702 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='k']">
4703 <form authority="smd">profile</form>
4706 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='r']">
4707 <form authority="smd">remote-sensing image</form>
4710 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='s']">
4711 <form authority="smd">section</form>
4714 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='y']">
4715 <form authority="smd">view</form>
4719 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='a']">
4720 <form authority="smd">aperture card</form>
4723 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='e']">
4724 <form authority="smd">microfiche</form>
4727 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='f']">
4728 <form authority="smd">microfiche cassette</form>
4731 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='b']">
4732 <form authority="smd">microfilm cartridge</form>
4735 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='c']">
4736 <form authority="smd">microfilm cassette</form>
4739 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='d']">
4740 <form authority="smd">microfilm reel</form>
4743 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='g']">
4744 <form authority="smd">microopaque</form>
4748 test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='c']">
4749 <form authority="smd">film cartridge</form>
4752 test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='f']">
4753 <form authority="smd">film cassette</form>
4756 test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='r']">
4757 <form authority="smd">film reel</form>
4761 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='n']">
4762 <form authority="smd">chart</form>
4765 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='c']">
4766 <form authority="smd">collage</form>
4769 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='d']">
4770 <form authority="smd">drawing</form>
4773 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='o']">
4774 <form authority="smd">flash card</form>
4777 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='e']">
4778 <form authority="smd">painting</form>
4781 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='f']">
4782 <form authority="smd">photomechanical print</form>
4785 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='g']">
4786 <form authority="smd">photonegative</form>
4789 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='h']">
4790 <form authority="smd">photoprint</form>
4793 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='i']">
4794 <form authority="smd">picture</form>
4797 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='j']">
4798 <form authority="smd">print</form>
4801 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='l']">
4802 <form authority="smd">technical drawing</form>
4806 test="marc:controlfield[@tag=007][substring(text(),1,1)='q'][substring(text(),2,1)='q']">
4807 <form authority="smd">notated music</form>
4811 test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='d']">
4812 <form authority="smd">filmslip</form>
4815 test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='c']">
4816 <form authority="smd">filmstrip cartridge</form>
4819 test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='o']">
4820 <form authority="smd">filmstrip roll</form>
4823 test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='f']">
4824 <form authority="smd">other filmstrip type</form>
4827 test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='s']">
4828 <form authority="smd">slide</form>
4831 test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='t']">
4832 <form authority="smd">transparency</form>
4835 test="marc:controlfield[@tag=007][substring(text(),1,1)='r'][substring(text(),2,1)='r']">
4836 <form authority="smd">remote-sensing image</form>
4839 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='e']">
4840 <form authority="smd">cylinder</form>
4843 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='q']">
4844 <form authority="smd">roll</form>
4847 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='g']">
4848 <form authority="smd">sound cartridge</form>
4851 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='s']">
4852 <form authority="smd">sound cassette</form>
4855 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='d']">
4856 <form authority="smd">sound disc</form>
4859 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='t']">
4860 <form authority="smd">sound-tape reel</form>
4863 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='i']">
4864 <form authority="smd">sound-track film</form>
4867 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='w']">
4868 <form authority="smd">wire recording</form>
4872 test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='c']">
4873 <form authority="smd">braille</form>
4876 test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='b']">
4877 <form authority="smd">combination</form>
4880 test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='a']">
4881 <form authority="smd">moon</form>
4884 test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='d']">
4885 <form authority="smd">tactile, with no writing system</form>
4889 test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='c']">
4890 <form authority="smd">braille</form>
4893 test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='b']">
4894 <form authority="smd">large print</form>
4897 test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='a']">
4898 <form authority="smd">regular print</form>
4901 test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='d']">
4902 <form authority="smd">text in looseleaf binder</form>
4906 test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='c']">
4907 <form authority="smd">videocartridge</form>
4910 test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='f']">
4911 <form authority="smd">videocassette</form>
4914 test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='d']">
4915 <form authority="smd">videodisc</form>
4918 test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='r']">
4919 <form authority="smd">videoreel</form>
4923 select="marc:datafield[@tag=856]/marc:subfield[@code='q'][string-length(.)>1]">
4925 <xsl:value-of select="."/>
4926 </internetMediaType>
4928 <xsl:for-each select="marc:datafield[@tag=300]">
4930 <xsl:call-template name="subfieldSelect">
4931 <xsl:with-param name="codes">abce</xsl:with-param>
4932 </xsl:call-template>
4936 <xsl:if test="string-length(normalize-space($physicalDescription))">
4937 <physicalDescription>
4938 <xsl:copy-of select="$physicalDescription"/>
4939 </physicalDescription>
4941 <xsl:for-each select="marc:datafield[@tag=520]">
4943 <xsl:call-template name="uri"/>
4944 <xsl:call-template name="subfieldSelect">
4945 <xsl:with-param name="codes">ab</xsl:with-param>
4946 </xsl:call-template>
4949 <xsl:for-each select="marc:datafield[@tag=505]">
4951 <xsl:call-template name="uri"/>
4952 <xsl:call-template name="subfieldSelect">
4953 <xsl:with-param name="codes">agrt</xsl:with-param>
4954 </xsl:call-template>
4957 <xsl:for-each select="marc:datafield[@tag=521]">
4959 <xsl:call-template name="subfieldSelect">
4960 <xsl:with-param name="codes">ab</xsl:with-param>
4961 </xsl:call-template>
4964 <xsl:if test="$typeOf008='BK' or $typeOf008='CF' or $typeOf008='MU' or $typeOf008='VM'">
4965 <xsl:variable name="controlField008-22" select="substring($controlField008,23,1)"/>
4968 <xsl:when test="$controlField008-22='d'">
4969 <targetAudience authority="marctarget">adolescent</targetAudience>
4971 <xsl:when test="$controlField008-22='e'">
4972 <targetAudience authority="marctarget">adult</targetAudience>
4974 <xsl:when test="$controlField008-22='g'">
4975 <targetAudience authority="marctarget">general</targetAudience>
4978 test="$controlField008-22='b' or $controlField008-22='c' or $controlField008-22='j'">
4979 <targetAudience authority="marctarget">juvenile</targetAudience>
4981 <xsl:when test="$controlField008-22='a'">
4982 <targetAudience authority="marctarget">preschool</targetAudience>
4984 <xsl:when test="$controlField008-22='f'">
4985 <targetAudience authority="marctarget">specialized</targetAudience>
4989 <xsl:for-each select="marc:datafield[@tag=245]/marc:subfield[@code='c']">
4990 <note type="statement of responsibility">
4991 <xsl:value-of select="."/>
4994 <xsl:for-each select="marc:datafield[@tag=500]">
4996 <xsl:value-of select="marc:subfield[@code='a']"/>
4997 <xsl:call-template name="uri"/>
5001 <!--3.2 change tmee additional note fields-->
5003 <xsl:for-each select="marc:datafield[@tag=506]">
5004 <note type="restrictions">
5005 <xsl:call-template name="uri"/>
5006 <xsl:variable name="str">
5007 <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
5008 <xsl:value-of select="."/>
5009 <xsl:text> </xsl:text>
5012 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
5016 <xsl:for-each select="marc:datafield[@tag=510]">
5017 <note type="citation/reference">
5018 <xsl:call-template name="uri"/>
5019 <xsl:variable name="str">
5020 <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
5021 <xsl:value-of select="."/>
5022 <xsl:text> </xsl:text>
5025 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
5030 <xsl:for-each select="marc:datafield[@tag=511]">
5031 <note type="performers">
5032 <xsl:call-template name="uri"/>
5033 <xsl:value-of select="marc:subfield[@code='a']"/>
5036 <xsl:for-each select="marc:datafield[@tag=518]">
5038 <xsl:call-template name="uri"/>
5039 <xsl:value-of select="marc:subfield[@code='a']"/>
5043 <xsl:for-each select="marc:datafield[@tag=530]">
5044 <note type="additional physical form">
5045 <xsl:call-template name="uri"/>
5046 <xsl:variable name="str">
5047 <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
5048 <xsl:value-of select="."/>
5049 <xsl:text> </xsl:text>
5052 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
5056 <xsl:for-each select="marc:datafield[@tag=533]">
5057 <note type="reproduction">
5058 <xsl:call-template name="uri"/>
5059 <xsl:variable name="str">
5060 <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
5061 <xsl:value-of select="."/>
5062 <xsl:text> </xsl:text>
5065 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
5069 <xsl:for-each select="marc:datafield[@tag=534]">
5070 <note type="original version">
5071 <xsl:call-template name="uri"/>
5072 <xsl:variable name="str">
5073 <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
5074 <xsl:value-of select="."/>
5075 <xsl:text> </xsl:text>
5078 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
5082 <xsl:for-each select="marc:datafield[@tag=538]">
5083 <note type="system details">
5084 <xsl:call-template name="uri"/>
5085 <xsl:variable name="str">
5086 <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
5087 <xsl:value-of select="."/>
5088 <xsl:text> </xsl:text>
5091 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
5095 <xsl:for-each select="marc:datafield[@tag=583]">
5096 <note type="action">
5097 <xsl:call-template name="uri"/>
5098 <xsl:variable name="str">
5099 <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
5100 <xsl:value-of select="."/>
5101 <xsl:text> </xsl:text>
5104 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
5109 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]">
5111 <xsl:call-template name="uri"/>
5112 <xsl:variable name="str">
5113 <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
5114 <xsl:value-of select="."/>
5115 <xsl:text> </xsl:text>
5118 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
5122 select="marc:datafield[@tag=034][marc:subfield[@code='d' or @code='e' or @code='f' or @code='g']]">
5126 <xsl:call-template name="subfieldSelect">
5127 <xsl:with-param name="codes">defg</xsl:with-param>
5128 </xsl:call-template>
5133 <xsl:for-each select="marc:datafield[@tag=043]">
5135 <xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']">
5137 <xsl:attribute name="authority">
5138 <xsl:if test="@code='a'">
5139 <xsl:text>marcgac</xsl:text>
5141 <xsl:if test="@code='b'">
5142 <xsl:value-of select="following-sibling::marc:subfield[@code=2]"/>
5144 <xsl:if test="@code='c'">
5145 <xsl:text>iso3166</xsl:text>
5148 <xsl:value-of select="self::marc:subfield"/>
5153 <!-- tmee 2006/11/27 -->
5154 <xsl:for-each select="marc:datafield[@tag=255]">
5156 <xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']">
5158 <xsl:if test="@code='a'">
5160 <xsl:value-of select="."/>
5163 <xsl:if test="@code='b'">
5165 <xsl:value-of select="."/>
5168 <xsl:if test="@code='c'">
5170 <xsl:value-of select="."/>
5178 <xsl:apply-templates select="marc:datafield[653 >= @tag and @tag >= 600]"/>
5179 <xsl:apply-templates select="marc:datafield[@tag=656]"/>
5180 <xsl:for-each select="marc:datafield[@tag=752 or @tag=662]">
5182 <hierarchicalGeographic>
5183 <xsl:for-each select="marc:subfield[@code='a']">
5185 <xsl:call-template name="chopPunctuation">
5186 <xsl:with-param name="chopString" select="."/>
5187 </xsl:call-template>
5190 <xsl:for-each select="marc:subfield[@code='b']">
5192 <xsl:call-template name="chopPunctuation">
5193 <xsl:with-param name="chopString" select="."/>
5194 </xsl:call-template>
5197 <xsl:for-each select="marc:subfield[@code='c']">
5199 <xsl:call-template name="chopPunctuation">
5200 <xsl:with-param name="chopString" select="."/>
5201 </xsl:call-template>
5204 <xsl:for-each select="marc:subfield[@code='d']">
5206 <xsl:call-template name="chopPunctuation">
5207 <xsl:with-param name="chopString" select="."/>
5208 </xsl:call-template>
5211 <xsl:for-each select="marc:subfield[@code='e']">
5213 <xsl:call-template name="chopPunctuation">
5214 <xsl:with-param name="chopString" select="."/>
5215 </xsl:call-template>
5218 <xsl:for-each select="marc:subfield[@code='g']">
5220 <xsl:call-template name="chopPunctuation">
5221 <xsl:with-param name="chopString" select="."/>
5222 </xsl:call-template>
5225 <xsl:for-each select="marc:subfield[@code='h']">
5226 <extraterrestrialArea>
5227 <xsl:call-template name="chopPunctuation">
5228 <xsl:with-param name="chopString" select="."/>
5229 </xsl:call-template>
5230 </extraterrestrialArea>
5232 </hierarchicalGeographic>
5235 <xsl:for-each select="marc:datafield[@tag=045][marc:subfield[@code='b']]">
5238 <xsl:when test="@ind1=2">
5239 <temporal encoding="iso8601" point="start">
5240 <xsl:call-template name="chopPunctuation">
5241 <xsl:with-param name="chopString">
5242 <xsl:value-of select="marc:subfield[@code='b'][1]"/>
5244 </xsl:call-template>
5246 <temporal encoding="iso8601" point="end">
5247 <xsl:call-template name="chopPunctuation">
5248 <xsl:with-param name="chopString">
5249 <xsl:value-of select="marc:subfield[@code='b'][2]"/>
5251 </xsl:call-template>
5255 <xsl:for-each select="marc:subfield[@code='b']">
5256 <temporal encoding="iso8601">
5257 <xsl:call-template name="chopPunctuation">
5258 <xsl:with-param name="chopString" select="."/>
5259 </xsl:call-template>
5266 <xsl:for-each select="marc:datafield[@tag=050]">
5267 <xsl:for-each select="marc:subfield[@code='b']">
5268 <classification authority="lcc">
5269 <xsl:if test="../marc:subfield[@code='3']">
5270 <xsl:attribute name="displayLabel">
5271 <xsl:value-of select="../marc:subfield[@code='3']"/>
5274 <xsl:value-of select="preceding-sibling::marc:subfield[@code='a'][1]"/>
5275 <xsl:text> </xsl:text>
5276 <xsl:value-of select="text()"/>
5280 select="marc:subfield[@code='a'][not(following-sibling::marc:subfield[@code='b'])]">
5281 <classification authority="lcc">
5282 <xsl:if test="../marc:subfield[@code='3']">
5283 <xsl:attribute name="displayLabel">
5284 <xsl:value-of select="../marc:subfield[@code='3']"/>
5287 <xsl:value-of select="text()"/>
5291 <xsl:for-each select="marc:datafield[@tag=082]">
5292 <classification authority="ddc">
5293 <xsl:if test="marc:subfield[@code='2']">
5294 <xsl:attribute name="edition">
5295 <xsl:value-of select="marc:subfield[@code='2']"/>
5298 <xsl:call-template name="subfieldSelect">
5299 <xsl:with-param name="codes">ab</xsl:with-param>
5300 </xsl:call-template>
5303 <xsl:for-each select="marc:datafield[@tag=080]">
5304 <classification authority="udc">
5305 <xsl:call-template name="subfieldSelect">
5306 <xsl:with-param name="codes">abx</xsl:with-param>
5307 </xsl:call-template>
5310 <xsl:for-each select="marc:datafield[@tag=060]">
5311 <classification authority="nlm">
5312 <xsl:call-template name="subfieldSelect">
5313 <xsl:with-param name="codes">ab</xsl:with-param>
5314 </xsl:call-template>
5317 <xsl:for-each select="marc:datafield[@tag=086][@ind1=0]">
5318 <classification authority="sudocs">
5319 <xsl:value-of select="marc:subfield[@code='a']"/>
5322 <xsl:for-each select="marc:datafield[@tag=086][@ind1=1]">
5323 <classification authority="candoc">
5324 <xsl:value-of select="marc:subfield[@code='a']"/>
5327 <xsl:for-each select="marc:datafield[@tag=086]">
5329 <xsl:attribute name="authority">
5330 <xsl:value-of select="marc:subfield[@code='2']"/>
5332 <xsl:value-of select="marc:subfield[@code='a']"/>
5335 <xsl:for-each select="marc:datafield[@tag=084]">
5337 <xsl:attribute name="authority">
5338 <xsl:value-of select="marc:subfield[@code='2']"/>
5340 <xsl:call-template name="subfieldSelect">
5341 <xsl:with-param name="codes">ab</xsl:with-param>
5342 </xsl:call-template>
5345 <xsl:for-each select="marc:datafield[@tag=440]">
5346 <relatedItem type="series">
5349 <xsl:call-template name="chopPunctuation">
5350 <xsl:with-param name="chopString">
5351 <xsl:call-template name="subfieldSelect">
5352 <xsl:with-param name="codes">av</xsl:with-param>
5353 </xsl:call-template>
5355 </xsl:call-template>
5357 <xsl:call-template name="part"/>
5361 <xsl:for-each select="marc:datafield[@tag=490][@ind1=0]">
5362 <relatedItem type="series">
5365 <xsl:call-template name="chopPunctuation">
5366 <xsl:with-param name="chopString">
5367 <xsl:call-template name="subfieldSelect">
5368 <xsl:with-param name="codes">av</xsl:with-param>
5369 </xsl:call-template>
5371 </xsl:call-template>
5373 <xsl:call-template name="part"/>
5377 <xsl:for-each select="marc:datafield[@tag=510]">
5378 <relatedItem type="isReferencedBy">
5380 <xsl:call-template name="subfieldSelect">
5381 <xsl:with-param name="codes">abcx3</xsl:with-param>
5382 </xsl:call-template>
5386 <xsl:for-each select="marc:datafield[@tag=534]">
5387 <relatedItem type="original">
5388 <xsl:call-template name="relatedTitle"/>
5389 <xsl:call-template name="relatedName"/>
5390 <xsl:if test="marc:subfield[@code='b' or @code='c']">
5392 <xsl:for-each select="marc:subfield[@code='c']">
5394 <xsl:value-of select="."/>
5397 <xsl:for-each select="marc:subfield[@code='b']">
5399 <xsl:value-of select="."/>
5404 <xsl:call-template name="relatedIdentifierISSN"/>
5405 <xsl:for-each select="marc:subfield[@code='z']">
5406 <identifier type="isbn">
5407 <xsl:value-of select="."/>
5410 <xsl:call-template name="relatedNote"/>
5413 <xsl:for-each select="marc:datafield[@tag=700][marc:subfield[@code='t']]">
5415 <xsl:call-template name="constituentOrRelatedType"/>
5418 <xsl:call-template name="chopPunctuation">
5419 <xsl:with-param name="chopString">
5420 <xsl:call-template name="specialSubfieldSelect">
5421 <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
5422 <xsl:with-param name="axis">t</xsl:with-param>
5423 <xsl:with-param name="afterCodes">g</xsl:with-param>
5424 </xsl:call-template>
5426 </xsl:call-template>
5428 <xsl:call-template name="part"/>
5430 <name type="personal">
5432 <xsl:call-template name="specialSubfieldSelect">
5433 <xsl:with-param name="anyCodes">aq</xsl:with-param>
5434 <xsl:with-param name="axis">t</xsl:with-param>
5435 <xsl:with-param name="beforeCodes">g</xsl:with-param>
5436 </xsl:call-template>
5438 <xsl:call-template name="termsOfAddress"/>
5439 <xsl:call-template name="nameDate"/>
5440 <xsl:call-template name="role"/>
5442 <xsl:call-template name="relatedForm"/>
5443 <xsl:call-template name="relatedIdentifierISSN"/>
5446 <xsl:for-each select="marc:datafield[@tag=710][marc:subfield[@code='t']]">
5448 <xsl:call-template name="constituentOrRelatedType"/>
5451 <xsl:call-template name="chopPunctuation">
5452 <xsl:with-param name="chopString">
5453 <xsl:call-template name="specialSubfieldSelect">
5454 <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
5455 <xsl:with-param name="axis">t</xsl:with-param>
5456 <xsl:with-param name="afterCodes">dg</xsl:with-param>
5457 </xsl:call-template>
5459 </xsl:call-template>
5461 <xsl:call-template name="relatedPartNumName"/>
5463 <name type="corporate">
5464 <xsl:for-each select="marc:subfield[@code='a']">
5466 <xsl:value-of select="."/>
5469 <xsl:for-each select="marc:subfield[@code='b']">
5471 <xsl:value-of select="."/>
5474 <xsl:variable name="tempNamePart">
5475 <xsl:call-template name="specialSubfieldSelect">
5476 <xsl:with-param name="anyCodes">c</xsl:with-param>
5477 <xsl:with-param name="axis">t</xsl:with-param>
5478 <xsl:with-param name="beforeCodes">dgn</xsl:with-param>
5479 </xsl:call-template>
5481 <xsl:if test="normalize-space($tempNamePart)">
5483 <xsl:value-of select="$tempNamePart"/>
5486 <xsl:call-template name="role"/>
5488 <xsl:call-template name="relatedForm"/>
5489 <xsl:call-template name="relatedIdentifierISSN"/>
5492 <xsl:for-each select="marc:datafield[@tag=711][marc:subfield[@code='t']]">
5494 <xsl:call-template name="constituentOrRelatedType"/>
5497 <xsl:call-template name="chopPunctuation">
5498 <xsl:with-param name="chopString">
5499 <xsl:call-template name="specialSubfieldSelect">
5500 <xsl:with-param name="anyCodes">tfklsv</xsl:with-param>
5501 <xsl:with-param name="axis">t</xsl:with-param>
5502 <xsl:with-param name="afterCodes">g</xsl:with-param>
5503 </xsl:call-template>
5505 </xsl:call-template>
5507 <xsl:call-template name="relatedPartNumName"/>
5509 <name type="conference">
5511 <xsl:call-template name="specialSubfieldSelect">
5512 <xsl:with-param name="anyCodes">aqdc</xsl:with-param>
5513 <xsl:with-param name="axis">t</xsl:with-param>
5514 <xsl:with-param name="beforeCodes">gn</xsl:with-param>
5515 </xsl:call-template>
5518 <xsl:call-template name="relatedForm"/>
5519 <xsl:call-template name="relatedIdentifierISSN"/>
5522 <xsl:for-each select="marc:datafield[@tag=730][@ind2=2]">
5524 <xsl:call-template name="constituentOrRelatedType"/>
5527 <xsl:call-template name="chopPunctuation">
5528 <xsl:with-param name="chopString">
5529 <xsl:call-template name="subfieldSelect">
5530 <xsl:with-param name="codes">adfgklmorsv</xsl:with-param>
5531 </xsl:call-template>
5533 </xsl:call-template>
5535 <xsl:call-template name="part"/>
5537 <xsl:call-template name="relatedForm"/>
5538 <xsl:call-template name="relatedIdentifierISSN"/>
5541 <xsl:for-each select="marc:datafield[@tag=740][@ind2=2]">
5543 <xsl:call-template name="constituentOrRelatedType"/>
5546 <xsl:call-template name="chopPunctuation">
5547 <xsl:with-param name="chopString">
5548 <xsl:value-of select="marc:subfield[@code='a']"/>
5550 </xsl:call-template>
5552 <xsl:call-template name="part"/>
5554 <xsl:call-template name="relatedForm"/>
5557 <xsl:for-each select="marc:datafield[@tag=760]|marc:datafield[@tag=762]">
5558 <relatedItem type="series">
5559 <xsl:call-template name="relatedItem76X-78X"/>
5563 select="marc:datafield[@tag=765]|marc:datafield[@tag=767]|marc:datafield[@tag=777]|marc:datafield[@tag=787]">
5565 <xsl:call-template name="relatedItem76X-78X"/>
5568 <xsl:for-each select="marc:datafield[@tag=775]">
5569 <relatedItem type="otherVersion">
5570 <xsl:call-template name="relatedItem76X-78X"/>
5573 <xsl:for-each select="marc:datafield[@tag=770]|marc:datafield[@tag=774]">
5574 <relatedItem type="constituent">
5575 <xsl:call-template name="relatedItem76X-78X"/>
5578 <xsl:for-each select="marc:datafield[@tag=772]|marc:datafield[@tag=773]">
5579 <relatedItem type="host">
5580 <xsl:call-template name="relatedItem76X-78X"/>
5583 <xsl:for-each select="marc:datafield[@tag=776]">
5584 <relatedItem type="otherFormat">
5585 <xsl:call-template name="relatedItem76X-78X"/>
5588 <xsl:for-each select="marc:datafield[@tag=780]">
5589 <relatedItem type="preceding">
5590 <xsl:call-template name="relatedItem76X-78X"/>
5593 <xsl:for-each select="marc:datafield[@tag=785]">
5594 <relatedItem type="succeeding">
5595 <xsl:call-template name="relatedItem76X-78X"/>
5598 <xsl:for-each select="marc:datafield[@tag=786]">
5599 <relatedItem type="original">
5600 <xsl:call-template name="relatedItem76X-78X"/>
5603 <xsl:for-each select="marc:datafield[@tag=800]">
5604 <relatedItem type="series">
5607 <xsl:call-template name="chopPunctuation">
5608 <xsl:with-param name="chopString">
5609 <xsl:call-template name="specialSubfieldSelect">
5610 <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
5611 <xsl:with-param name="axis">t</xsl:with-param>
5612 <xsl:with-param name="afterCodes">g</xsl:with-param>
5613 </xsl:call-template>
5615 </xsl:call-template>
5617 <xsl:call-template name="part"/>
5619 <name type="personal">
5621 <xsl:call-template name="chopPunctuation">
5622 <xsl:with-param name="chopString">
5623 <xsl:call-template name="specialSubfieldSelect">
5624 <xsl:with-param name="anyCodes">aq</xsl:with-param>
5625 <xsl:with-param name="axis">t</xsl:with-param>
5626 <xsl:with-param name="beforeCodes">g</xsl:with-param>
5627 </xsl:call-template>
5629 </xsl:call-template>
5631 <xsl:call-template name="termsOfAddress"/>
5632 <xsl:call-template name="nameDate"/>
5633 <xsl:call-template name="role"/>
5635 <xsl:call-template name="relatedForm"/>
5638 <xsl:for-each select="marc:datafield[@tag=810]">
5639 <relatedItem type="series">
5642 <xsl:call-template name="chopPunctuation">
5643 <xsl:with-param name="chopString">
5644 <xsl:call-template name="specialSubfieldSelect">
5645 <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
5646 <xsl:with-param name="axis">t</xsl:with-param>
5647 <xsl:with-param name="afterCodes">dg</xsl:with-param>
5648 </xsl:call-template>
5650 </xsl:call-template>
5652 <xsl:call-template name="relatedPartNumName"/>
5654 <name type="corporate">
5655 <xsl:for-each select="marc:subfield[@code='a']">
5657 <xsl:value-of select="."/>
5660 <xsl:for-each select="marc:subfield[@code='b']">
5662 <xsl:value-of select="."/>
5666 <xsl:call-template name="specialSubfieldSelect">
5667 <xsl:with-param name="anyCodes">c</xsl:with-param>
5668 <xsl:with-param name="axis">t</xsl:with-param>
5669 <xsl:with-param name="beforeCodes">dgn</xsl:with-param>
5670 </xsl:call-template>
5672 <xsl:call-template name="role"/>
5674 <xsl:call-template name="relatedForm"/>
5677 <xsl:for-each select="marc:datafield[@tag=811]">
5678 <relatedItem type="series">
5681 <xsl:call-template name="chopPunctuation">
5682 <xsl:with-param name="chopString">
5683 <xsl:call-template name="specialSubfieldSelect">
5684 <xsl:with-param name="anyCodes">tfklsv</xsl:with-param>
5685 <xsl:with-param name="axis">t</xsl:with-param>
5686 <xsl:with-param name="afterCodes">g</xsl:with-param>
5687 </xsl:call-template>
5689 </xsl:call-template>
5691 <xsl:call-template name="relatedPartNumName"/>
5693 <name type="conference">
5695 <xsl:call-template name="specialSubfieldSelect">
5696 <xsl:with-param name="anyCodes">aqdc</xsl:with-param>
5697 <xsl:with-param name="axis">t</xsl:with-param>
5698 <xsl:with-param name="beforeCodes">gn</xsl:with-param>
5699 </xsl:call-template>
5701 <xsl:call-template name="role"/>
5703 <xsl:call-template name="relatedForm"/>
5706 <xsl:for-each select="marc:datafield[@tag='830']">
5707 <relatedItem type="series">
5710 <xsl:call-template name="chopPunctuation">
5711 <xsl:with-param name="chopString">
5712 <xsl:call-template name="subfieldSelect">
5713 <xsl:with-param name="codes">adfgklmorsv</xsl:with-param>
5714 </xsl:call-template>
5716 </xsl:call-template>
5718 <xsl:call-template name="part"/>
5720 <xsl:call-template name="relatedForm"/>
5723 <xsl:for-each select="marc:datafield[@tag='856'][@ind2='2']/marc:subfield[@code='q']">
5726 <xsl:value-of select="."/>
5727 </internetMediaType>
5730 <xsl:for-each select="marc:datafield[@tag='020']">
5731 <xsl:call-template name="isInvalid">
5732 <xsl:with-param name="type">isbn</xsl:with-param>
5733 </xsl:call-template>
5734 <xsl:if test="marc:subfield[@code='a']">
5735 <identifier type="isbn">
5736 <xsl:value-of select="marc:subfield[@code='a']"/>
5740 <xsl:for-each select="marc:datafield[@tag='024'][@ind1='0']">
5741 <xsl:call-template name="isInvalid">
5742 <xsl:with-param name="type">isrc</xsl:with-param>
5743 </xsl:call-template>
5744 <xsl:if test="marc:subfield[@code='a']">
5745 <identifier type="isrc">
5746 <xsl:value-of select="marc:subfield[@code='a']"/>
5750 <xsl:for-each select="marc:datafield[@tag='024'][@ind1='2']">
5751 <xsl:call-template name="isInvalid">
5752 <xsl:with-param name="type">ismn</xsl:with-param>
5753 </xsl:call-template>
5754 <xsl:if test="marc:subfield[@code='a']">
5755 <identifier type="ismn">
5756 <xsl:value-of select="marc:subfield[@code='a']"/>
5760 <xsl:for-each select="marc:datafield[@tag='024'][@ind1='4']">
5761 <xsl:call-template name="isInvalid">
5762 <xsl:with-param name="type">sici</xsl:with-param>
5763 </xsl:call-template>
5764 <identifier type="sici">
5765 <xsl:call-template name="subfieldSelect">
5766 <xsl:with-param name="codes">ab</xsl:with-param>
5767 </xsl:call-template>
5770 <xsl:for-each select="marc:datafield[@tag='022']">
5771 <xsl:if test="marc:subfield[@code='a']">
5772 <xsl:call-template name="isInvalid">
5773 <xsl:with-param name="type">issn</xsl:with-param>
5774 </xsl:call-template>
5775 <identifier type="issn">
5776 <xsl:value-of select="marc:subfield[@code='a']"/>
5779 <xsl:if test="marc:subfield[@code='l']">
5780 <xsl:call-template name="isInvalid">
5781 <xsl:with-param name="type">issn-l</xsl:with-param>
5782 </xsl:call-template>
5783 <identifier type="issn-l">
5784 <xsl:value-of select="marc:subfield[@code='l']"/>
5791 <xsl:for-each select="marc:datafield[@tag='010']">
5792 <xsl:call-template name="isInvalid">
5793 <xsl:with-param name="type">lccn</xsl:with-param>
5794 </xsl:call-template>
5795 <identifier type="lccn">
5796 <xsl:value-of select="normalize-space(marc:subfield[@code='a'])"/>
5799 <xsl:for-each select="marc:datafield[@tag='028']">
5801 <xsl:attribute name="type">
5803 <xsl:when test="@ind1='0'">issue number</xsl:when>
5804 <xsl:when test="@ind1='1'">matrix number</xsl:when>
5805 <xsl:when test="@ind1='2'">music plate</xsl:when>
5806 <xsl:when test="@ind1='3'">music publisher</xsl:when>
5807 <xsl:when test="@ind1='4'">videorecording identifier</xsl:when>
5810 <!--<xsl:call-template name="isInvalid"/>-->
5811 <!-- no $z in 028 -->
5812 <xsl:call-template name="subfieldSelect">
5813 <xsl:with-param name="codes">
5815 <xsl:when test="@ind1='0'">ba</xsl:when>
5816 <xsl:otherwise>ab</xsl:otherwise>
5819 </xsl:call-template>
5822 <xsl:for-each select="marc:datafield[@tag='037']">
5823 <identifier type="stock number">
5824 <!--<xsl:call-template name="isInvalid"/>-->
5825 <!-- no $z in 037 -->
5826 <xsl:call-template name="subfieldSelect">
5827 <xsl:with-param name="codes">ab</xsl:with-param>
5828 </xsl:call-template>
5831 <xsl:for-each select="marc:datafield[@tag='856'][marc:subfield[@code='u']]">
5833 <xsl:attribute name="type">
5836 test="starts-with(marc:subfield[@code='u'],'urn:doi') or starts-with(marc:subfield[@code='u'],'doi')"
5839 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')"
5841 <xsl:otherwise>uri</xsl:otherwise>
5846 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') ">
5848 select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))"
5852 <xsl:value-of select="marc:subfield[@code='u']"/>
5857 test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl')">
5858 <identifier type="hdl">
5859 <xsl:if test="marc:subfield[@code='y' or @code='3' or @code='z']">
5860 <xsl:attribute name="displayLabel">
5861 <xsl:call-template name="subfieldSelect">
5862 <xsl:with-param name="codes">y3z</xsl:with-param>
5863 </xsl:call-template>
5867 select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))"
5872 <xsl:for-each select="marc:datafield[@tag=024][@ind1=1]">
5873 <identifier type="upc">
5874 <xsl:call-template name="isInvalid"/>
5875 <xsl:value-of select="marc:subfield[@code='a']"/>
5879 <!-- 1/04 fix added $y -->
5882 <xsl:for-each select="marc:datafield[@tag=856][@ind2=1][marc:subfield[@code='u']]">
5883 <relatedItem type="otherVersion">
5886 <xsl:if test="marc:subfield[@code='y' or @code='3']">
5887 <xsl:attribute name="displayLabel">
5888 <xsl:call-template name="subfieldSelect">
5889 <xsl:with-param name="codes">y3</xsl:with-param>
5890 </xsl:call-template>
5893 <xsl:if test="marc:subfield[@code='z' ]">
5894 <xsl:attribute name="note">
5895 <xsl:call-template name="subfieldSelect">
5896 <xsl:with-param name="codes">z</xsl:with-param>
5897 </xsl:call-template>
5900 <xsl:value-of select="marc:subfield[@code='u']"/>
5905 <xsl:for-each select="marc:datafield[@tag=856][@ind2=2][marc:subfield[@code='u']]">
5909 <xsl:if test="marc:subfield[@code='y' or @code='3']">
5910 <xsl:attribute name="displayLabel">
5911 <xsl:call-template name="subfieldSelect">
5912 <xsl:with-param name="codes">y3</xsl:with-param>
5913 </xsl:call-template>
5916 <xsl:if test="marc:subfield[@code='z' ]">
5917 <xsl:attribute name="note">
5918 <xsl:call-template name="subfieldSelect">
5919 <xsl:with-param name="codes">z</xsl:with-param>
5920 </xsl:call-template>
5923 <xsl:value-of select="marc:subfield[@code='u']"/>
5929 <!-- 3.2 change tmee 856z -->
5932 <xsl:for-each select="marc:datafield[@tag=852]">
5934 <xsl:if test="marc:subfield[@code='a' or @code='b' or @code='e']">
5936 <xsl:call-template name="subfieldSelect">
5937 <xsl:with-param name="codes">abe</xsl:with-param>
5938 </xsl:call-template>
5942 <xsl:if test="marc:subfield[@code='u']">
5944 <xsl:call-template name="uri"/>
5945 <xsl:call-template name="subfieldSelect">
5946 <xsl:with-param name="codes">u</xsl:with-param>
5947 </xsl:call-template>
5952 test="marc:subfield[@code='h' or @code='i' or @code='j' or @code='k' or @code='l' or @code='m' or @code='t']">
5954 <xsl:call-template name="subfieldSelect">
5955 <xsl:with-param name="codes">hijklmt</xsl:with-param>
5956 </xsl:call-template>
5962 <xsl:for-each select="marc:datafield[@tag=506]">
5963 <accessCondition type="restrictionOnAccess">
5964 <xsl:call-template name="subfieldSelect">
5965 <xsl:with-param name="codes">abcd35</xsl:with-param>
5966 </xsl:call-template>
5969 <xsl:for-each select="marc:datafield[@tag=540]">
5970 <accessCondition type="useAndReproduction">
5971 <xsl:call-template name="subfieldSelect">
5972 <xsl:with-param name="codes">abcde35</xsl:with-param>
5973 </xsl:call-template>
5981 <xsl:for-each select="marc:leader[substring($leader,19,1)='a']">
5982 <descriptionStandard>aacr2</descriptionStandard>
5985 <xsl:for-each select="marc:datafield[@tag=040]">
5986 <xsl:if test="marc:subfield[@code='e']">
5987 <descriptionStandard>
5988 <xsl:value-of select="marc:subfield[@code='e']"/>
5989 </descriptionStandard>
5991 <recordContentSource authority="marcorg">
5992 <xsl:value-of select="marc:subfield[@code='a']"/>
5993 </recordContentSource>
5995 <xsl:for-each select="marc:controlfield[@tag=008]">
5996 <recordCreationDate encoding="marc">
5997 <xsl:value-of select="substring(.,1,6)"/>
5998 </recordCreationDate>
6001 <xsl:for-each select="marc:controlfield[@tag=005]">
6002 <recordChangeDate encoding="iso8601">
6003 <xsl:value-of select="."/>
6006 <xsl:for-each select="marc:controlfield[@tag=001]">
6008 <xsl:if test="../marc:controlfield[@tag=003]">
6009 <xsl:attribute name="source">
6010 <xsl:value-of select="../marc:controlfield[@tag=003]"/>
6013 <xsl:value-of select="."/>
6016 <xsl:for-each select="marc:datafield[@tag=040]/marc:subfield[@code='b']">
6017 <languageOfCataloging>
6018 <languageTerm authority="iso639-2b" type="code">
6019 <xsl:value-of select="."/>
6021 </languageOfCataloging>
6025 <xsl:template name="displayForm">
6026 <xsl:for-each select="marc:subfield[@code='c']">
6028 <xsl:value-of select="."/>
6032 <xsl:template name="affiliation">
6033 <xsl:for-each select="marc:subfield[@code='u']">
6035 <xsl:value-of select="."/>
6039 <xsl:template name="uri">
6040 <xsl:for-each select="marc:subfield[@code='u']">
6041 <xsl:attribute name="xlink:href">
6042 <xsl:value-of select="."/>
6045 <xsl:for-each select="marc:subfield[@code='0']">
6047 <xsl:when test="contains(text(), ')')">
6048 <xsl:attribute name="xlink:href">
6049 <xsl:value-of select="substring-after(text(), ')')"></xsl:value-of>
6053 <xsl:attribute name="xlink:href">
6054 <xsl:value-of select="."></xsl:value-of>
6060 <xsl:template name="role">
6061 <xsl:for-each select="marc:subfield[@code='e']">
6063 <roleTerm type="text">
6064 <xsl:value-of select="."/>
6068 <xsl:for-each select="marc:subfield[@code='4']">
6070 <roleTerm authority="marcrelator" type="code">
6071 <xsl:value-of select="."/>
6076 <xsl:template name="part">
6077 <xsl:variable name="partNumber">
6078 <xsl:call-template name="specialSubfieldSelect">
6079 <xsl:with-param name="axis">n</xsl:with-param>
6080 <xsl:with-param name="anyCodes">n</xsl:with-param>
6081 <xsl:with-param name="afterCodes">fgkdlmor</xsl:with-param>
6082 </xsl:call-template>
6084 <xsl:variable name="partName">
6085 <xsl:call-template name="specialSubfieldSelect">
6086 <xsl:with-param name="axis">p</xsl:with-param>
6087 <xsl:with-param name="anyCodes">p</xsl:with-param>
6088 <xsl:with-param name="afterCodes">fgkdlmor</xsl:with-param>
6089 </xsl:call-template>
6091 <xsl:if test="string-length(normalize-space($partNumber))">
6093 <xsl:call-template name="chopPunctuation">
6094 <xsl:with-param name="chopString" select="$partNumber"/>
6095 </xsl:call-template>
6098 <xsl:if test="string-length(normalize-space($partName))">
6100 <xsl:call-template name="chopPunctuation">
6101 <xsl:with-param name="chopString" select="$partName"/>
6102 </xsl:call-template>
6106 <xsl:template name="relatedPart">
6107 <xsl:if test="@tag=773">
6108 <xsl:for-each select="marc:subfield[@code='g']">
6111 <xsl:value-of select="."/>
6115 <xsl:for-each select="marc:subfield[@code='q']">
6117 <xsl:call-template name="parsePart"/>
6122 <xsl:template name="relatedPartNumName">
6123 <xsl:variable name="partNumber">
6124 <xsl:call-template name="specialSubfieldSelect">
6125 <xsl:with-param name="axis">g</xsl:with-param>
6126 <xsl:with-param name="anyCodes">g</xsl:with-param>
6127 <xsl:with-param name="afterCodes">pst</xsl:with-param>
6128 </xsl:call-template>
6130 <xsl:variable name="partName">
6131 <xsl:call-template name="specialSubfieldSelect">
6132 <xsl:with-param name="axis">p</xsl:with-param>
6133 <xsl:with-param name="anyCodes">p</xsl:with-param>
6134 <xsl:with-param name="afterCodes">fgkdlmor</xsl:with-param>
6135 </xsl:call-template>
6137 <xsl:if test="string-length(normalize-space($partNumber))">
6139 <xsl:value-of select="$partNumber"/>
6142 <xsl:if test="string-length(normalize-space($partName))">
6144 <xsl:value-of select="$partName"/>
6148 <xsl:template name="relatedName">
6149 <xsl:for-each select="marc:subfield[@code='a']">
6152 <xsl:value-of select="."/>
6157 <xsl:template name="relatedForm">
6158 <xsl:for-each select="marc:subfield[@code='h']">
6159 <physicalDescription>
6161 <xsl:value-of select="."/>
6163 </physicalDescription>
6166 <xsl:template name="relatedExtent">
6167 <xsl:for-each select="marc:subfield[@code='h']">
6168 <physicalDescription>
6170 <xsl:value-of select="."/>
6172 </physicalDescription>
6175 <xsl:template name="relatedNote">
6176 <xsl:for-each select="marc:subfield[@code='n']">
6178 <xsl:value-of select="."/>
6182 <xsl:template name="relatedSubject">
6183 <xsl:for-each select="marc:subfield[@code='j']">
6185 <temporal encoding="iso8601">
6186 <xsl:call-template name="chopPunctuation">
6187 <xsl:with-param name="chopString" select="."/>
6188 </xsl:call-template>
6193 <xsl:template name="relatedIdentifierISSN">
6194 <xsl:for-each select="marc:subfield[@code='x']">
6195 <identifier type="issn">
6196 <xsl:value-of select="."/>
6200 <xsl:template name="relatedIdentifierLocal">
6201 <xsl:for-each select="marc:subfield[@code='w']">
6202 <identifier type="local">
6203 <xsl:value-of select="."/>
6207 <xsl:template name="relatedIdentifier">
6208 <xsl:for-each select="marc:subfield[@code='o']">
6210 <xsl:value-of select="."/>
6214 <xsl:template name="relatedItem76X-78X">
6215 <xsl:call-template name="displayLabel"/>
6216 <xsl:call-template name="relatedTitle76X-78X"/>
6217 <xsl:call-template name="relatedName"/>
6218 <xsl:call-template name="relatedOriginInfo"/>
6219 <xsl:call-template name="relatedLanguage"/>
6220 <xsl:call-template name="relatedExtent"/>
6221 <xsl:call-template name="relatedNote"/>
6222 <xsl:call-template name="relatedSubject"/>
6223 <xsl:call-template name="relatedIdentifier"/>
6224 <xsl:call-template name="relatedIdentifierISSN"/>
6225 <xsl:call-template name="relatedIdentifierLocal"/>
6226 <xsl:call-template name="relatedPart"/>
6228 <xsl:template name="subjectGeographicZ">
6230 <xsl:call-template name="chopPunctuation">
6231 <xsl:with-param name="chopString" select="."/>
6232 </xsl:call-template>
6235 <xsl:template name="subjectTemporalY">
6237 <xsl:call-template name="chopPunctuation">
6238 <xsl:with-param name="chopString" select="."/>
6239 </xsl:call-template>
6242 <xsl:template name="subjectTopic">
6244 <xsl:call-template name="chopPunctuation">
6245 <xsl:with-param name="chopString" select="."/>
6246 </xsl:call-template>
6249 <!-- 3.2 change tmee 6xx $v genre -->
6250 <xsl:template name="subjectGenre">
6252 <xsl:call-template name="chopPunctuation">
6253 <xsl:with-param name="chopString" select="."/>
6254 </xsl:call-template>
6258 <xsl:template name="nameABCDN">
6259 <xsl:for-each select="marc:subfield[@code='a']">
6261 <xsl:call-template name="chopPunctuation">
6262 <xsl:with-param name="chopString" select="."/>
6263 </xsl:call-template>
6266 <xsl:for-each select="marc:subfield[@code='b']">
6268 <xsl:value-of select="."/>
6272 test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
6274 <xsl:call-template name="subfieldSelect">
6275 <xsl:with-param name="codes">cdn</xsl:with-param>
6276 </xsl:call-template>
6280 <xsl:template name="nameABCDQ">
6282 <xsl:call-template name="chopPunctuation">
6283 <xsl:with-param name="chopString">
6284 <xsl:call-template name="subfieldSelect">
6285 <xsl:with-param name="codes">aq</xsl:with-param>
6286 </xsl:call-template>
6288 <xsl:with-param name="punctuation">
6289 <xsl:text>:,;/ </xsl:text>
6291 </xsl:call-template>
6293 <xsl:call-template name="termsOfAddress"/>
6294 <xsl:call-template name="nameDate"/>
6296 <xsl:template name="nameACDEQ">
6298 <xsl:call-template name="subfieldSelect">
6299 <xsl:with-param name="codes">acdeq</xsl:with-param>
6300 </xsl:call-template>
6303 <xsl:template name="constituentOrRelatedType">
6304 <xsl:if test="@ind2=2">
6305 <xsl:attribute name="type">constituent</xsl:attribute>
6308 <xsl:template name="relatedTitle">
6309 <xsl:for-each select="marc:subfield[@code='t']">
6312 <xsl:call-template name="chopPunctuation">
6313 <xsl:with-param name="chopString">
6314 <xsl:value-of select="."/>
6316 </xsl:call-template>
6321 <xsl:template name="relatedTitle76X-78X">
6322 <xsl:for-each select="marc:subfield[@code='t']">
6325 <xsl:call-template name="chopPunctuation">
6326 <xsl:with-param name="chopString">
6327 <xsl:value-of select="."/>
6329 </xsl:call-template>
6331 <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
6332 <xsl:call-template name="relatedPartNumName"/>
6336 <xsl:for-each select="marc:subfield[@code='p']">
6337 <titleInfo type="abbreviated">
6339 <xsl:call-template name="chopPunctuation">
6340 <xsl:with-param name="chopString">
6341 <xsl:value-of select="."/>
6343 </xsl:call-template>
6345 <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
6346 <xsl:call-template name="relatedPartNumName"/>
6350 <xsl:for-each select="marc:subfield[@code='s']">
6351 <titleInfo type="uniform">
6353 <xsl:call-template name="chopPunctuation">
6354 <xsl:with-param name="chopString">
6355 <xsl:value-of select="."/>
6357 </xsl:call-template>
6359 <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
6360 <xsl:call-template name="relatedPartNumName"/>
6365 <xsl:template name="relatedOriginInfo">
6366 <xsl:if test="marc:subfield[@code='b' or @code='d'] or marc:subfield[@code='f']">
6368 <xsl:if test="@tag=775">
6369 <xsl:for-each select="marc:subfield[@code='f']">
6372 <xsl:attribute name="type">code</xsl:attribute>
6373 <xsl:attribute name="authority">marcgac</xsl:attribute>
6374 <xsl:value-of select="."/>
6379 <xsl:for-each select="marc:subfield[@code='d']">
6381 <xsl:value-of select="."/>
6384 <xsl:for-each select="marc:subfield[@code='b']">
6386 <xsl:value-of select="."/>
6392 <xsl:template name="relatedLanguage">
6393 <xsl:for-each select="marc:subfield[@code='e']">
6394 <xsl:call-template name="getLanguage">
6395 <xsl:with-param name="langString">
6396 <xsl:value-of select="."/>
6398 </xsl:call-template>
6401 <xsl:template name="nameDate">
6402 <xsl:for-each select="marc:subfield[@code='d']">
6403 <namePart type="date">
6404 <xsl:call-template name="chopPunctuation">
6405 <xsl:with-param name="chopString" select="."/>
6406 </xsl:call-template>
6410 <xsl:template name="subjectAuthority">
6411 <xsl:if test="@ind2!=4">
6412 <xsl:if test="@ind2!=' '">
6413 <xsl:if test="@ind2!=8">
6414 <xsl:if test="@ind2!=9">
6415 <xsl:attribute name="authority">
6417 <xsl:when test="@ind2=0">lcsh</xsl:when>
6418 <xsl:when test="@ind2=1">lcshac</xsl:when>
6419 <xsl:when test="@ind2=2">mesh</xsl:when>
6421 <xsl:when test="@ind2=3">nal</xsl:when>
6422 <xsl:when test="@ind2=5">csh</xsl:when>
6423 <xsl:when test="@ind2=6">rvm</xsl:when>
6424 <xsl:when test="@ind2=7">
6425 <xsl:value-of select="marc:subfield[@code='2']"/>
6434 <xsl:template name="subjectAnyOrder">
6435 <xsl:for-each select="marc:subfield[@code='v' or @code='x' or @code='y' or @code='z']">
6437 <xsl:when test="@code='v'">
6438 <xsl:call-template name="subjectGenre"/>
6440 <xsl:when test="@code='x'">
6441 <xsl:call-template name="subjectTopic"/>
6443 <xsl:when test="@code='y'">
6444 <xsl:call-template name="subjectTemporalY"/>
6446 <xsl:when test="@code='z'">
6447 <xsl:call-template name="subjectGeographicZ"/>
6452 <xsl:template name="specialSubfieldSelect">
6453 <xsl:param name="anyCodes"/>
6454 <xsl:param name="axis"/>
6455 <xsl:param name="beforeCodes"/>
6456 <xsl:param name="afterCodes"/>
6457 <xsl:variable name="str">
6458 <xsl:for-each select="marc:subfield">
6460 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])">
6461 <xsl:value-of select="text()"/>
6462 <xsl:text> </xsl:text>
6466 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
6469 <!-- 3.2 change tmee 6xx $v genre -->
6470 <xsl:template match="marc:datafield[@tag=600]">
6472 <xsl:call-template name="subjectAuthority"/>
6473 <name type="personal">
6474 <xsl:call-template name="termsOfAddress"/>
6476 <xsl:call-template name="chopPunctuation">
6477 <xsl:with-param name="chopString">
6478 <xsl:call-template name="subfieldSelect">
6479 <xsl:with-param name="codes">aq</xsl:with-param>
6480 </xsl:call-template>
6482 </xsl:call-template>
6484 <xsl:call-template name="nameDate"/>
6485 <xsl:call-template name="affiliation"/>
6486 <xsl:call-template name="role"/>
6488 <xsl:call-template name="subjectAnyOrder"/>
6491 <xsl:template match="marc:datafield[@tag=610]">
6493 <xsl:call-template name="subjectAuthority"/>
6494 <name type="corporate">
6495 <xsl:for-each select="marc:subfield[@code='a']">
6497 <xsl:value-of select="."/>
6500 <xsl:for-each select="marc:subfield[@code='b']">
6502 <xsl:value-of select="."/>
6505 <xsl:if test="marc:subfield[@code='c' or @code='d' or @code='n' or @code='p']">
6507 <xsl:call-template name="subfieldSelect">
6508 <xsl:with-param name="codes">cdnp</xsl:with-param>
6509 </xsl:call-template>
6512 <xsl:call-template name="role"/>
6514 <xsl:call-template name="subjectAnyOrder"/>
6517 <xsl:template match="marc:datafield[@tag=611]">
6519 <xsl:call-template name="subjectAuthority"/>
6520 <name type="conference">
6522 <xsl:call-template name="subfieldSelect">
6523 <xsl:with-param name="codes">abcdeqnp</xsl:with-param>
6524 </xsl:call-template>
6526 <xsl:for-each select="marc:subfield[@code='4']">
6528 <roleTerm authority="marcrelator" type="code">
6529 <xsl:value-of select="."/>
6534 <xsl:call-template name="subjectAnyOrder"/>
6537 <xsl:template match="marc:datafield[@tag=630]">
6539 <xsl:call-template name="subjectAuthority"/>
6542 <xsl:call-template name="chopPunctuation">
6543 <xsl:with-param name="chopString">
6544 <xsl:call-template name="subfieldSelect">
6545 <xsl:with-param name="codes">adfhklor</xsl:with-param>
6546 </xsl:call-template>
6548 </xsl:call-template>
6550 <xsl:call-template name="part"/>
6552 <xsl:call-template name="subjectAnyOrder"/>
6555 <!-- 1.27 648 tmee-->
6556 <xsl:template match="marc:datafield[@tag=648]">
6558 <xsl:if test="marc:subfield[@code=2]">
6559 <xsl:attribute name="authority">
6560 <xsl:value-of select="marc:subfield[@code=2]"/>
6563 <xsl:call-template name="uri"/>
6565 <xsl:call-template name="subjectAuthority"/>
6567 <xsl:call-template name="chopPunctuation">
6568 <xsl:with-param name="chopString">
6569 <xsl:call-template name="subfieldSelect">
6570 <xsl:with-param name="codes">abcd</xsl:with-param>
6571 </xsl:call-template>
6573 </xsl:call-template>
6575 <xsl:call-template name="subjectAnyOrder"/>
6579 <xsl:template match="marc:datafield[@tag=650]">
6581 <xsl:call-template name="subjectAuthority"/>
6583 <xsl:call-template name="chopPunctuation">
6584 <xsl:with-param name="chopString">
6585 <xsl:call-template name="subfieldSelect">
6586 <xsl:with-param name="codes">abcd</xsl:with-param>
6587 </xsl:call-template>
6589 </xsl:call-template>
6591 <xsl:call-template name="subjectAnyOrder"/>
6594 <xsl:template match="marc:datafield[@tag=651]">
6596 <xsl:call-template name="subjectAuthority"/>
6597 <xsl:for-each select="marc:subfield[@code='a']">
6599 <xsl:call-template name="chopPunctuation">
6600 <xsl:with-param name="chopString" select="."/>
6601 </xsl:call-template>
6604 <xsl:call-template name="subjectAnyOrder"/>
6607 <xsl:template match="marc:datafield[@tag=653]">
6609 <xsl:for-each select="marc:subfield[@code='a']">
6611 <xsl:value-of select="."/>
6616 <xsl:template match="marc:datafield[@tag=656]">
6618 <xsl:if test="marc:subfield[@code=2]">
6619 <xsl:attribute name="authority">
6620 <xsl:value-of select="marc:subfield[@code=2]"/>
6624 <xsl:call-template name="chopPunctuation">
6625 <xsl:with-param name="chopString">
6626 <xsl:value-of select="marc:subfield[@code='a']"/>
6628 </xsl:call-template>
6632 <xsl:template name="termsOfAddress">
6633 <xsl:if test="marc:subfield[@code='b' or @code='c']">
6634 <namePart type="termsOfAddress">
6635 <xsl:call-template name="chopPunctuation">
6636 <xsl:with-param name="chopString">
6637 <xsl:call-template name="subfieldSelect">
6638 <xsl:with-param name="codes">bc</xsl:with-param>
6639 </xsl:call-template>
6641 </xsl:call-template>
6645 <xsl:template name="displayLabel">
6646 <xsl:if test="marc:subfield[@code='i']">
6647 <xsl:attribute name="displayLabel">
6648 <xsl:value-of select="marc:subfield[@code='i']"/>
6651 <xsl:if test="marc:subfield[@code='3']">
6652 <xsl:attribute name="displayLabel">
6653 <xsl:value-of select="marc:subfield[@code='3']"/>
6657 <xsl:template name="isInvalid">
6658 <xsl:param name="type"/>
6660 test="marc:subfield[@code='z'] or marc:subfield[@code='y'] or marc:subfield[@code='m']">
6662 <xsl:attribute name="type">
6663 <xsl:value-of select="$type"/>
6665 <xsl:attribute name="invalid">
6666 <xsl:text>yes</xsl:text>
6668 <xsl:if test="marc:subfield[@code='z']">
6669 <xsl:value-of select="marc:subfield[@code='z']"/>
6671 <xsl:if test="marc:subfield[@code='y']">
6672 <xsl:value-of select="marc:subfield[@code='y']"/>
6674 <xsl:if test="marc:subfield[@code='m']">
6675 <xsl:value-of select="marc:subfield[@code='m']"/>
6680 <xsl:template name="subtitle">
6681 <xsl:if test="marc:subfield[@code='b']">
6683 <xsl:call-template name="chopPunctuation">
6684 <xsl:with-param name="chopString">
6685 <xsl:value-of select="marc:subfield[@code='b']"/>
6686 <!--<xsl:call-template name="subfieldSelect">
6687 <xsl:with-param name="codes">b</xsl:with-param>
6688 </xsl:call-template>-->
6690 </xsl:call-template>
6694 <xsl:template name="script">
6695 <xsl:param name="scriptCode"/>
6696 <xsl:attribute name="script">
6698 <xsl:when test="$scriptCode='(3'">Arabic</xsl:when>
6699 <xsl:when test="$scriptCode='(B'">Latin</xsl:when>
6700 <xsl:when test="$scriptCode='$1'">Chinese, Japanese, Korean</xsl:when>
6701 <xsl:when test="$scriptCode='(N'">Cyrillic</xsl:when>
6702 <xsl:when test="$scriptCode='(2'">Hebrew</xsl:when>
6703 <xsl:when test="$scriptCode='(S'">Greek</xsl:when>
6707 <xsl:template name="parsePart">
6708 <!-- assumes 773$q= 1:2:3<4
6709 with up to 3 levels and one optional start page
6711 <xsl:variable name="level1">
6713 <xsl:when test="contains(text(),':')">
6715 <xsl:value-of select="substring-before(text(),':')"/>
6717 <xsl:when test="not(contains(text(),':'))">
6719 <xsl:if test="contains(text(),'<')">
6721 <xsl:value-of select="substring-before(text(),'<')"/>
6723 <xsl:if test="not(contains(text(),'<'))">
6725 <xsl:value-of select="text()"/>
6730 <xsl:variable name="sici2">
6732 <xsl:when test="starts-with(substring-after(text(),$level1),':')">
6733 <xsl:value-of select="substring(substring-after(text(),$level1),2)"/>
6736 <xsl:value-of select="substring-after(text(),$level1)"/>
6740 <xsl:variable name="level2">
6742 <xsl:when test="contains($sici2,':')">
6744 <xsl:value-of select="substring-before($sici2,':')"/>
6746 <xsl:when test="contains($sici2,'<')">
6748 <xsl:value-of select="substring-before($sici2,'<')"/>
6751 <xsl:value-of select="$sici2"/>
6756 <xsl:variable name="sici3">
6758 <xsl:when test="starts-with(substring-after($sici2,$level2),':')">
6759 <xsl:value-of select="substring(substring-after($sici2,$level2),2)"/>
6762 <xsl:value-of select="substring-after($sici2,$level2)"/>
6766 <xsl:variable name="level3">
6768 <xsl:when test="contains($sici3,'<')">
6770 <xsl:value-of select="substring-before($sici3,'<')"/>
6773 <xsl:value-of select="$sici3"/>
6778 <xsl:variable name="page">
6779 <xsl:if test="contains(text(),'<')">
6780 <xsl:value-of select="substring-after(text(),'<')"/>
6783 <xsl:if test="$level1">
6786 <xsl:value-of select="$level1"/>
6790 <xsl:if test="$level2">
6793 <xsl:value-of select="$level2"/>
6797 <xsl:if test="$level3">
6800 <xsl:value-of select="$level3"/>
6804 <xsl:if test="$page">
6805 <extent unit="page">
6807 <xsl:value-of select="$page"/>
6812 <xsl:template name="getLanguage">
6813 <xsl:param name="langString"/>
6814 <xsl:param name="controlField008-35-37"/>
6815 <xsl:variable name="length" select="string-length($langString)"/>
6817 <xsl:when test="$length=0"/>
6818 <xsl:when test="$controlField008-35-37=substring($langString,1,3)">
6819 <xsl:call-template name="getLanguage">
6820 <xsl:with-param name="langString" select="substring($langString,4,$length)"/>
6821 <xsl:with-param name="controlField008-35-37" select="$controlField008-35-37"/>
6822 </xsl:call-template>
6826 <languageTerm authority="iso639-2b" type="code">
6827 <xsl:value-of select="substring($langString,1,3)"/>
6830 <xsl:call-template name="getLanguage">
6831 <xsl:with-param name="langString" select="substring($langString,4,$length)"/>
6832 <xsl:with-param name="controlField008-35-37" select="$controlField008-35-37"/>
6833 </xsl:call-template>
6837 <xsl:template name="isoLanguage">
6838 <xsl:param name="currentLanguage"/>
6839 <xsl:param name="usedLanguages"/>
6840 <xsl:param name="remainingLanguages"/>
6842 <xsl:when test="string-length($currentLanguage)=0"/>
6843 <xsl:when test="not(contains($usedLanguages, $currentLanguage))">
6845 <xsl:if test="@code!='a'">
6846 <xsl:attribute name="objectPart">
6848 <xsl:when test="@code='b'">summary or subtitle</xsl:when>
6849 <xsl:when test="@code='d'">sung or spoken text</xsl:when>
6850 <xsl:when test="@code='e'">libretto</xsl:when>
6851 <xsl:when test="@code='f'">table of contents</xsl:when>
6852 <xsl:when test="@code='g'">accompanying material</xsl:when>
6853 <xsl:when test="@code='h'">translation</xsl:when>
6857 <languageTerm authority="iso639-2b" type="code">
6858 <xsl:value-of select="$currentLanguage"/>
6861 <xsl:call-template name="isoLanguage">
6862 <xsl:with-param name="currentLanguage">
6863 <xsl:value-of select="substring($remainingLanguages,1,3)"/>
6865 <xsl:with-param name="usedLanguages">
6866 <xsl:value-of select="concat($usedLanguages,$currentLanguage)"/>
6868 <xsl:with-param name="remainingLanguages">
6870 select="substring($remainingLanguages,4,string-length($remainingLanguages))"
6873 </xsl:call-template>
6876 <xsl:call-template name="isoLanguage">
6877 <xsl:with-param name="currentLanguage">
6878 <xsl:value-of select="substring($remainingLanguages,1,3)"/>
6880 <xsl:with-param name="usedLanguages">
6881 <xsl:value-of select="concat($usedLanguages,$currentLanguage)"/>
6883 <xsl:with-param name="remainingLanguages">
6885 select="substring($remainingLanguages,4,string-length($remainingLanguages))"
6888 </xsl:call-template>
6892 <xsl:template name="chopBrackets">
6893 <xsl:param name="chopString"/>
6894 <xsl:variable name="string">
6895 <xsl:call-template name="chopPunctuation">
6896 <xsl:with-param name="chopString" select="$chopString"/>
6897 </xsl:call-template>
6899 <xsl:if test="substring($string, 1,1)='['">
6900 <xsl:value-of select="substring($string,2, string-length($string)-2)"/>
6902 <xsl:if test="substring($string, 1,1)!='['">
6903 <xsl:value-of select="$string"/>
6906 <xsl:template name="rfcLanguages">
6907 <xsl:param name="nodeNum"/>
6908 <xsl:param name="usedLanguages"/>
6909 <xsl:param name="controlField008-35-37"/>
6910 <xsl:variable name="currentLanguage" select="."/>
6912 <xsl:when test="not($currentLanguage)"/>
6914 test="$currentLanguage!=$controlField008-35-37 and $currentLanguage!='rfc3066'">
6915 <xsl:if test="not(contains($usedLanguages,$currentLanguage))">
6917 <xsl:if test="@code!='a'">
6918 <xsl:attribute name="objectPart">
6920 <xsl:when test="@code='b'">summary or subtitle</xsl:when>
6921 <xsl:when test="@code='d'">sung or spoken text</xsl:when>
6922 <xsl:when test="@code='e'">libretto</xsl:when>
6923 <xsl:when test="@code='f'">table of contents</xsl:when>
6924 <xsl:when test="@code='g'">accompanying material</xsl:when>
6925 <xsl:when test="@code='h'">translation</xsl:when>
6929 <languageTerm authority="rfc3066" type="code">
6930 <xsl:value-of select="$currentLanguage"/>
6935 <xsl:otherwise> </xsl:otherwise>
6939 <xsl:template name="datafield">
6940 <xsl:param name="tag"/>
6941 <xsl:param name="ind1">
6942 <xsl:text> </xsl:text>
6944 <xsl:param name="ind2">
6945 <xsl:text> </xsl:text>
6947 <xsl:param name="subfields"/>
6948 <xsl:element name="marc:datafield">
6949 <xsl:attribute name="tag">
6950 <xsl:value-of select="$tag"/>
6952 <xsl:attribute name="ind1">
6953 <xsl:value-of select="$ind1"/>
6955 <xsl:attribute name="ind2">
6956 <xsl:value-of select="$ind2"/>
6958 <xsl:copy-of select="$subfields"/>
6962 <xsl:template name="subfieldSelect">
6963 <xsl:param name="codes">abcdefghijklmnopqrstuvwxyz</xsl:param>
6964 <xsl:param name="delimeter">
6965 <xsl:text> </xsl:text>
6967 <xsl:variable name="str">
6968 <xsl:for-each select="marc:subfield">
6969 <xsl:if test="contains($codes, @code)">
6970 <xsl:value-of select="text()"/>
6971 <xsl:value-of select="$delimeter"/>
6975 <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
6978 <xsl:template name="buildSpaces">
6979 <xsl:param name="spaces"/>
6980 <xsl:param name="char">
6981 <xsl:text> </xsl:text>
6983 <xsl:if test="$spaces>0">
6984 <xsl:value-of select="$char"/>
6985 <xsl:call-template name="buildSpaces">
6986 <xsl:with-param name="spaces" select="$spaces - 1"/>
6987 <xsl:with-param name="char" select="$char"/>
6988 </xsl:call-template>
6992 <xsl:template name="chopPunctuation">
6993 <xsl:param name="chopString"/>
6994 <xsl:param name="punctuation">
6995 <xsl:text>.:,;/ </xsl:text>
6997 <xsl:variable name="length" select="string-length($chopString)"/>
6999 <xsl:when test="$length=0"/>
7000 <xsl:when test="contains($punctuation, substring($chopString,$length,1))">
7001 <xsl:call-template name="chopPunctuation">
7002 <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
7003 <xsl:with-param name="punctuation" select="$punctuation"/>
7004 </xsl:call-template>
7006 <xsl:when test="not($chopString)"/>
7008 <xsl:value-of select="$chopString"/>
7013 <xsl:template name="chopPunctuationFront">
7014 <xsl:param name="chopString"/>
7015 <xsl:variable name="length" select="string-length($chopString)"/>
7017 <xsl:when test="$length=0"/>
7018 <xsl:when test="contains('.:,;/[ ', substring($chopString,1,1))">
7019 <xsl:call-template name="chopPunctuationFront">
7020 <xsl:with-param name="chopString" select="substring($chopString,2,$length - 1)"
7022 </xsl:call-template>
7024 <xsl:when test="not($chopString)"/>
7026 <xsl:value-of select="$chopString"/>
7031 <xsl:template name="chopPunctuationBack">
7032 <xsl:param name="chopString"/>
7033 <xsl:param name="punctuation">
7034 <xsl:text>.:,;/] </xsl:text>
7036 <xsl:variable name="length" select="string-length($chopString)"/>
7038 <xsl:when test="$length=0"/>
7039 <xsl:when test="contains($punctuation, substring($chopString,$length,1))">
7040 <xsl:call-template name="chopPunctuation">
7041 <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
7042 <xsl:with-param name="punctuation" select="$punctuation"/>
7043 </xsl:call-template>
7045 <xsl:when test="not($chopString)"/>
7047 <xsl:value-of select="$chopString"/>
7052 <!-- nate added 12/14/2007 for lccn.loc.gov: url encode ampersand, etc. -->
7053 <xsl:template name="url-encode">
7055 <xsl:param name="str"/>
7057 <xsl:if test="$str">
7058 <xsl:variable name="first-char" select="substring($str,1,1)"/>
7060 <xsl:when test="contains($safe,$first-char)">
7061 <xsl:value-of select="$first-char"/>
7064 <xsl:variable name="codepoint">
7066 <xsl:when test="contains($ascii,$first-char)">
7068 select="string-length(substring-before($ascii,$first-char)) + 32"
7071 <xsl:when test="contains($latin1,$first-char)">
7073 select="string-length(substring-before($latin1,$first-char)) + 160"/>
7077 <xsl:message terminate="no">Warning: string contains a character
7078 that is out of range! Substituting "?".</xsl:message>
7079 <xsl:text>63</xsl:text>
7083 <xsl:variable name="hex-digit1"
7084 select="substring($hex,floor($codepoint div 16) + 1,1)"/>
7085 <xsl:variable name="hex-digit2" select="substring($hex,$codepoint mod 16 + 1,1)"/>
7086 <!-- <xsl:value-of select="concat('%',$hex-digit2)"/> -->
7087 <xsl:value-of select="concat('%',$hex-digit1,$hex-digit2)"/>
7090 <xsl:if test="string-length($str) > 1">
7091 <xsl:call-template name="url-encode">
7092 <xsl:with-param name="str" select="substring($str,2)"/>
7093 </xsl:call-template>
7097 </xsl:stylesheet>$$ WHERE name = 'mods33';
7100 INSERT INTO config.global_flag (name, value, enabled, label) VALUES
7102 'opac.browse.warnable_regexp_per_class',
7103 '{"title": "^(a|the|an)\\s"}',
7106 'opac.browse.warnable_regexp_per_class',
7107 'Map of search classes to regular expressions to warn user about leading articles.',
7113 'opac.browse.holdings_visibility_test_limit',
7117 'opac.browse.holdings_visibility_test_limit',
7118 'Don''t look for more than this number of records with holdings when displaying browse headings with visible record counts.',
7124 ALTER TABLE metabib.browse_entry DROP CONSTRAINT browse_entry_value_key;
7125 ALTER TABLE metabib.browse_entry ADD COLUMN sort_value TEXT;
7126 DELETE FROM metabib.browse_entry_def_map; -- Yeah.
7127 DELETE FROM metabib.browse_entry WHERE sort_value IS NULL;
7128 ALTER TABLE metabib.browse_entry ALTER COLUMN sort_value SET NOT NULL;
7129 ALTER TABLE metabib.browse_entry ADD UNIQUE (sort_value, value);
7130 DROP TRIGGER IF EXISTS mbe_sort_value ON metabib.browse_entry;
7132 CREATE INDEX browse_entry_sort_value_idx
7133 ON metabib.browse_entry USING BTREE (sort_value);
7135 -- NOTE If I understand ordered indices correctly, an index on sort_value DESC
7136 -- is not actually needed, even though we do have a query that does ORDER BY
7137 -- on this column in that direction. The previous index serves for both
7138 -- directions, and ordering in an index is only helpful for multi-column
7139 -- indices, I think. See http://www.postgresql.org/docs/9.1/static/indexes-ordering.html
7141 -- CREATE INDEX CONCURRENTLY browse_entry_sort_value_idx_desc
7142 -- ON metabib.browse_entry USING BTREE (sort_value DESC);
7144 CREATE TYPE metabib.flat_browse_entry_appearance AS (
7145 browse_entry BIGINT,
7149 sources INT, -- visible ones, that is
7150 row_number INT, -- internal use, sort of
7151 accurate BOOL, -- Count in sources field is accurate? Not
7152 -- if we had more than a browse superpage
7153 -- of records to look at.
7158 CREATE OR REPLACE FUNCTION metabib.browse_pivot(
7161 ) RETURNS BIGINT AS $p$
7165 SELECT INTO id mbe.id FROM metabib.browse_entry mbe
7166 JOIN metabib.browse_entry_def_map mbedm ON (
7167 mbedm.entry = mbe.id AND
7168 mbedm.def = ANY(search_field)
7170 WHERE mbe.sort_value >= public.search_normalize(browse_term)
7171 ORDER BY mbe.sort_value, mbe.value LIMIT 1;
7175 $p$ LANGUAGE PLPGSQL;
7177 CREATE OR REPLACE FUNCTION metabib.staged_browse(
7181 context_locations INT[],
7183 browse_superpage_size INT,
7184 count_up_from_zero BOOL, -- if false, count down from -1
7187 ) RETURNS SETOF metabib.flat_browse_entry_appearance AS $p$
7192 result_row metabib.flat_browse_entry_appearance%ROWTYPE;
7193 results_skipped INT := 0;
7194 row_counter INT := 0;
7199 all_records BIGINT[];
7200 superpage_of_records BIGINT[];
7203 IF count_up_from_zero THEN
7209 OPEN curs FOR EXECUTE query;
7212 FETCH curs INTO rec;
7214 IF result_row.pivot_point IS NOT NULL THEN
7215 RETURN NEXT result_row;
7220 -- Gather aggregate data based on the MBE row we're looking at now
7221 SELECT INTO all_records, result_row.authorities, result_row.fields
7222 ARRAY_AGG(DISTINCT source),
7223 ARRAY_TO_STRING(ARRAY_AGG(DISTINCT authority), $$,$$),
7224 ARRAY_TO_STRING(ARRAY_AGG(DISTINCT def), $$,$$)
7225 FROM metabib.browse_entry_def_map
7226 WHERE entry = rec.id
7227 AND def = ANY(fields);
7229 result_row.sources := 0;
7231 full_end := ARRAY_LENGTH(all_records, 1);
7232 superpage_size := COALESCE(browse_superpage_size, full_end);
7234 slice_end := superpage_size;
7236 WHILE result_row.sources = 0 AND slice_start <= full_end LOOP
7237 superpage_of_records := all_records[slice_start:slice_end];
7239 'SELECT NULL::BIGINT AS id, ARRAY[r] AS records, ' ||
7240 '1::INT AS rel FROM (SELECT UNNEST(' ||
7241 quote_literal(superpage_of_records) || '::BIGINT[]) AS r) rr';
7243 -- We use search.query_parser_fts() for visibility testing.
7244 -- We're calling it once per browse-superpage worth of records
7245 -- out of the set of records related to a given mbe, until we've
7246 -- either exhausted that set of records or found at least 1
7249 SELECT INTO result_row.sources visible
7250 FROM search.query_parser_fts(
7251 context_org, NULL, qpfts_query, NULL,
7252 context_locations, 0, NULL, NULL, FALSE, staff, FALSE
7254 WHERE qpfts.rel IS NULL;
7256 slice_start := slice_start + superpage_size;
7257 slice_end := slice_end + superpage_size;
7260 -- Accurate? Well, probably.
7261 result_row.accurate := browse_superpage_size IS NULL OR
7262 browse_superpage_size >= full_end;
7264 IF result_row.sources > 0 THEN
7265 -- We've got a browse entry with visible holdings. Yay.
7268 -- The function that calls this function needs row_number in order
7269 -- to correctly order results from two different runs of this
7271 result_row.row_number := row_number;
7273 -- Now, if row_counter is still less than limit, return a row. If
7274 -- not, but it is less than next_pivot_pos, continue on without
7275 -- returning actual result rows until we find
7276 -- that next pivot, and return it.
7278 IF row_counter < result_limit THEN
7279 result_row.browse_entry := rec.id;
7280 result_row.value := rec.value;
7282 RETURN NEXT result_row;
7284 result_row.browse_entry := NULL;
7285 result_row.authorities := NULL;
7286 result_row.fields := NULL;
7287 result_row.value := NULL;
7288 result_row.sources := NULL;
7289 result_row.accurate := NULL;
7290 result_row.pivot_point := rec.id;
7292 IF row_counter >= next_pivot_pos THEN
7293 RETURN NEXT result_row;
7298 IF count_up_from_zero THEN
7299 row_number := row_number + 1;
7301 row_number := row_number - 1;
7304 -- row_counter is different from row_number.
7305 -- It simply counts up from zero so that we know when
7306 -- we've reached our limit.
7307 row_counter := row_counter + 1;
7311 $p$ LANGUAGE PLPGSQL;
7313 CREATE OR REPLACE FUNCTION metabib.browse(
7316 context_org INT DEFAULT NULL,
7317 context_loc_group INT DEFAULT NULL,
7318 staff BOOL DEFAULT FALSE,
7319 pivot_id BIGINT DEFAULT NULL,
7320 result_limit INT DEFAULT 10
7321 ) RETURNS SETOF metabib.flat_browse_entry_appearance AS $p$
7326 pivot_sort_value TEXT;
7327 pivot_sort_fallback TEXT;
7328 context_locations INT[];
7329 browse_superpage_size INT;
7330 results_skipped INT := 0;
7334 forward_to_pivot INT;
7336 -- First, find the pivot if we were given a browse term but not a pivot.
7337 IF pivot_id IS NULL THEN
7338 pivot_id := metabib.browse_pivot(search_field, browse_term);
7341 SELECT INTO pivot_sort_value, pivot_sort_fallback
7342 sort_value, value FROM metabib.browse_entry WHERE id = pivot_id;
7344 -- Bail if we couldn't find a pivot.
7345 IF pivot_sort_value IS NULL THEN
7349 -- Transform the context_loc_group argument (if any) (logc at the
7350 -- TPAC layer) into a form we'll be able to use.
7351 IF context_loc_group IS NOT NULL THEN
7352 SELECT INTO context_locations ARRAY_AGG(location)
7353 FROM asset.copy_location_group_map
7354 WHERE lgroup = context_loc_group;
7357 -- Get the configured size of browse superpages.
7358 SELECT INTO browse_superpage_size value -- NULL ok
7359 FROM config.global_flag
7360 WHERE enabled AND name = 'opac.browse.holdings_visibility_test_limit';
7362 -- First we're going to search backward from the pivot, then we're going
7363 -- to search forward. In each direction, we need two limits. At the
7364 -- lesser of the two limits, we delineate the edge of the result set
7365 -- we're going to return. At the greater of the two limits, we find the
7366 -- pivot value that would represent an offset from the current pivot
7367 -- at a distance of one "page" in either direction, where a "page" is a
7368 -- result set of the size specified in the "result_limit" argument.
7370 -- The two limits in each direction make four derived values in total,
7371 -- and we calculate them now.
7372 back_limit := CEIL(result_limit::FLOAT / 2);
7373 back_to_pivot := result_limit;
7374 forward_limit := result_limit / 2;
7375 forward_to_pivot := result_limit - 1;
7377 -- This is the meat of the SQL query that finds browse entries. We'll
7378 -- pass this to a function which uses it with a cursor, so that individual
7379 -- rows may be fetched in a loop until some condition is satisfied, without
7380 -- waiting for a result set of fixed size to be collected all at once.
7386 FROM metabib.browse_entry mbe
7387 WHERE EXISTS (SELECT 1 FROM metabib.browse_entry_def_map mbedm WHERE
7388 mbedm.entry = mbe.id AND
7389 mbedm.def = ANY(' || quote_literal(search_field) || ')
7392 -- This is the variant of the query for browsing backward.
7393 back_query := core_query ||
7394 ' mbe.sort_value <= ' || quote_literal(pivot_sort_value) ||
7395 ' ORDER BY mbe.sort_value DESC, mbe.value DESC ';
7397 -- This variant browses forward.
7398 forward_query := core_query ||
7399 ' mbe.sort_value > ' || quote_literal(pivot_sort_value) ||
7400 ' ORDER BY mbe.sort_value, mbe.value ';
7402 -- We now call the function which applies a cursor to the provided
7403 -- queries, stopping at the appropriate limits and also giving us
7404 -- the next page's pivot.
7406 SELECT * FROM metabib.staged_browse(
7407 back_query, search_field, context_org, context_locations,
7408 staff, browse_superpage_size, TRUE, back_limit, back_to_pivot
7410 SELECT * FROM metabib.staged_browse(
7411 forward_query, search_field, context_org, context_locations,
7412 staff, browse_superpage_size, FALSE, forward_limit, forward_to_pivot
7413 ) ORDER BY row_number DESC;
7416 $p$ LANGUAGE PLPGSQL;
7418 CREATE OR REPLACE FUNCTION metabib.browse(
7421 context_org INT DEFAULT NULL,
7422 context_loc_group INT DEFAULT NULL,
7423 staff BOOL DEFAULT FALSE,
7424 pivot_id BIGINT DEFAULT NULL,
7425 result_limit INT DEFAULT 10
7426 ) RETURNS SETOF metabib.flat_browse_entry_appearance AS $p$
7428 RETURN QUERY SELECT * FROM metabib.browse(
7429 (SELECT COALESCE(ARRAY_AGG(id), ARRAY[]::INT[])
7430 FROM config.metabib_field WHERE field_class = search_class),
7439 $p$ LANGUAGE PLPGSQL;
7441 UPDATE config.metabib_field
7443 xpath = $$//mods32:mods/mods32:relatedItem[@type="series"]/mods32:titleInfo[@type="nfi"]$$,
7444 browse_sort_xpath = $$*[local-name() != "nonSort"]$$,
7447 field_class = 'series' AND name = 'seriestitle' ;
7449 UPDATE config.metabib_field
7451 xpath = $$//mods32:mods/mods32:titleInfo[mods32:title and not (@type)]$$,
7452 browse_sort_xpath = $$*[local-name() != "nonSort"]$$,
7453 browse_xpath = NULL,
7456 field_class = 'title' AND name = 'proper' ;
7458 UPDATE config.metabib_field
7460 xpath = $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='alternative-nfi')]$$,
7461 browse_sort_xpath = $$*[local-name() != "nonSort"]$$,
7464 field_class = 'title' AND name = 'alternative' ;
7466 UPDATE config.metabib_field
7468 xpath = $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='uniform-nfi')]$$,
7469 browse_sort_xpath = $$*[local-name() != "nonSort"]$$,
7472 field_class = 'title' AND name = 'uniform' ;
7474 UPDATE config.metabib_field
7476 xpath = $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='translated-nfi')]$$,
7477 browse_sort_xpath = $$*[local-name() != "nonSort"]$$,
7480 field_class = 'title' AND name = 'translated' ;
7482 -- This keeps extra terms like "creator" out of browse headings.
7483 UPDATE config.metabib_field
7484 SET browse_xpath = $$//*[local-name()='namePart']$$ -- vim */
7487 browse_xpath IS NULL AND
7488 field_class = 'author';
7490 INSERT INTO config.org_unit_setting_type (
7491 name, label, grp, description, datatype
7493 'opac.browse.pager_shortcuts',
7494 'Paging shortcut links for OPAC Browse',
7496 'The characters in this string, in order, will be used as shortcut links for quick paging in the OPAC browse interface. Any sequence surrounded by asterisks will be taken as a whole label, not split into individual labels at the character level, but only the first character will serve as the basis of the search.',
7502 \qecho This is a browse-only reingest of your bib records. It may take a while.
7503 \qecho You may cancel now without losing the effect of the rest of the
7504 \qecho upgrade script, and arrange the reingest later.
7506 SELECT metabib.reingest_metabib_field_entries(id, TRUE, FALSE, TRUE)
7507 FROM biblio.record_entry;