1 --Upgrade Script for 3.8.0 to 3.8.1
2 \set eg_version '''3.8.1'''
4 INSERT INTO config.upgrade_log (version, applied_to) VALUES ('3.8.1', :eg_version);
6 SELECT evergreen.upgrade_deps_block_check('1309', :eg_version);
\r
8 ALTER TABLE asset.course_module_term
\r
9 DROP CONSTRAINT course_module_term_name_key;
\r
11 ALTER TABLE asset.course_module_term
\r
12 ADD CONSTRAINT cmt_once_per_owning_lib UNIQUE (owning_lib, name);
\r
15 SELECT evergreen.upgrade_deps_block_check('1311', :eg_version);
17 CREATE OR REPLACE FUNCTION biblio.extract_located_uris( bib_id BIGINT, marcxml TEXT, editor_id INT ) RETURNS VOID AS $func$
24 uri_owner_list TEXT[];
33 current_uri_map_list INT[];
34 current_map_owner_list INT[];
38 uris := oils_xpath('//*[@tag="856" and (@ind1="4" or @ind1="1") and (@ind2="0" or @ind2="1")]',marcxml);
39 IF ARRAY_UPPER(uris,1) > 0 THEN
40 FOR i IN 1 .. ARRAY_UPPER(uris, 1) LOOP
41 -- First we pull info out of the 856
44 uri_href := (oils_xpath('//*[@code="u"]/text()',uri_xml))[1];
45 uri_label := (oils_xpath('//*[@code="y"]/text()|//*[@code="3"]/text()',uri_xml))[1];
46 uri_use := (oils_xpath('//*[@code="z"]/text()|//*[@code="2"]/text()|//*[@code="n"]/text()',uri_xml))[1];
48 IF uri_label IS NULL THEN
49 uri_label := uri_href;
51 CONTINUE WHEN uri_href IS NULL;
53 -- Get the distinct list of libraries wanting to use
55 DISTINCT REGEXP_REPLACE(
57 $re$^.*?\((\w+)\).*$$re$,
63 '//*[@code="9"]/text()|//*[@code="w"]/text()|//*[@code="n"]/text()',
68 IF ARRAY_UPPER(uri_owner_list,1) > 0 THEN
70 -- look for a matching uri
71 IF uri_use IS NULL THEN
74 WHERE label = uri_label AND href = uri_href AND use_restriction IS NULL AND active
76 IF NOT FOUND THEN -- create one
77 INSERT INTO asset.uri (label, href, use_restriction) VALUES (uri_label, uri_href, uri_use);
80 WHERE label = uri_label AND href = uri_href AND use_restriction IS NULL AND active;
85 WHERE label = uri_label AND href = uri_href AND use_restriction = uri_use AND active
87 IF NOT FOUND THEN -- create one
88 INSERT INTO asset.uri (label, href, use_restriction) VALUES (uri_label, uri_href, uri_use);
91 WHERE label = uri_label AND href = uri_href AND use_restriction = uri_use AND active;
95 FOR j IN 1 .. ARRAY_UPPER(uri_owner_list, 1) LOOP
96 uri_owner := uri_owner_list[j];
98 SELECT id INTO uri_owner_id FROM actor.org_unit WHERE shortname = BTRIM(REPLACE(uri_owner,chr(160),''));
99 CONTINUE WHEN NOT FOUND;
101 -- we need a call number to link through
102 SELECT id INTO uri_cn_id FROM asset.call_number WHERE owning_lib = uri_owner_id AND record = bib_id AND label = '##URI##' AND NOT deleted;
104 INSERT INTO asset.call_number (owning_lib, record, create_date, edit_date, creator, editor, label)
105 VALUES (uri_owner_id, bib_id, 'now', 'now', editor_id, editor_id, '##URI##');
106 SELECT id INTO uri_cn_id FROM asset.call_number WHERE owning_lib = uri_owner_id AND record = bib_id AND label = '##URI##' AND NOT deleted;
109 -- now, link them if they're not already
110 SELECT id INTO uri_map_id FROM asset.uri_call_number_map WHERE call_number = uri_cn_id AND uri = uri_id;
112 INSERT INTO asset.uri_call_number_map (call_number, uri) VALUES (uri_cn_id, uri_id);
113 SELECT id INTO uri_map_id FROM asset.uri_call_number_map WHERE call_number = uri_cn_id AND uri = uri_id;
116 current_uri_map_list := current_uri_map_list || uri_map_id;
117 current_map_owner_list := current_map_owner_list || uri_cn_id;
126 -- Clear any orphaned URIs, URI mappings and call
127 -- numbers for this bib that weren't mapped above.
130 FROM asset.uri_call_number_map m
131 LEFT JOIN asset.call_number cn ON (cn.id = m.call_number)
132 WHERE cn.record = bib_id
133 AND cn.label = '##URI##'
134 AND (NOT (m.id = ANY (current_uri_map_list))
135 OR current_uri_map_list is NULL)
137 SELECT uri INTO current_uri FROM asset.uri_call_number_map WHERE id = current_map;
138 DELETE FROM asset.uri_call_number_map WHERE id = current_map;
140 SELECT COUNT(*) INTO uri_map_count FROM asset.uri_call_number_map WHERE uri = current_uri;
141 IF uri_map_count = 0 THEN
142 DELETE FROM asset.uri WHERE id = current_uri;
146 UPDATE asset.call_number
147 SET deleted = TRUE, edit_date = now(), editor = editor_id
150 FROM asset.call_number
151 WHERE record = bib_id
152 AND label = '##URI##'
154 AND (NOT (id = ANY (current_map_owner_list))
155 OR current_map_owner_list is NULL)
160 $func$ LANGUAGE PLPGSQL;
162 -- Remove existing orphaned URIs from the database.
163 DELETE FROM asset.uri
168 LEFT JOIN asset.uri_call_number_map
169 ON uri_call_number_map.uri = uri.id
170 LEFT JOIN serial.item
172 WHERE uri_call_number_map IS NULL
178 SELECT evergreen.upgrade_deps_block_check('1312', :eg_version);
180 CREATE INDEX aum_editor ON actor.usr_message (editor);
183 SELECT evergreen.upgrade_deps_block_check('1313', :eg_version); -- alynn26
185 INSERT INTO config.workstation_setting_type (name, grp, datatype, label)
187 'eg.grid.cat.bucket.batch_hold.view', 'gui', 'object',
189 'eg.grid.cat.bucket.batch_hold.view',
190 'Grid Config: eg.grid.cat.bucket.batch_hold.view',
194 'eg.grid.cat.bucket.batch_hold.pending', 'gui', 'object',
196 'eg.grid.cat.bucket.batch_hold.pending',
197 'Grid Config: eg.grid.cat.bucket.batch_hold.pending',
201 'eg.grid.cat.bucket.batch_hold.events', 'gui', 'object',
203 'eg.grid.cat.bucket.batch_hold.events',
204 'Grid Config: eg.grid.cat.bucket.batch_hold.events',
208 'eg.grid.cat.bucket.batch_hold.list', 'gui', 'object',
210 'eg.grid.cat.bucket.batch_hold.list',
211 'Grid Config: eg.grid.cat.bucket.batch_hold.list',
217 SELECT evergreen.upgrade_deps_block_check('1319', :eg_version);
222 PERFORM TRUE FROM config.usr_setting_type WHERE name = 'cat.copy.templates';
224 IF NOT FOUND THEN -- no matching user setting
226 PERFORM TRUE FROM config.workstation_setting_type WHERE name = 'cat.copy.templates';
229 -- no matching workstation setting
230 -- Migrate the existing user setting and its data to the new name.
232 UPDATE config.usr_setting_type
233 SET name = 'cat.copy.templates'
234 WHERE name = 'webstaff.cat.copy.templates';
236 UPDATE actor.usr_setting
237 SET name = 'cat.copy.templates'
238 WHERE name = 'webstaff.cat.copy.templates';
248 SELECT evergreen.upgrade_deps_block_check('1325', :eg_version);
250 UPDATE config.xml_transform SET xslt=$XSLT$<?xml version="1.0" encoding="UTF-8"?>
251 <xsl:stylesheet version="1.0" xmlns:mads="http://www.loc.gov/mads/v2"
252 xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:marc="http://www.loc.gov/MARC21/slim"
253 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="marc">
254 <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
255 <xsl:strip-space elements="*"/>
257 <xsl:variable name="ascii">
258 <xsl:text> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~</xsl:text>
261 <xsl:variable name="latin1">
262 <xsl:text> ¡¢£¤¥¦§¨©ª«¬
\ad®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ</xsl:text>
264 <!-- Characters that usually don't need to be escaped -->
265 <xsl:variable name="safe">
266 <xsl:text>!'()*-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~</xsl:text>
269 <xsl:variable name="hex">0123456789ABCDEF</xsl:variable>
272 <xsl:template name="datafield">
273 <xsl:param name="tag"/>
274 <xsl:param name="ind1">
275 <xsl:text> </xsl:text>
277 <xsl:param name="ind2">
278 <xsl:text> </xsl:text>
280 <xsl:param name="subfields"/>
281 <xsl:element name="marc:datafield">
282 <xsl:attribute name="tag">
283 <xsl:value-of select="$tag"/>
285 <xsl:attribute name="ind1">
286 <xsl:value-of select="$ind1"/>
288 <xsl:attribute name="ind2">
289 <xsl:value-of select="$ind2"/>
291 <xsl:copy-of select="$subfields"/>
295 <xsl:template name="subfieldSelect">
296 <xsl:param name="codes">abcdefghijklmnopqrstuvwxyz</xsl:param>
297 <xsl:param name="delimeter">
298 <xsl:text> </xsl:text>
300 <xsl:variable name="str">
301 <xsl:for-each select="marc:subfield">
302 <xsl:if test="contains($codes, @code)">
303 <xsl:value-of select="text()"/>
304 <xsl:value-of select="$delimeter"/>
308 <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
311 <xsl:template name="buildSpaces">
312 <xsl:param name="spaces"/>
313 <xsl:param name="char">
314 <xsl:text> </xsl:text>
316 <xsl:if test="$spaces>0">
317 <xsl:value-of select="$char"/>
318 <xsl:call-template name="buildSpaces">
319 <xsl:with-param name="spaces" select="$spaces - 1"/>
320 <xsl:with-param name="char" select="$char"/>
325 <xsl:template name="chopPunctuation">
326 <xsl:param name="chopString"/>
327 <xsl:param name="punctuation">
328 <xsl:text>.:,;/ </xsl:text>
330 <xsl:variable name="length" select="string-length($chopString)"/>
332 <xsl:when test="$length=0"/>
333 <xsl:when test="contains($punctuation, substring($chopString,$length,1))">
334 <xsl:call-template name="chopPunctuation">
335 <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
336 <xsl:with-param name="punctuation" select="$punctuation"/>
339 <xsl:when test="not($chopString)"/>
341 <xsl:value-of select="$chopString"/>
346 <xsl:template name="chopPunctuationFront">
347 <xsl:param name="chopString"/>
348 <xsl:variable name="length" select="string-length($chopString)"/>
350 <xsl:when test="$length=0"/>
351 <xsl:when test="contains('.:,;/[ ', substring($chopString,1,1))">
352 <xsl:call-template name="chopPunctuationFront">
353 <xsl:with-param name="chopString" select="substring($chopString,2,$length - 1)"
357 <xsl:when test="not($chopString)"/>
359 <xsl:value-of select="$chopString"/>
364 <xsl:template name="chopPunctuationBack">
365 <xsl:param name="chopString"/>
366 <xsl:param name="punctuation">
367 <xsl:text>.:,;/] </xsl:text>
369 <xsl:variable name="length" select="string-length($chopString)"/>
371 <xsl:when test="$length=0"/>
372 <xsl:when test="contains($punctuation, substring($chopString,$length,1))">
373 <xsl:call-template name="chopPunctuation">
374 <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
375 <xsl:with-param name="punctuation" select="$punctuation"/>
378 <xsl:when test="not($chopString)"/>
380 <xsl:value-of select="$chopString"/>
385 <!-- nate added 12/14/2007 for lccn.loc.gov: url encode ampersand, etc. -->
386 <xsl:template name="url-encode">
388 <xsl:param name="str"/>
391 <xsl:variable name="first-char" select="substring($str,1,1)"/>
393 <xsl:when test="contains($safe,$first-char)">
394 <xsl:value-of select="$first-char"/>
397 <xsl:variable name="codepoint">
399 <xsl:when test="contains($ascii,$first-char)">
401 select="string-length(substring-before($ascii,$first-char)) + 32"
404 <xsl:when test="contains($latin1,$first-char)">
406 select="string-length(substring-before($latin1,$first-char)) + 160"/>
410 <xsl:message terminate="no">Warning: string contains a character
411 that is out of range! Substituting "?".</xsl:message>
412 <xsl:text>63</xsl:text>
416 <xsl:variable name="hex-digit1"
417 select="substring($hex,floor($codepoint div 16) + 1,1)"/>
418 <xsl:variable name="hex-digit2" select="substring($hex,$codepoint mod 16 + 1,1)"/>
419 <!-- <xsl:value-of select="concat('%',$hex-digit2)"/> -->
420 <xsl:value-of select="concat('%',$hex-digit1,$hex-digit2)"/>
423 <xsl:if test="string-length($str) > 1">
424 <xsl:call-template name="url-encode">
425 <xsl:with-param name="str" select="substring($str,2)"/>
433 2.15 reversed genre and setAuthority template order under relatedTypeAttribute tmee 11/13/2018
434 2.14 Fixed bug in mads:geographic attributes syntax ws 05/04/2016
435 2.13 fixed repeating <geographic> tmee 01/31/2014
436 2.12 added $2 authority for <classification> tmee 09/18/2012
437 2.11 added delimiters between <classification> subfields tmee 09/18/2012
438 2.10 fixed type="other" and type="otherType" for mads:related tmee 09/16/2011
439 2.09 fixed professionTerm and genreTerm empty tag error tmee 09/16/2011
440 2.08 fixed marc:subfield @code='i' matching error tmee 09/16/2011
441 2.07 fixed 555 duplication error tmee 08/10/2011
442 2.06 fixed topic subfield error tmee 08/10/2011
443 2.05 fixed title subfield error tmee 06/20/2011
444 2.04 fixed geographicSubdivision mapping for authority element tmee 06/16/2011
445 2.03 added classification for 053, 055, 060, 065, 070, 080, 082, 083, 086, 087 tmee 06/03/2011
446 2.02 added descriptionStandard for 008/10 tmee 04/27/2011
447 2.01 added extensions for 046, 336, 370, 374, 375, 376 tmee 04/08/2011
448 2.00 redefined imported MODS elements in version 1.0 to MADS elements in version 2.0 tmee 02/08/2011
449 1.08 added 372 subfields $a $s $t for <fieldOfActivity> tmee 06/24/2010
450 1.07 removed role/roleTerm 100, 110, 111, 400, 410, 411, 500, 510, 511, 700, 710, 711 tmee 06/24/2010
451 1.06 added strip-space tmee 06/24/2010
452 1.05 added subfield $a for 130, 430, 530 tmee 06/21/2010
453 1.04 fixed 550 z omission ntra 08/11/2008
454 1.03 removed duplication of 550 $a text tmee 11/01/2006
455 1.02 fixed namespace references between mads and mods ntra 10/06/2006
456 1.01 revised rgue/jrad 11/29/05
457 1.00 adapted from MARC21Slim2MODS3.xsl ntra 07/06/05
460 <!-- authority attribute defaults to 'naf' if not set using this authority parameter, for <authority> descriptors: name, titleInfo, geographic -->
461 <xsl:param name="authority"/>
462 <xsl:variable name="auth">
464 <xsl:when test="$authority">
465 <xsl:value-of select="$authority"/>
467 <xsl:otherwise>naf</xsl:otherwise>
470 <xsl:variable name="controlField008" select="marc:controlfield[@tag='008']"/>
471 <xsl:variable name="controlField008-06"
472 select="substring(descendant-or-self::marc:controlfield[@tag=008],7,1)"/>
473 <xsl:variable name="controlField008-11"
474 select="substring(descendant-or-self::marc:controlfield[@tag=008],12,1)"/>
475 <xsl:variable name="controlField008-14"
476 select="substring(descendant-or-self::marc:controlfield[@tag=008],15,1)"/>
477 <xsl:template match="/">
479 <xsl:when test="descendant-or-self::marc:collection">
480 <mads:madsCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
481 xsi:schemaLocation="http://www.loc.gov/mads/v2 http://www.loc.gov/standards/mads/v2/mads-2-0.xsd">
482 <xsl:for-each select="descendant-or-self::marc:collection/marc:record">
483 <mads:mads version="2.0">
484 <xsl:call-template name="marcRecord"/>
487 </mads:madsCollection>
490 <mads:mads version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
491 xsi:schemaLocation="http://www.loc.gov/mads/v2 http://www.loc.gov/standards/mads/mads-2-0.xsd">
492 <xsl:for-each select="descendant-or-self::marc:record">
493 <xsl:call-template name="marcRecord"/>
500 <xsl:template name="marcRecord">
504 <xsl:when test="$controlField008-06='d'">
505 <xsl:attribute name="geographicSubdivision">
506 <xsl:text>direct</xsl:text>
509 <xsl:when test="$controlField008-06='i'">
510 <xsl:attribute name="geographicSubdivision">
511 <xsl:text>indirect</xsl:text>
514 <xsl:when test="$controlField008-06='n'">
515 <xsl:attribute name="geographicSubdivision">
516 <xsl:text>not applicable</xsl:text>
521 <xsl:apply-templates select="marc:datafield[100 <= @tag and @tag < 200]"/>
526 select="marc:datafield[500 <= @tag and @tag <= 585]|marc:datafield[700 <= @tag and @tag <= 785]"/>
529 <xsl:apply-templates select="marc:datafield[400 <= @tag and @tag <= 485]"/>
532 <xsl:apply-templates select="marc:datafield[667 <= @tag and @tag <= 688]"/>
535 <xsl:apply-templates select="marc:datafield[@tag=856]"/>
536 <xsl:apply-templates select="marc:datafield[@tag=010]"/>
537 <xsl:apply-templates select="marc:datafield[@tag=024]"/>
538 <xsl:apply-templates select="marc:datafield[@tag=372]"/>
540 <!-- classification -->
541 <xsl:apply-templates select="marc:datafield[@tag=053]"/>
542 <xsl:apply-templates select="marc:datafield[@tag=055]"/>
543 <xsl:apply-templates select="marc:datafield[@tag=060]"/>
544 <xsl:apply-templates select="marc:datafield[@tag=065]"/>
545 <xsl:apply-templates select="marc:datafield[@tag=070]"/>
546 <xsl:apply-templates select="marc:datafield[@tag=080]"/>
547 <xsl:apply-templates select="marc:datafield[@tag=082]"/>
548 <xsl:apply-templates select="marc:datafield[@tag=083]"/>
549 <xsl:apply-templates select="marc:datafield[@tag=086]"/>
550 <xsl:apply-templates select="marc:datafield[@tag=087]"/>
553 <xsl:for-each select="marc:datafield[@tag=373]">
556 <xsl:value-of select="marc:subfield[@code='a']"/>
558 <mads:dateValid point="start">
559 <xsl:value-of select="marc:subfield[@code='s']"/>
561 <mads:dateValid point="end">
562 <xsl:value-of select="marc:subfield[@code='t']"/>
566 <xsl:for-each select="marc:datafield[@tag=371]">
570 <xsl:value-of select="marc:subfield[@code='a']"/>
573 <xsl:value-of select="marc:subfield[@code='b']"/>
576 <xsl:value-of select="marc:subfield[@code='c']"/>
579 <xsl:value-of select="marc:subfield[@code='d']"/>
582 <xsl:value-of select="marc:subfield[@code='e']"/>
586 <xsl:value-of select="marc:subfield[@code='m']"/>
592 <xsl:for-each select="marc:datafield[@tag=336]">
595 <mads:contentType type="text">
596 <xsl:value-of select="marc:subfield[@code='a']"/>
598 <mads:contentType type="code">
599 <xsl:value-of select="marc:subfield[@code='b']"/>
605 <xsl:for-each select="marc:datafield[@tag=374]">
609 <xsl:when test="marc:subfield[@code='a']">
610 <mads:professionTerm>
611 <xsl:value-of select="marc:subfield[@code='a']"/>
612 </mads:professionTerm>
614 <xsl:when test="marc:subfield[@code='s']">
615 <mads:dateValid point="start">
616 <xsl:value-of select="marc:subfield[@code='s']"/>
619 <xsl:when test="marc:subfield[@code='t']">
620 <mads:dateValid point="end">
621 <xsl:value-of select="marc:subfield[@code='t']"/>
629 <xsl:for-each select="marc:datafield[@tag=375]">
633 <xsl:when test="marc:subfield[@code='a']">
635 <xsl:value-of select="marc:subfield[@code='a']"/>
638 <xsl:when test="marc:subfield[@code='s']">
639 <mads:dateValid point="start">
640 <xsl:value-of select="marc:subfield[@code='s']"/>
643 <xsl:when test="marc:subfield[@code='t']">
644 <mads:dateValid point="end">
645 <xsl:value-of select="marc:subfield[@code='t']"/>
653 <xsl:for-each select="marc:datafield[@tag=376]">
655 <mads:familyInformation>
657 <xsl:value-of select="marc:subfield[@code='a']"/>
659 <mads:nameOfProminentMember>
660 <xsl:value-of select="marc:subfield[@code='b']"/>
661 </mads:nameOfProminentMember>
662 <mads:hereditaryTitle>
663 <xsl:value-of select="marc:subfield[@code='c']"/>
664 </mads:hereditaryTitle>
665 <mads:dateValid point="start">
666 <xsl:value-of select="marc:subfield[@code='s']"/>
668 <mads:dateValid point="end">
669 <xsl:value-of select="marc:subfield[@code='t']"/>
671 </mads:familyInformation>
676 <mads:recordOrigin>Converted from MARCXML to MADS version 2.0 (Revision 2.13)</mads:recordOrigin>
677 <!-- <xsl:apply-templates select="marc:datafield[@tag=024]"/> -->
679 <xsl:apply-templates select="marc:datafield[@tag=040]/marc:subfield[@code='a']"/>
680 <xsl:apply-templates select="marc:controlfield[@tag=005]"/>
681 <xsl:apply-templates select="marc:controlfield[@tag=001]"/>
682 <xsl:apply-templates select="marc:datafield[@tag=040]/marc:subfield[@code='b']"/>
683 <xsl:apply-templates select="marc:datafield[@tag=040]/marc:subfield[@code='e']"/>
684 <xsl:for-each select="marc:controlfield[@tag=008]">
685 <xsl:if test="substring(.,11,1)='a'">
686 <mads:descriptionStandard>
687 <xsl:text>earlier rules</xsl:text>
688 </mads:descriptionStandard>
690 <xsl:if test="substring(.,11,1)='b'">
691 <mads:descriptionStandard>
692 <xsl:text>aacr1</xsl:text>
693 </mads:descriptionStandard>
695 <xsl:if test="substring(.,11,1)='c'">
696 <mads:descriptionStandard>
697 <xsl:text>aacr2</xsl:text>
698 </mads:descriptionStandard>
700 <xsl:if test="substring(.,11,1)='d'">
701 <mads:descriptionStandard>
702 <xsl:text>aacr2 compatible</xsl:text>
703 </mads:descriptionStandard>
705 <xsl:if test="substring(.,11,1)='z'">
706 <mads:descriptionStandard>
707 <xsl:text>other rules</xsl:text>
708 </mads:descriptionStandard>
714 <!-- start of secondary templates -->
716 <!-- ======== xlink ======== -->
718 <!-- <xsl:template name="uri">
719 <xsl:for-each select="marc:subfield[@code='0']">
720 <xsl:attribute name="xlink:href">
721 <xsl:value-of select="."/>
726 <xsl:template match="marc:subfield[@code='i']">
727 <xsl:attribute name="otherType">
728 <xsl:value-of select="."/>
732 <!-- No role/roleTerm mapped in MADS 06/24/2010
733 <xsl:template name="role">
734 <xsl:for-each select="marc:subfield[@code='e']">
736 <mads:roleTerm type="text">
737 <xsl:value-of select="."/>
744 <xsl:template name="part">
745 <xsl:variable name="partNumber">
746 <xsl:call-template name="specialSubfieldSelect">
747 <xsl:with-param name="axis">n</xsl:with-param>
748 <xsl:with-param name="anyCodes">n</xsl:with-param>
749 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
752 <xsl:variable name="partName">
753 <xsl:call-template name="specialSubfieldSelect">
754 <xsl:with-param name="axis">p</xsl:with-param>
755 <xsl:with-param name="anyCodes">p</xsl:with-param>
756 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
759 <xsl:if test="string-length(normalize-space($partNumber))">
761 <xsl:call-template name="chopPunctuation">
762 <xsl:with-param name="chopString" select="$partNumber"/>
766 <xsl:if test="string-length(normalize-space($partName))">
768 <xsl:call-template name="chopPunctuation">
769 <xsl:with-param name="chopString" select="$partName"/>
775 <xsl:template name="nameABCDN">
776 <xsl:for-each select="marc:subfield[@code='a']">
778 <xsl:call-template name="chopPunctuation">
779 <xsl:with-param name="chopString" select="."/>
783 <xsl:for-each select="marc:subfield[@code='b']">
785 <xsl:value-of select="."/>
789 test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
791 <xsl:call-template name="subfieldSelect">
792 <xsl:with-param name="codes">cdn</xsl:with-param>
798 <xsl:template name="nameABCDQ">
800 <xsl:call-template name="chopPunctuation">
801 <xsl:with-param name="chopString">
802 <xsl:call-template name="subfieldSelect">
803 <xsl:with-param name="codes">aq</xsl:with-param>
808 <xsl:call-template name="termsOfAddress"/>
809 <xsl:call-template name="nameDate"/>
812 <xsl:template name="nameACDENQ">
814 <xsl:call-template name="subfieldSelect">
815 <xsl:with-param name="codes">acdenq</xsl:with-param>
820 <xsl:template name="nameDate">
821 <xsl:for-each select="marc:subfield[@code='d']">
822 <mads:namePart type="date">
823 <xsl:call-template name="chopPunctuation">
824 <xsl:with-param name="chopString" select="."/>
830 <xsl:template name="specialSubfieldSelect">
831 <xsl:param name="anyCodes"/>
832 <xsl:param name="axis"/>
833 <xsl:param name="beforeCodes"/>
834 <xsl:param name="afterCodes"/>
835 <xsl:variable name="str">
836 <xsl:for-each select="marc:subfield">
838 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])">
839 <xsl:value-of select="text()"/>
840 <xsl:text> </xsl:text>
844 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
847 <xsl:template name="termsOfAddress">
848 <xsl:if test="marc:subfield[@code='b' or @code='c']">
849 <mads:namePart type="termsOfAddress">
850 <xsl:call-template name="chopPunctuation">
851 <xsl:with-param name="chopString">
852 <xsl:call-template name="subfieldSelect">
853 <xsl:with-param name="codes">bc</xsl:with-param>
861 <xsl:template name="displayLabel">
862 <xsl:if test="marc:subfield[@code='z']">
863 <xsl:attribute name="displayLabel">
864 <xsl:value-of select="marc:subfield[@code='z']"/>
867 <xsl:if test="marc:subfield[@code='3']">
868 <xsl:attribute name="displayLabel">
869 <xsl:value-of select="marc:subfield[@code='3']"/>
874 <xsl:template name="isInvalid">
875 <xsl:if test="@code='z'">
876 <xsl:attribute name="invalid">yes</xsl:attribute>
880 <xsl:template name="sub2Attribute">
882 <xsl:if test="../marc:subfield[@code='2']">
883 <xsl:attribute name="type">
884 <xsl:value-of select="../marc:subfield[@code='2']"/>
889 <xsl:template match="marc:controlfield[@tag=001]">
890 <mads:recordIdentifier>
891 <xsl:if test="../marc:controlfield[@tag=003]">
892 <xsl:attribute name="source">
893 <xsl:value-of select="../marc:controlfield[@tag=003]"/>
896 <xsl:value-of select="."/>
897 </mads:recordIdentifier>
900 <xsl:template match="marc:controlfield[@tag=005]">
901 <mads:recordChangeDate encoding="iso8601">
902 <xsl:value-of select="."/>
903 </mads:recordChangeDate>
906 <xsl:template match="marc:controlfield[@tag=008]">
907 <mads:recordCreationDate encoding="marc">
908 <xsl:value-of select="substring(.,1,6)"/>
909 </mads:recordCreationDate>
912 <xsl:template match="marc:datafield[@tag=010]">
913 <xsl:for-each select="marc:subfield">
914 <mads:identifier type="lccn">
915 <xsl:call-template name="isInvalid"/>
916 <xsl:value-of select="."/>
921 <xsl:template match="marc:datafield[@tag=024]">
922 <xsl:for-each select="marc:subfield[not(@code=2)]">
924 <xsl:call-template name="isInvalid"/>
925 <xsl:call-template name="sub2Attribute"/>
926 <xsl:value-of select="."/>
931 <!-- ========== 372 ========== -->
932 <xsl:template match="marc:datafield[@tag=372]">
933 <mads:fieldOfActivity>
934 <xsl:call-template name="subfieldSelect">
935 <xsl:with-param name="codes">a</xsl:with-param>
937 <xsl:text>-</xsl:text>
938 <xsl:call-template name="subfieldSelect">
939 <xsl:with-param name="codes">st</xsl:with-param>
941 </mads:fieldOfActivity>
945 <!-- ========== 040 ========== -->
946 <xsl:template match="marc:datafield[@tag=040]/marc:subfield[@code='a']">
947 <mads:recordContentSource authority="marcorg">
948 <xsl:value-of select="."/>
949 </mads:recordContentSource>
952 <xsl:template match="marc:datafield[@tag=040]/marc:subfield[@code='b']">
953 <mads:languageOfCataloging>
954 <mads:languageTerm authority="iso639-2b" type="code">
955 <xsl:value-of select="."/>
957 </mads:languageOfCataloging>
960 <xsl:template match="marc:datafield[@tag=040]/marc:subfield[@code='e']">
961 <mads:descriptionStandard>
962 <xsl:value-of select="."/>
963 </mads:descriptionStandard>
966 <!-- ========== classification 2.03 ========== -->
968 <xsl:template match="marc:datafield[@tag=053]">
969 <mads:classification>
970 <xsl:call-template name="subfieldSelect">
971 <xsl:with-param name="codes">abcdxyz</xsl:with-param>
972 <xsl:with-param name="delimeter">-</xsl:with-param>
974 </mads:classification>
977 <xsl:template match="marc:datafield[@tag=055]">
978 <mads:classification>
979 <xsl:call-template name="subfieldSelect">
980 <xsl:with-param name="codes">abcdxyz</xsl:with-param>
981 <xsl:with-param name="delimeter">-</xsl:with-param>
983 </mads:classification>
986 <xsl:template match="marc:datafield[@tag=060]">
987 <mads:classification>
988 <xsl:call-template name="subfieldSelect">
989 <xsl:with-param name="codes">abcdxyz</xsl:with-param>
990 <xsl:with-param name="delimeter">-</xsl:with-param>
992 </mads:classification>
994 <xsl:template match="marc:datafield[@tag=065]">
995 <mads:classification>
996 <xsl:attribute name="authority">
997 <xsl:value-of select="marc:subfield[@code='2']"/>
999 <xsl:call-template name="subfieldSelect">
1000 <xsl:with-param name="codes">abcdxyz</xsl:with-param>
1001 <xsl:with-param name="delimeter">-</xsl:with-param>
1002 </xsl:call-template>
1003 </mads:classification>
1005 <xsl:template match="marc:datafield[@tag=070]">
1006 <mads:classification>
1007 <xsl:call-template name="subfieldSelect">
1008 <xsl:with-param name="codes">abcdxyz5</xsl:with-param>
1009 <xsl:with-param name="delimeter">-</xsl:with-param>
1010 </xsl:call-template>
1011 </mads:classification>
1013 <xsl:template match="marc:datafield[@tag=080]">
1014 <mads:classification>
1015 <xsl:attribute name="authority">
1016 <xsl:value-of select="marc:subfield[@code='2']"/>
1018 <xsl:call-template name="subfieldSelect">
1019 <xsl:with-param name="codes">abcdxyz5</xsl:with-param>
1020 <xsl:with-param name="delimeter">-</xsl:with-param>
1021 </xsl:call-template>
1022 </mads:classification>
1024 <xsl:template match="marc:datafield[@tag=082]">
1025 <mads:classification>
1026 <xsl:attribute name="authority">
1027 <xsl:value-of select="marc:subfield[@code='2']"/>
1029 <xsl:call-template name="subfieldSelect">
1030 <xsl:with-param name="codes">abcdxyz5</xsl:with-param>
1031 <xsl:with-param name="delimeter">-</xsl:with-param>
1032 </xsl:call-template>
1033 </mads:classification>
1035 <xsl:template match="marc:datafield[@tag=083]">
1036 <mads:classification>
1037 <xsl:attribute name="authority">
1038 <xsl:value-of select="marc:subfield[@code='2']"/>
1040 <xsl:call-template name="subfieldSelect">
1041 <xsl:with-param name="codes">abcdxyz5</xsl:with-param>
1042 <xsl:with-param name="delimeter">-</xsl:with-param>
1043 </xsl:call-template>
1044 </mads:classification>
1046 <xsl:template match="marc:datafield[@tag=086]">
1047 <mads:classification>
1048 <xsl:attribute name="authority">
1049 <xsl:value-of select="marc:subfield[@code='2']"/>
1051 <xsl:call-template name="subfieldSelect">
1052 <xsl:with-param name="codes">abcdxyz5</xsl:with-param>
1053 <xsl:with-param name="delimeter">-</xsl:with-param>
1054 </xsl:call-template>
1055 </mads:classification>
1057 <xsl:template match="marc:datafield[@tag=087]">
1058 <mads:classification>
1059 <xsl:attribute name="authority">
1060 <xsl:value-of select="marc:subfield[@code='2']"/>
1062 <xsl:call-template name="subfieldSelect">
1063 <xsl:with-param name="codes">abcdxyz5</xsl:with-param>
1064 <xsl:with-param name="delimeter">-</xsl:with-param>
1065 </xsl:call-template>
1066 </mads:classification>
1070 <!-- ========== names ========== -->
1071 <xsl:template match="marc:datafield[@tag=100]">
1072 <mads:name type="personal">
1073 <xsl:call-template name="setAuthority"/>
1074 <xsl:call-template name="nameABCDQ"/>
1076 <xsl:apply-templates select="*[marc:subfield[not(contains('abcdeq',@code))]]"/>
1077 <xsl:call-template name="title"/>
1078 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1081 <xsl:template match="marc:datafield[@tag=110]">
1082 <mads:name type="corporate">
1083 <xsl:call-template name="setAuthority"/>
1084 <xsl:call-template name="nameABCDN"/>
1086 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1089 <xsl:template match="marc:datafield[@tag=111]">
1090 <mads:name type="conference">
1091 <xsl:call-template name="setAuthority"/>
1092 <xsl:call-template name="nameACDENQ"/>
1094 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1097 <xsl:template match="marc:datafield[@tag=400]">
1099 <xsl:call-template name="variantTypeAttribute"/>
1100 <mads:name type="personal">
1101 <xsl:call-template name="nameABCDQ"/>
1103 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1104 <xsl:call-template name="title"/>
1108 <xsl:template match="marc:datafield[@tag=410]">
1110 <xsl:call-template name="variantTypeAttribute"/>
1111 <mads:name type="corporate">
1112 <xsl:call-template name="nameABCDN"/>
1114 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1118 <xsl:template match="marc:datafield[@tag=411]">
1120 <xsl:call-template name="variantTypeAttribute"/>
1121 <mads:name type="conference">
1122 <xsl:call-template name="nameACDENQ"/>
1124 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1128 <xsl:template match="marc:datafield[@tag=500]|marc:datafield[@tag=700]">
1130 <xsl:call-template name="relatedTypeAttribute"/>
1131 <!-- <xsl:call-template name="uri"/> -->
1132 <mads:name type="personal">
1133 <xsl:call-template name="setAuthority"/>
1134 <xsl:call-template name="nameABCDQ"/>
1136 <xsl:call-template name="title"/>
1137 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1141 <xsl:template match="marc:datafield[@tag=510]|marc:datafield[@tag=710]">
1143 <xsl:call-template name="relatedTypeAttribute"/>
1144 <!-- <xsl:call-template name="uri"/> -->
1145 <mads:name type="corporate">
1146 <xsl:call-template name="setAuthority"/>
1147 <xsl:call-template name="nameABCDN"/>
1149 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1153 <xsl:template match="marc:datafield[@tag=511]|marc:datafield[@tag=711]">
1155 <xsl:call-template name="relatedTypeAttribute"/>
1156 <!-- <xsl:call-template name="uri"/> -->
1157 <mads:name type="conference">
1158 <xsl:call-template name="setAuthority"/>
1159 <xsl:call-template name="nameACDENQ"/>
1161 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1165 <!-- ========== titles ========== -->
1166 <xsl:template match="marc:datafield[@tag=130]">
1167 <xsl:call-template name="uniform-title"/>
1168 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1171 <xsl:template match="marc:datafield[@tag=430]">
1173 <xsl:call-template name="variantTypeAttribute"/>
1174 <xsl:call-template name="uniform-title"/>
1175 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1179 <xsl:template match="marc:datafield[@tag=530]|marc:datafield[@tag=730]">
1181 <xsl:call-template name="relatedTypeAttribute"/>
1182 <xsl:call-template name="uniform-title"/>
1183 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1187 <xsl:template name="title">
1188 <xsl:variable name="hasTitle">
1189 <xsl:for-each select="marc:subfield">
1190 <xsl:if test="(contains('tfghklmors',@code) )">
1191 <xsl:value-of select="@code"/>
1195 <xsl:if test="string-length($hasTitle) > 0 ">
1197 <xsl:call-template name="setAuthority"/>
1199 <xsl:variable name="str">
1200 <xsl:for-each select="marc:subfield">
1201 <xsl:if test="(contains('atfghklmors',@code) )">
1202 <xsl:value-of select="text()"/>
1203 <xsl:text> </xsl:text>
1207 <xsl:call-template name="chopPunctuation">
1208 <xsl:with-param name="chopString">
1209 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1211 </xsl:call-template>
1213 <xsl:call-template name="part"/>
1214 <!-- <xsl:call-template name="uri"/> -->
1219 <xsl:template name="uniform-title">
1220 <xsl:variable name="hasTitle">
1221 <xsl:for-each select="marc:subfield">
1222 <xsl:if test="(contains('atfghklmors',@code) )">
1223 <xsl:value-of select="@code"/>
1227 <xsl:if test="string-length($hasTitle) > 0 ">
1229 <xsl:call-template name="setAuthority"/>
1231 <xsl:variable name="str">
1232 <xsl:for-each select="marc:subfield">
1233 <xsl:if test="(contains('adfghklmors',@code) )">
1234 <xsl:value-of select="text()"/>
1235 <xsl:text> </xsl:text>
1239 <xsl:call-template name="chopPunctuation">
1240 <xsl:with-param name="chopString">
1241 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1243 </xsl:call-template>
1245 <xsl:call-template name="part"/>
1246 <!-- <xsl:call-template name="uri"/> -->
1252 <!-- ========== topics ========== -->
1253 <xsl:template match="marc:subfield[@code='x']">
1255 <xsl:call-template name="chopPunctuation">
1256 <xsl:with-param name="chopString">
1257 <xsl:value-of select="."/>
1259 </xsl:call-template>
1265 match="marc:datafield[@tag=150][marc:subfield[@code='a' or @code='b']]|marc:datafield[@tag=180][marc:subfield[@code='x']]">
1266 <xsl:call-template name="topic"/>
1267 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1270 match="marc:datafield[@tag=450][marc:subfield[@code='a' or @code='b']]|marc:datafield[@tag=480][marc:subfield[@code='x']]">
1272 <xsl:call-template name="variantTypeAttribute"/>
1273 <xsl:call-template name="topic"/>
1277 match="marc:datafield[@tag=550 or @tag=750][marc:subfield[@code='a' or @code='b']]">
1279 <xsl:call-template name="relatedTypeAttribute"/>
1280 <!-- <xsl:call-template name="uri"/> -->
1281 <xsl:call-template name="topic"/>
1282 <xsl:apply-templates select="marc:subfield[@code='z']"/>
1285 <xsl:template name="topic">
1287 <xsl:call-template name="setAuthority"/>
1288 <!-- tmee2006 dedupe 550a
1289 <xsl:if test="@tag=550 or @tag=750">
1290 <xsl:call-template name="subfieldSelect">
1291 <xsl:with-param name="codes">ab</xsl:with-param>
1292 </xsl:call-template>
1296 <xsl:when test="@tag=180 or @tag=480 or @tag=580 or @tag=780">
1297 <xsl:call-template name="chopPunctuation">
1298 <xsl:with-param name="chopString">
1299 <xsl:apply-templates select="marc:subfield[@code='x']"/>
1301 </xsl:call-template>
1304 <xsl:call-template name="chopPunctuation">
1305 <xsl:with-param name="chopString">
1307 <xsl:when test="@tag=180 or @tag=480 or @tag=580 or @tag=780">
1308 <xsl:apply-templates select="marc:subfield[@code='x']"/>
1311 <xsl:call-template name="subfieldSelect">
1312 <xsl:with-param name="codes">ab</xsl:with-param>
1313 </xsl:call-template>
1317 </xsl:call-template>
1321 <!-- ========= temporals ========== -->
1322 <xsl:template match="marc:subfield[@code='y']">
1324 <xsl:call-template name="chopPunctuation">
1325 <xsl:with-param name="chopString">
1326 <xsl:value-of select="."/>
1328 </xsl:call-template>
1332 match="marc:datafield[@tag=148][marc:subfield[@code='a']]|marc:datafield[@tag=182 ][marc:subfield[@code='y']]">
1333 <xsl:call-template name="temporal"/>
1336 match="marc:datafield[@tag=448][marc:subfield[@code='a']]|marc:datafield[@tag=482][marc:subfield[@code='y']]">
1338 <xsl:call-template name="variantTypeAttribute"/>
1339 <xsl:call-template name="temporal"/>
1343 match="marc:datafield[@tag=548 or @tag=748][marc:subfield[@code='a']]|marc:datafield[@tag=582 or @tag=782][marc:subfield[@code='y']]">
1345 <xsl:call-template name="relatedTypeAttribute"/>
1346 <!-- <xsl:call-template name="uri"/> -->
1347 <xsl:call-template name="temporal"/>
1350 <xsl:template name="temporal">
1352 <xsl:call-template name="setAuthority"/>
1353 <xsl:if test="@tag=548 or @tag=748">
1354 <xsl:value-of select="marc:subfield[@code='a']"/>
1356 <xsl:call-template name="chopPunctuation">
1357 <xsl:with-param name="chopString">
1359 <xsl:when test="@tag=182 or @tag=482 or @tag=582 or @tag=782">
1360 <xsl:apply-templates select="marc:subfield[@code='y']"/>
1363 <xsl:value-of select="marc:subfield[@code='a']"/>
1367 </xsl:call-template>
1369 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1372 <!-- ========== genre ========== -->
1373 <xsl:template match="marc:subfield[@code='v']">
1375 <xsl:call-template name="chopPunctuation">
1376 <xsl:with-param name="chopString">
1377 <xsl:value-of select="."/>
1379 </xsl:call-template>
1383 match="marc:datafield[@tag=155][marc:subfield[@code='a']]|marc:datafield[@tag=185][marc:subfield[@code='v']]">
1384 <xsl:call-template name="genre"/>
1387 match="marc:datafield[@tag=455][marc:subfield[@code='a']]|marc:datafield[@tag=485 ][marc:subfield[@code='v']]">
1389 <xsl:call-template name="variantTypeAttribute"/>
1390 <xsl:call-template name="genre"/>
1394 <xsl:template match="marc:datafield[@tag=555]">
1396 <xsl:call-template name="relatedTypeAttribute"/>
1397 <xsl:call-template name="uri"/>
1398 <xsl:call-template name="genre"/>
1403 match="marc:datafield[@tag=555 or @tag=755][marc:subfield[@code='a']]|marc:datafield[@tag=585][marc:subfield[@code='v']]">
1405 <xsl:call-template name="relatedTypeAttribute"/>
1406 <xsl:call-template name="genre"/>
1409 <xsl:template name="genre">
1411 <xsl:if test="@tag=555">
1412 <xsl:value-of select="marc:subfield[@code='a']"/>
1414 <xsl:call-template name="setAuthority"/>
1415 <xsl:call-template name="chopPunctuation">
1416 <xsl:with-param name="chopString">
1419 <xsl:when test="@tag='555'"/>
1420 <xsl:when test="@tag=185 or @tag=485 or @tag=585">
1421 <xsl:apply-templates select="marc:subfield[@code='v']"/>
1424 <xsl:value-of select="marc:subfield[@code='a']"/>
1428 </xsl:call-template>
1430 <xsl:apply-templates/>
1433 <!-- ========= geographic ========== -->
1434 <xsl:template match="marc:subfield[@code='z']">
1436 <xsl:call-template name="chopPunctuation">
1437 <xsl:with-param name="chopString">
1438 <xsl:value-of select="."/>
1440 </xsl:call-template>
1443 <xsl:template name="geographic">
1446 <xsl:call-template name="setAuthority"/>
1448 <xsl:if test="@tag=151 or @tag=551">
1449 <xsl:value-of select="marc:subfield[@code='a']"/>
1451 <xsl:call-template name="chopPunctuation">
1452 <xsl:with-param name="chopString">
1453 <xsl:if test="@tag=181 or @tag=481 or @tag=581">
1454 <xsl:apply-templates select="marc:subfield[@code='z']"/>
1458 <xsl:when test="@tag=181 or @tag=481 or @tag=581">
1459 <xsl:apply-templates select="marc:subfield[@code='z']"/>
1463 <xsl:value-of select="marc:subfield[@code='a']"/>
1468 </xsl:call-template>
1470 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1473 match="marc:datafield[@tag=151][marc:subfield[@code='a']]|marc:datafield[@tag=181][marc:subfield[@code='z']]">
1474 <xsl:call-template name="geographic"/>
1477 match="marc:datafield[@tag=451][marc:subfield[@code='a']]|marc:datafield[@tag=481][marc:subfield[@code='z']]">
1479 <xsl:call-template name="variantTypeAttribute"/>
1480 <xsl:call-template name="geographic"/>
1484 match="marc:datafield[@tag=551]|marc:datafield[@tag=581][marc:subfield[@code='z']]">
1486 <xsl:call-template name="relatedTypeAttribute"/>
1487 <!-- <xsl:call-template name="uri"/> -->
1488 <xsl:call-template name="geographic"/>
1491 <xsl:template match="marc:datafield[@tag=580]">
1493 <xsl:call-template name="relatedTypeAttribute"/>
1494 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1498 match="marc:datafield[@tag=751][marc:subfield[@code='z']]|marc:datafield[@tag=781][marc:subfield[@code='z']]">
1500 <xsl:call-template name="relatedTypeAttribute"/>
1501 <xsl:call-template name="geographic"/>
1504 <xsl:template match="marc:datafield[@tag=755]">
1506 <xsl:call-template name="relatedTypeAttribute"/>
1507 <xsl:call-template name="setAuthority"/>
1508 <xsl:call-template name="genre"/>
1509 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1512 <xsl:template match="marc:datafield[@tag=780]">
1514 <xsl:call-template name="relatedTypeAttribute"/>
1515 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1518 <xsl:template match="marc:datafield[@tag=785]">
1520 <xsl:call-template name="relatedTypeAttribute"/>
1521 <xsl:apply-templates select="marc:subfield[@code!='i']"/>
1525 <!-- ========== notes ========== -->
1526 <xsl:template match="marc:datafield[667 <= @tag and @tag <= 688]">
1529 <xsl:when test="@tag=667">
1530 <xsl:attribute name="type">nonpublic</xsl:attribute>
1532 <xsl:when test="@tag=670">
1533 <xsl:attribute name="type">source</xsl:attribute>
1535 <xsl:when test="@tag=675">
1536 <xsl:attribute name="type">notFound</xsl:attribute>
1538 <xsl:when test="@tag=678">
1539 <xsl:attribute name="type">history</xsl:attribute>
1541 <xsl:when test="@tag=681">
1542 <xsl:attribute name="type">subject example</xsl:attribute>
1544 <xsl:when test="@tag=682">
1545 <xsl:attribute name="type">deleted heading information</xsl:attribute>
1547 <xsl:when test="@tag=688">
1548 <xsl:attribute name="type">application history</xsl:attribute>
1551 <xsl:call-template name="chopPunctuation">
1552 <xsl:with-param name="chopString">
1554 <xsl:when test="@tag=667 or @tag=675">
1555 <xsl:value-of select="marc:subfield[@code='a']"/>
1557 <xsl:when test="@tag=670 or @tag=678">
1558 <xsl:call-template name="subfieldSelect">
1559 <xsl:with-param name="codes">ab</xsl:with-param>
1560 </xsl:call-template>
1562 <xsl:when test="680 <= @tag and @tag <=688">
1563 <xsl:call-template name="subfieldSelect">
1564 <xsl:with-param name="codes">ai</xsl:with-param>
1565 </xsl:call-template>
1569 </xsl:call-template>
1573 <!-- ========== url ========== -->
1574 <xsl:template match="marc:datafield[@tag=856][marc:subfield[@code='u']]">
1576 <xsl:if test="marc:subfield[@code='z' or @code='3']">
1577 <xsl:attribute name="displayLabel">
1578 <xsl:call-template name="subfieldSelect">
1579 <xsl:with-param name="codes">z3</xsl:with-param>
1580 </xsl:call-template>
1583 <xsl:value-of select="marc:subfield[@code='u']"/>
1587 <xsl:template name="relatedTypeAttribute">
1590 test="@tag=500 or @tag=510 or @tag=511 or @tag=548 or @tag=550 or @tag=551 or @tag=555 or @tag=580 or @tag=581 or @tag=582 or @tag=585">
1591 <xsl:if test="substring(marc:subfield[@code='w'],1,1)='a'">
1592 <xsl:attribute name="type">earlier</xsl:attribute>
1594 <xsl:if test="substring(marc:subfield[@code='w'],1,1)='b'">
1595 <xsl:attribute name="type">later</xsl:attribute>
1597 <xsl:if test="substring(marc:subfield[@code='w'],1,1)='t'">
1598 <xsl:attribute name="type">parentOrg</xsl:attribute>
1600 <xsl:if test="substring(marc:subfield[@code='w'],1,1)='g'">
1601 <xsl:attribute name="type">broader</xsl:attribute>
1603 <xsl:if test="substring(marc:subfield[@code='w'],1,1)='h'">
1604 <xsl:attribute name="type">narrower</xsl:attribute>
1606 <xsl:if test="substring(marc:subfield[@code='w'],1,1)='r'">
1607 <xsl:attribute name="type">other</xsl:attribute>
1609 <xsl:if test="contains('fin|', substring(marc:subfield[@code='w'],1,1))">
1610 <xsl:attribute name="type">other</xsl:attribute>
1613 <xsl:when test="@tag=530 or @tag=730">
1614 <xsl:attribute name="type">other</xsl:attribute>
1618 <xsl:attribute name="type">equivalent</xsl:attribute>
1621 <xsl:apply-templates select="marc:subfield[@code='i']"/>
1626 <xsl:template name="variantTypeAttribute">
1629 test="@tag=400 or @tag=410 or @tag=411 or @tag=451 or @tag=455 or @tag=480 or @tag=481 or @tag=482 or @tag=485">
1630 <xsl:if test="substring(marc:subfield[@code='w'],1,1)='d'">
1631 <xsl:attribute name="type">acronym</xsl:attribute>
1633 <xsl:if test="substring(marc:subfield[@code='w'],1,1)='n'">
1634 <xsl:attribute name="type">other</xsl:attribute>
1636 <xsl:if test="contains('fit', substring(marc:subfield[@code='w'],1,1))">
1637 <xsl:attribute name="type">other</xsl:attribute>
1642 <xsl:attribute name="type">other</xsl:attribute>
1645 <xsl:apply-templates select="marc:subfield[@code='i']"/>
1648 <xsl:template name="setAuthority">
1650 <!-- can be called from the datafield or subfield level, so "..//@tag" means
1651 the tag can be at the subfield's parent level or at the datafields own level -->
1654 test="ancestor-or-self::marc:datafield/@tag=100 and (@ind1=0 or @ind1=1) and $controlField008-11='a' and $controlField008-14='a'">
1655 <xsl:attribute name="authority">
1656 <xsl:text>naf</xsl:text>
1660 test="ancestor-or-self::marc:datafield/@tag=100 and (@ind1=0 or @ind1=1) and $controlField008-11='a' and $controlField008-14='b'">
1661 <xsl:attribute name="authority">
1662 <xsl:text>lcsh</xsl:text>
1666 test="ancestor-or-self::marc:datafield/@tag=100 and (@ind1=0 or @ind1=1) and $controlField008-11='k'">
1667 <xsl:attribute name="authority">
1668 <xsl:text>lacnaf</xsl:text>
1672 test="ancestor-or-self::marc:datafield/@tag=100 and @ind1=3 and $controlField008-11='a' and $controlField008-14='b'">
1673 <xsl:attribute name="authority">
1674 <xsl:text>lcsh</xsl:text>
1678 test="ancestor-or-self::marc:datafield/@tag=100 and @ind1=3 and $controlField008-11='k' and $controlField008-14='b'">
1679 <xsl:attribute name="authority">cash</xsl:attribute>
1682 test="ancestor-or-self::marc:datafield/@tag=110 and $controlField008-11='a' and $controlField008-14='a'">
1683 <xsl:attribute name="authority">naf</xsl:attribute>
1686 test="ancestor-or-self::marc:datafield/@tag=110 and $controlField008-11='a' and $controlField008-14='b'">
1687 <xsl:attribute name="authority">lcsh</xsl:attribute>
1690 test="ancestor-or-self::marc:datafield/@tag=110 and $controlField008-11='k' and $controlField008-14='a'">
1691 <xsl:attribute name="authority">
1692 <xsl:text>lacnaf</xsl:text>
1696 test="ancestor-or-self::marc:datafield/@tag=110 and $controlField008-11='k' and $controlField008-14='b'">
1697 <xsl:attribute name="authority">
1698 <xsl:text>cash</xsl:text>
1702 test="100 <= ancestor-or-self::marc:datafield/@tag and ancestor-or-self::marc:datafield/@tag <= 155 and $controlField008-11='b'">
1703 <xsl:attribute name="authority">
1704 <xsl:text>lcshcl</xsl:text>
1708 test="(ancestor-or-self::marc:datafield/@tag=100 or ancestor-or-self::marc:datafield/@tag=110 or ancestor-or-self::marc:datafield/@tag=111 or ancestor-or-self::marc:datafield/@tag=130 or ancestor-or-self::marc:datafield/@tag=151) and $controlField008-11='c'">
1709 <xsl:attribute name="authority">
1710 <xsl:text>nlmnaf</xsl:text>
1714 test="(ancestor-or-self::marc:datafield/@tag=100 or ancestor-or-self::marc:datafield/@tag=110 or ancestor-or-self::marc:datafield/@tag=111 or ancestor-or-self::marc:datafield/@tag=130 or ancestor-or-self::marc:datafield/@tag=151) and $controlField008-11='d'">
1715 <xsl:attribute name="authority">
1716 <xsl:text>nalnaf</xsl:text>
1720 test="100 <= ancestor-or-self::marc:datafield/@tag and ancestor-or-self::marc:datafield/@tag <= 155 and $controlField008-11='r'">
1721 <xsl:attribute name="authority">
1722 <xsl:text>aat</xsl:text>
1726 test="100 <= ancestor-or-self::marc:datafield/@tag and ancestor-or-self::marc:datafield/@tag <= 155 and $controlField008-11='s'">
1727 <xsl:attribute name="authority">sears</xsl:attribute>
1730 test="100 <= ancestor-or-self::marc:datafield/@tag and ancestor-or-self::marc:datafield/@tag <= 155 and $controlField008-11='v'">
1731 <xsl:attribute name="authority">rvm</xsl:attribute>
1734 test="100 <= ancestor-or-self::marc:datafield/@tag and ancestor-or-self::marc:datafield/@tag <= 155 and $controlField008-11='z'">
1735 <xsl:attribute name="authority">
1737 select="../marc:datafield[ancestor-or-self::marc:datafield/@tag=040]/marc:subfield[@code='f']"
1742 test="(ancestor-or-self::marc:datafield/@tag=111 or ancestor-or-self::marc:datafield/@tag=130) and $controlField008-11='a' and $controlField008-14='a'">
1743 <xsl:attribute name="authority">
1744 <xsl:text>naf</xsl:text>
1748 test="(ancestor-or-self::marc:datafield/@tag=111 or ancestor-or-self::marc:datafield/@tag=130) and $controlField008-11='a' and $controlField008-14='b'">
1749 <xsl:attribute name="authority">
1750 <xsl:text>lcsh</xsl:text>
1754 test="(ancestor-or-self::marc:datafield/@tag=111 or ancestor-or-self::marc:datafield/@tag=130) and $controlField008-11='k' ">
1755 <xsl:attribute name="authority">
1756 <xsl:text>lacnaf</xsl:text>
1760 test="(ancestor-or-self::marc:datafield/@tag=148 or ancestor-or-self::marc:datafield/@tag=150 or ancestor-or-self::marc:datafield/@tag=155) and $controlField008-11='a' ">
1761 <xsl:attribute name="authority">
1762 <xsl:text>lcsh</xsl:text>
1766 test="(ancestor-or-self::marc:datafield/@tag=148 or ancestor-or-self::marc:datafield/@tag=150 or ancestor-or-self::marc:datafield/@tag=155) and $controlField008-11='a' ">
1767 <xsl:attribute name="authority">
1768 <xsl:text>lcsh</xsl:text>
1772 test="(ancestor-or-self::marc:datafield/@tag=148 or ancestor-or-self::marc:datafield/@tag=150 or ancestor-or-self::marc:datafield/@tag=155) and $controlField008-11='c' ">
1773 <xsl:attribute name="authority">
1774 <xsl:text>mesh</xsl:text>
1778 test="(ancestor-or-self::marc:datafield/@tag=148 or ancestor-or-self::marc:datafield/@tag=150 or ancestor-or-self::marc:datafield/@tag=155) and $controlField008-11='d' ">
1779 <xsl:attribute name="authority">
1780 <xsl:text>nal</xsl:text>
1784 test="(ancestor-or-self::marc:datafield/@tag=148 or ancestor-or-self::marc:datafield/@tag=150 or ancestor-or-self::marc:datafield/@tag=155) and $controlField008-11='k' ">
1785 <xsl:attribute name="authority">
1786 <xsl:text>cash</xsl:text>
1790 test="ancestor-or-self::marc:datafield/@tag=151 and $controlField008-11='a' and $controlField008-14='a'">
1791 <xsl:attribute name="authority">
1792 <xsl:text>naf</xsl:text>
1796 test="ancestor-or-self::marc:datafield/@tag=151 and $controlField008-11='a' and $controlField008-14='b'">
1797 <xsl:attribute name="authority">lcsh</xsl:attribute>
1800 test="ancestor-or-self::marc:datafield/@tag=151 and $controlField008-11='k' and $controlField008-14='a'">
1801 <xsl:attribute name="authority">lacnaf</xsl:attribute>
1804 test="ancestor-or-self::marc:datafield/@tag=151 and $controlField008-11='k' and $controlField008-14='b'">
1805 <xsl:attribute name="authority">cash</xsl:attribute>
1808 test="(..//ancestor-or-self::marc:datafield/@tag=180 or ..//ancestor-or-self::marc:datafield/@tag=181 or ..//ancestor-or-self::marc:datafield/@tag=182 or ..//ancestor-or-self::marc:datafield/@tag=185) and $controlField008-11='a'">
1809 <xsl:attribute name="authority">lcsh</xsl:attribute>
1812 test="ancestor-or-self::marc:datafield/@tag=700 and (@ind1='0' or @ind1='1') and @ind2='0'">
1813 <xsl:attribute name="authority">naf</xsl:attribute>
1816 test="ancestor-or-self::marc:datafield/@tag=700 and (@ind1='0' or @ind1='1') and @ind2='5'">
1817 <xsl:attribute name="authority">lacnaf</xsl:attribute>
1819 <xsl:when test="ancestor-or-self::marc:datafield/@tag=700 and @ind1='3' and @ind2='0'">
1820 <xsl:attribute name="authority">lcsh</xsl:attribute>
1822 <xsl:when test="ancestor-or-self::marc:datafield/@tag=700 and @ind1='3' and @ind2='5'">
1823 <xsl:attribute name="authority">cash</xsl:attribute>
1826 test="(700 <= ancestor-or-self::marc:datafield/@tag and ancestor-or-self::marc:datafield/@tag <= 755 ) and @ind2='1'">
1827 <xsl:attribute name="authority">lcshcl</xsl:attribute>
1830 test="(ancestor-or-self::marc:datafield/@tag=700 or ancestor-or-self::marc:datafield/@tag=710 or ancestor-or-self::marc:datafield/@tag=711 or ancestor-or-self::marc:datafield/@tag=730 or ancestor-or-self::marc:datafield/@tag=751) and @ind2='2'">
1831 <xsl:attribute name="authority">nlmnaf</xsl:attribute>
1834 test="(ancestor-or-self::marc:datafield/@tag=700 or ancestor-or-self::marc:datafield/@tag=710 or ancestor-or-self::marc:datafield/@tag=711 or ancestor-or-self::marc:datafield/@tag=730 or ancestor-or-self::marc:datafield/@tag=751) and @ind2='3'">
1835 <xsl:attribute name="authority">nalnaf</xsl:attribute>
1838 test="(700 <= ancestor-or-self::marc:datafield/@tag and ancestor-or-self::marc:datafield/@tag <= 755 ) and @ind2='6'">
1839 <xsl:attribute name="authority">rvm</xsl:attribute>
1842 test="(700 <= ancestor-or-self::marc:datafield/@tag and ancestor-or-self::marc:datafield/@tag <= 755 ) and @ind2='7'">
1843 <xsl:attribute name="authority">
1844 <xsl:value-of select="marc:subfield[@code='2']"/>
1848 test="(ancestor-or-self::marc:datafield/@tag=710 or ancestor-or-self::marc:datafield/@tag=711 or ancestor-or-self::marc:datafield/@tag=730 or ancestor-or-self::marc:datafield/@tag=751) and @ind2='5'">
1849 <xsl:attribute name="authority">lacnaf</xsl:attribute>
1852 test="(ancestor-or-self::marc:datafield/@tag=710 or ancestor-or-self::marc:datafield/@tag=711 or ancestor-or-self::marc:datafield/@tag=730 or ancestor-or-self::marc:datafield/@tag=751) and @ind2='0'">
1853 <xsl:attribute name="authority">naf</xsl:attribute>
1856 test="(ancestor-or-self::marc:datafield/@tag=748 or ancestor-or-self::marc:datafield/@tag=750 or ancestor-or-self::marc:datafield/@tag=755) and @ind2='0'">
1857 <xsl:attribute name="authority">lcsh</xsl:attribute>
1860 test="(ancestor-or-self::marc:datafield/@tag=748 or ancestor-or-self::marc:datafield/@tag=750 or ancestor-or-self::marc:datafield/@tag=755) and @ind2='2'">
1861 <xsl:attribute name="authority">mesh</xsl:attribute>
1864 test="(ancestor-or-self::marc:datafield/@tag=748 or ancestor-or-self::marc:datafield/@tag=750 or ancestor-or-self::marc:datafield/@tag=755) and @ind2='3'">
1865 <xsl:attribute name="authority">nal</xsl:attribute>
1868 test="(ancestor-or-self::marc:datafield/@tag=748 or ancestor-or-self::marc:datafield/@tag=750 or ancestor-or-self::marc:datafield/@tag=755) and @ind2='5'">
1869 <xsl:attribute name="authority">cash</xsl:attribute>
1873 <xsl:template match="*"/>
1874 </xsl:stylesheet>$XSLT$ WHERE name = 'mads21';
1878 -- Update auditor tables to catch changes to source tables.
1879 -- Can be removed/skipped if there were no schema changes.
1880 SELECT auditor.update_auditors();