diff --git a/bin/slubsipbuilder.pl b/bin/slubsipbuilder.pl deleted file mode 100755 index 2e0366445e4c6bbf278b2b0450eb9eba1a41233f..0000000000000000000000000000000000000000 --- a/bin/slubsipbuilder.pl +++ /dev/null @@ -1,690 +0,0 @@ -#!/usr/bin/env perl -#=============================================================================== -# -# FILE: slubsipbuilder.pl -# -# USAGE: ./slubsipbuilder.pl -# -# DESCRIPTION: A CLI tool to create a valid SIP for SLUBArchiv -# -# REQUIREMENTS: --- -# BUGS: --- -# NOTES: related to official document -# "SIP Spezifikation (v1.5)" -# AUTHOR: Andreas Romeyke (romeyke@slub-dresden.de) -# ORGANIZATION: SLUB -# VERSION: 1.1 -# CREATED: 2019-07-23 -#=============================================================================== - - -use strict; -use warnings; -use Carp; -use 5.28.0; -package SLUB::LZA::SIPBuilder; - use DateTime::Format::ISO8601; - use File::Copy qw(cp); - use File::Find; - use Path::Tiny; - use LWP::UserAgent; # to get MARC data - use MARC::Record; - use XML::LibXML; - use XML::LibXSLT; - use XML::XPath; - use Carp; - use Encode; - - my $marc_mods_url = 'http://www.loc.gov/standards/mods/v3/MARC21slim2MODS3-6.xsl'; - my $marc_utils_url = 'http://www.loc.gov/standards/marcxml/xslt/MARC21slimUtils.xsl'; - my $swb_url = 'https://sru.bsz-bw.de/swb'; - my $searchkey = "pica.swn"; - my $recordschema = "marcxmlvbos"; - our $VERSION = '1.2'; - our $with_debug=0; - - - # write data to file (UTF-8) - sub write_file($$) { - if(! defined $_[0]) { croak "filename not defined!"; } - if(! defined $_[1]) { croak "value not defined!"; } - if($_[0] eq "" || $_[1] eq ""){ - die "invalid parameters."; - } - my $filename = $_[0]; - my $value = $_[1]; - open(my $fh, '>:encoding(UTF-8)', $filename) || (croak "Can't open '$filename', $!"); - print $fh $value; - close($fh) || (croak "could not close file '$filename', $!"); - return 1; - } - - # this will patch the mods-xml as a workaround for bugs in LOCs xslt files - sub patch_mods($) { - if(! defined $_[0]) { croak "modsobject not defined!"; } - if($_[0] eq ""){ die "invalid parameters."; } - my $modsobj = shift; # mods expected as XML Parser object - # TODO: Bugfix for /mets:mets/mets:dmdSec[1]/mets:mdWrap[1]/mets:xmlData[1]/mods:modsCollection[1]/mods:mods[1]/mods:relatedItem[2]/mods:internetMediaType[1] - my $xslt_patch_string = <<'PATCH'; -<?xml version="1.0" encoding="UTF-8"?> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:xs="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:mods="http://www.loc.gov/mods/v3" - xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-6.xsd" - exclude-result-prefixes="xs" - version="1.0"> - <xsl:output encoding="UTF-8" indent="yes" method="xml"/> - <xsl:strip-space elements="*"/> - <xsl:template match="//mods:mods/mods:relatedItem[mods:internetMediaType]"> - <xsl:comment>patched wrong //mods:mods/mods:relatedItem[mods:internetMediaType]</xsl:comment> - </xsl:template> - <xsl:template match="@* | node()"> - <xsl:copy> - <xsl:apply-templates select="@* | node()"/> - </xsl:copy> - </xsl:template> -</xsl:stylesheet> -PATCH - my $xslt = XML::LibXSLT->new(); - my $xslt_patch = XML::LibXML->load_xml(string => $xslt_patch_string, no_cdata => 1); - my $stylesheet = $xslt->parse_stylesheet($xslt_patch); - my $result = $stylesheet->transform($modsobj); - return $result; - } - - sub patch_marc_response($) { - if(! defined $_[0]) { croak "marcobject not defined!"; } - if($_[0] eq ""){ die "invalid parameters."; } - my $marcobj = shift; # marcobj expected as XML Parser object - my $xslt_patch_string = <<'PATCH2'; -<?xml version="1.0" encoding="UTF-8"?> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.loc.gov/MARC21/slim" xmlns:srw="http://www.loc.gov/zing/srw/" - exclude-result-prefixes="srw" version="1.0"> - <xsl:template match="/record"> - <xsl:element name="collection"> - <xsl:element name="record" namespace="http://www.loc.gov/MARC21/slim"> - <xsl:apply-templates select="@*"/> - <xsl:apply-templates select="node()"/> - </xsl:element> - </xsl:element> - </xsl:template> - <xsl:template match="*"> - <xsl:element name="{local-name()}" namespace="http://www.loc.gov/MARC21/slim"> - <xsl:apply-templates select="node() | @*"/> - </xsl:element> - </xsl:template> - <xsl:template match="@*"> - <xsl:attribute name="{local-name()}"> - <xsl:value-of select="."/> - </xsl:attribute> - </xsl:template> -</xsl:stylesheet> -PATCH2 - my $xslt = XML::LibXSLT->new(); - my $xslt_patch = XML::LibXML->load_xml(string => $xslt_patch_string, no_cdata => 1); - my $stylesheet = $xslt->parse_stylesheet($xslt_patch); - my $result = $stylesheet->transform($marcobj); - return $result; - } - - # check MARC21 utility xsl - sub check_marc21_utility { - if(! defined $_[0]) { croak "xsl directory not defined!"; } - if(! defined $_[1]) { croak "user agent not defined!"; } - if($_[0] eq "" || $_[1] eq ""){ - die "invalid parameters."; - } - my $xsl_dir = shift; - my $ua = shift; - my $marc_utils_basename = path($marc_utils_url)->basename; - my $marc_utils_path = path($xsl_dir)->child($marc_utils_basename); - if (!$marc_utils_path->is_file) { - say "Downloading MARC21 utility xsl '$marc_utils_url'"; - my $result = $ua->get($marc_utils_url); - if ($result->is_error) { - croak "Failed to download '$marc_utils_url', " . $result->error_as_HTML; - } - say "Saving MARC21 utility xsl to file '$marc_utils_path'"; - my $xsl = $result->decoded_content; - write_file($marc_utils_path, $xsl); - } - return $marc_utils_path; - } - - # check MARC21->MODS xsl - sub check_marc21_mods_xsl { - if(! defined $_[0]) { croak "xsl directory not defined!"; } - if(! defined $_[1]) { croak "user agent not defined!"; } - if($_[0] eq "" || $_[1] eq ""){ - die "invalid parameters."; - } - my $xsl_dir = shift; - my $ua = shift; - my $marc_mods_basename = path($marc_mods_url)->basename; - my $marc_mods_path = path($xsl_dir)->child($marc_mods_basename)->stringify; - my $marc_mods_patched_basename = path($marc_mods_url)->basename(".xsl") . ".patched.xsl"; - my $marc_mods_patched_path = path($xsl_dir)->child($marc_mods_patched_basename); - if (! $marc_mods_patched_path->is_file) { - say "Downloading MARC21->MODS xsl '$marc_mods_url'"; - my $result = $ua->get($marc_mods_url); - if ($result->is_error) { - croak "Failed to download '$marc_mods_url', " . $result->error_as_HTML; - } - say "Modifying MARC21->MODS xsl for offline use"; - my $xsl = $result->decoded_content; - write_file($marc_mods_path, $xsl); - my $xsl_modified = $xsl; - my $marc_utils_path = check_marc21_utility( $xsl_dir, $ua); - $xsl_modified =~ s#$marc_utils_url#$marc_utils_path#g; - say "Saving MARC21->MODS xsl to file '$marc_mods_path'"; - write_file($marc_mods_patched_path, $xsl_modified); - } - return $marc_mods_patched_path; - } - - sub check_xsl_directory { - # check xsl directory - my $xsl_dir = path(__FILE__)->parent->realpath->parent->child("xsl"); - if (! $xsl_dir->is_dir) { - say "Rebuilding XSL directory '$xsl_dir'"; - $xsl_dir->mkpath() || confess("could not mkdir '$xsl_dir', $!"); - } - return $xsl_dir; - } - - # specification SRU/SRW BSZ: https://wiki.k10plus.de/pages/viewpage.action?pageId=132874251 - sub get_mods_from($$$$) { - if(! defined $_[0]) { croak "url not defined!"; } - if(! defined $_[1]) { croak "ppn not defined!"; } - if(! defined $_[2]) { croak "key not defined!"; } - if(! defined $_[3]) { croak "schema not defined!"; } - if($_[0] eq "" || $_[1] eq "" || $_[2] eq "" || $_[3] eq ""){ - die "invalid parameters."; - } - # $mods = ($url, $ppn, $searchkey, $recordschema) - my $url = shift; - my $ppn = shift; # example: "457035137" for "Der Fichtelberg" - my $key = shift; - my $schema = shift; - - #### where to find XSLT - - my $ua = LWP::UserAgent->new; - $ua->agent("MyApp/0.1 "); - $ua->timeout(3600); #1h - - my $xsl_dir = check_xsl_directory(); - check_marc21_utility($xsl_dir, $ua); - check_marc21_mods_xsl($xsl_dir, $ua); - - my $srubase = $url; # host - my $srusearchkey = $key; # SRU search key - my $sruvalue = $ppn; - my $srumaxrecords = 1; - my $srustartrecord = 1; - my $sruschema = $schema; - my $sru = "${srubase}?version=1.1&query=${srusearchkey}%3D${sruvalue}&operation=searchRetrieve&maximumRecords=${srumaxrecords}&startRecord=${srustartrecord}&recordSchema=${sruschema}"; - if ($with_debug) {say "catalog-URL='$sru'";} - my $response = $ua->get($sru); # ask SWB for given PPN - if ($response->is_success) { - # parse ZiNG repsonse, extract MARC-data - my $xp = XML::XPath->new($response->decoded_content); - my $parser = XML::LibXML->new(); - if ($with_debug) { - say "write DEBUG_${ppn}_response.xml"; - write_file("DEBUG_${ppn}_response.xml", $response->decoded_content); - } - my $recordData = $xp->findnodes_as_string('/*[local-name()="searchRetrieveResponse"]/*[local-name()="records"]/*[local-name()="record"]/*[local-name()="recordData"]/*'); - if (!$recordData) { croak("ERROR: Did not get any <recordData/> for PPN '$ppn' using '$sru'");} - my $marcblob = $parser->parse_string($recordData); - - - my $marcblob_patched = patch_marc_response($marcblob); - if ($with_debug) { - say "write DEBUG_${ppn}_marc_unpatched.xml"; - write_file("DEBUG_${ppn}_marc_unpatched.xml", $marcblob); - say "write DEBUG_${ppn}_marc.xml"; - write_file("DEBUG_${ppn}_marc.xml", $marcblob_patched); - } - - my $marc_mods_patched_path = check_marc21_mods_xsl($xsl_dir, $ua); - my $xslt = XML::LibXSLT->new(); - my $marcmods = XML::LibXML->load_xml(location => $marc_mods_patched_path, no_cdata => 1); - my $stylesheet = $xslt->parse_stylesheet($marcmods); - my $marc = $parser->parse_string($marcblob_patched); - my $result = $stylesheet->transform($marc); - if ($with_debug) { - say "write DEBUG_${ppn}_unpatched_mods.xml"; - write_file("DEBUG_${ppn}_unpatched_mods.xml", $stylesheet->output_string($result)); - } - $result = patch_mods($result); - my $result_string = $stylesheet->output_string($result); - return $result_string; - } - else { - carp("Problem asking catalogue at $url using $ppn"); - } - return; - } - - sub create_filecopyhash { - if(! defined $_[0]) { croak "directory not defined!"; } - if(! defined $_[1]) { croak "content not defined!"; } - if($_[0] eq "" || $_[1] eq ""){ - die "invalid parameters."; - } - my $directory = shift; - my $content = shift; - my %filecopyhash; - my $wanted=sub { - if (-d $_) { - # dir, do nothing - (); - } else { - my $file=$File::Find::name; - # system unabhängige pfade - if ($file !~ m#^[-A-Za-z0-9_\.:\\/]+$#) { - confess("file '$file' does not match regex '^[-A-Za-z0-9_\.:\\/]+\$'"); - } - my $source = $file; - $filecopyhash{$source}->{'source'}=$file; - $file=~s#^$directory/?##; - $filecopyhash{$source}{'relative'}="data/$file"; - $filecopyhash{$source}{'target'}="$content/$file"; - my $fh; - open($fh, "<", $source) or confess ("Can't open '$source', $!"); - binmode($fh); - my $ctx = Digest::MD5->new; - $ctx->addfile(*$fh); - close ($fh); - my $md5 = $ctx->hexdigest; - $filecopyhash{$source}{'md5sum'}=$md5; - } - }; - finddepth($wanted, $directory); - return \%filecopyhash; - } - - sub prepare_dmd_section_with_ppn($) { - if(! defined $_[0]) { croak "ppn not defined!"; } - my $ppn = shift; - my $mods = SLUB::LZA::SIPBuilder::get_mods_from($swb_url, $ppn, $searchkey, $recordschema); - if ($with_debug) { - SLUB::LZA::SIPBuilder::write_file("DEBUG_${ppn}_mods.xml", $mods); - } - # remove the <xml /> from beginning of the answer - $mods=~ s#<\?xml version="1.0" encoding="UTF-8"\?>#<!-- removed xml header from mods part -->#; - my $dmd =<<"DMD"; -<mets:dmdSec ID="DMDLOG_0000"> - <!-- bibliographic metadata --> - <mets:mdWrap MDTYPE="MODS"> - <mets:xmlData> - $mods - </mets:xmlData> - </mets:mdWrap> -</mets:dmdSec> -DMD - return $dmd; - } - - sub prepare_dmd_section_with_noppn($) { - if(! defined $_[0]) { croak "noppn not defined!"; } - my $noppn = shift; - my $mods =<<"MODS"; -<mods version="3.6" - xmlns="http://www.loc.gov/mods/v3" - 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-6.xsd"> - <identifier>$noppn</identifier> -</mods> -MODS - my $dmd =<<"DMD"; -<mets:dmdSec ID="DMDLOG_0000"> - <!-- bibliographic metadata --> - <mets:mdWrap MDTYPE="MODS"> - <mets:xmlData> - $mods - </mets:xmlData> - </mets:mdWrap> -</mets:dmdSec> -DMD - return $dmd; - } - - sub prepare_amd_section($$$$$$) { - if(! defined $_[0]) { croak "export to archive date not defined!"; } - if(! defined $_[1]) { croak "external workflow not defined!"; } - if(! defined $_[2]) { croak "external id not defined!"; } - if(! defined $_[3]) { croak "external conservation flag not defined!"; } - if(! defined $_[4]) { croak "external isil not defined!"; } - if(! defined $_[5]) { croak "external value description not defined!"; } - if($_[0] eq "" || $_[1] eq "" || $_[2] eq "" || $_[3] eq "" || $_[5] eq ""){ - die "invalid parameters."; - } - my $export_to_archive_date = shift; - my $external_workflow = shift; - my $external_id = shift; - my $external_conservation_flag = shift; - my $external_isil = shift; - my $external_value_descr = decode_utf8(shift); - my $amd; - - if ($external_isil eq '') { - $amd =<<"AMD"; -<mets:amdSec ID="AMD"> - <!-- SIP metadata for automated processing by submission application --> - <mets:techMD ID="ARCHIVE"> - <mets:mdWrap MDTYPE="OTHER" MIMETYPE="text/xml" OTHERMDTYPE="ARCHIVE"> - <mets:xmlData> - <archive:record version="v2019.2" xmlns:archive="http://slub-dresden.de/slubarchiv"> - <archive:exportToArchiveDate>$export_to_archive_date</archive:exportToArchiveDate> - <archive:externalId>$external_id</archive:externalId> - <archive:externalWorkflow>$external_workflow</archive:externalWorkflow> - <archive:hasConservationReason>$external_conservation_flag</archive:hasConservationReason> - <archive:archivalValueDescription>$external_value_descr</archive:archivalValueDescription> - </archive:record> - </mets:xmlData> - </mets:mdWrap> - </mets:techMD> - </mets:amdSec> -AMD - } else { - $amd =<<"AMD"; -<mets:amdSec ID="AMD"> - <!-- SIP metadata for automated processing by submission application --> - <mets:techMD ID="ARCHIVE"> - <mets:mdWrap MDTYPE="OTHER" MIMETYPE="text/xml" OTHERMDTYPE="ARCHIVE"> - <mets:xmlData> - <archive:record version="v2019.2" xmlns:archive="http://slub-dresden.de/slubarchiv"> - <archive:exportToArchiveDate>$export_to_archive_date</archive:exportToArchiveDate> - <archive:externalId>$external_id</archive:externalId> - <archive:externalWorkflow>$external_workflow</archive:externalWorkflow> - <archive:hasConservationReason>$external_conservation_flag</archive:hasConservationReason> - <archive:externalIsilId>$external_isil</archive:externalIsilId> - <archive:archivalValueDescription>$external_value_descr</archive:archivalValueDescription> - </archive:record> - </mets:xmlData> - </mets:mdWrap> - </mets:techMD> - </mets:amdSec> -AMD - } - return $amd; - } - - sub prepare_files_sections($) { - if(! defined $_[0]) { croak "filecopyhash not defined!"; } - my $filecopyhash = shift; - my @fsec; - my $i=0; - foreach my $fkey (sort keys (%{$filecopyhash})) { - push @fsec, sprintf("<mets:file ID=\"FILE_%015u_LZA\" CHECKSUMTYPE=\"MD5\" CHECKSUM=\"%s\">", $i, $filecopyhash->{$fkey}->{"md5sum"}); - push @fsec, sprintf("<mets:FLocat xmlns:xlink=\"http://www.w3.org/1999/xlink\" LOCTYPE=\"URL\" xlink:href=\"file://%s\"/>", $filecopyhash->{$fkey}->{"relative"}); - push @fsec, "</mets:file>"; - $i++; - } - my $files = join("\n", @fsec); - my $filesec=<<"FILESEC"; -<mets:fileSec> - <mets:fileGrp USE="LZA"> - $files - </mets:fileGrp> -</mets:fileSec> -FILESEC - return $filesec; - } - - sub prepare_struct_map($) { - if(! defined $_[0]) { croak "filecopyhash not defined!"; } - my $filecopyhash = shift; - my @ssec; - my $i=0; - foreach my $fkey (sort keys (%{$filecopyhash})) { - push @ssec, sprintf("<mets:div ID=\"PHYS_%015u_LZA\" TYPE=\"fileorderSequence\">", $i); - push @ssec, sprintf("<mets:fptr FILEID=\"FILE_%015u_LZA\" />", $i); - push @ssec, "</mets:div>"; - $i++; - } - my $structs = join("\n", @ssec); - my $structmap =<<"STRUCTMAP"; -<mets:structMap TYPE="PHYSICAL"> - <mets:div ID="PHYS_0000" TYPE="ieDir"> - $structs - </mets:div> -</mets:structMap> -STRUCTMAP - return $structmap; - } - - sub check_directory($$) { - if(! defined $_[0]) { croak "fullname not defined!"; } - if(! defined $_[1]) { croak "entry not defined!"; } - if($_[0] eq "" || $_[1] eq ""){ - die "invalid parameters."; - } - my $fullname = shift; - my $entry = shift; - my $dir_err = ''; - # Die Gesamtlänge der relativen Pfade darf jeweils 255 Zeichen nicht übersteigen. - if (length($fullname) > 255){ - return $dir_err = "path to file: $fullname is too long, expected maximum 255 characters"; - } - # Als Dateinamen und Verzeichnisnamen sind für die zu archivierenden Dateien die Zeichen A-Za-z0-9_.- sowie / für Verzeichnistrenner erlaubt. - if ($entry !~ m#^[A-Za-z0-9_.-]+$#){ - return $dir_err = "you need to specify a valid file or directory (name: $entry) to (^[A-Za-z0-9_.-]+\$)"; - } - # Relative Pfade mit Bestandteilen der Form "../" sind nicht erlaubt. - if ($fullname =~ /\.\.\//){ - return $dir_err = "relativ path($fullname) in form '../' is not allowed"; - } - return $dir_err; - } - - sub validate_directory($) { - if(! defined $_[0]) { croak "directory not defined!"; } - if(! -d $_[0]){ - die "Could not find directory"; - } - my $directory = shift; - my @dirs = ($directory); - my $dir_err = ''; - while (@dirs && ($dir_err eq '')) { - my $thisdir = shift @dirs; - if (!($thisdir)) { - # dir, do nothing - return $dir_err=''; - } - opendir (my $dh, $thisdir) or die "Could not find $thisdir"; - while (my $entry = readdir $dh && ($dir_err eq '')) { - next if $entry eq '.'; - next if $entry eq '..'; - - my $fullname = "$thisdir/$entry"; - - $dir_err = check_directory($fullname, $entry); - - if (-d $fullname) { - push @dirs, $fullname; - } - } - closedir $dh; - } - return $dir_err; - } - - # end package - -package main; -#=============================================================================== - -BEGIN{ - $INC{'SLUB/LZA/SIPBuilder.pm'} = 1; # needed because inlined module -} -return 1 if caller; # avoids main code running if module stuff is needed -use SLUB::LZA::SIPBuilder; -use Getopt::Long; -use Path::Tiny; -use Digest::MD5; -use constant buffer => 100 * 1024 * 1024; # use 100MB as Buffer -use File::Find; -use File::Copy qw(cp); -use Pod::Usage; - -my $directory; -my $ppn; -my $noppn; -my $output; -my $external_id; -my $external_workflow; -my $external_isil=""; -my $external_value_descr; -my $external_conservation_flag; - -my $help; -my $man; - -GetOptions( - "IE_directory=s" => \$directory, # required - "ppn=s" => \$ppn, # semi-optional (choice 1 of 2) - "noppn=s" => \$noppn, # semi-optional (choice 2 of 2) - "SIP_output_path=s" => \$output, # required - "external_id=s" => \$external_id, # required - "external_workflow=s" => \$external_workflow, # required - "external_ISIL=s" => \$external_isil, # optional, default: no ISIL - "external_value_descr=s" => \$external_value_descr, # required - "external_conservation_flag" => \$external_conservation_flag, # optional, default: no special conservation - "debug" => \$SLUB::LZA::SIPBuilder::with_debug, # optional - "help|?" => \$help, # optional - "man" => \$man, # optional -) or pod2usage(2); - -my $dir_err = SLUB::LZA::SIPBuilder::validate_directory($directory); - -if ($help) { pod2usage(1); } -if ($man) { pod2usage(-exitval => 0, -verbose => 2); } -if (!defined $directory) { confess("you need to specify an IE directory, which needs to be archived"); } -if ((defined $directory) && ($dir_err ne '')) { confess($dir_err); } -if ((defined $ppn) && (defined $noppn)) { confess("you can only specify either -ppn or -noppn"); } -if ((!defined $ppn) && (!defined $noppn)) { confess("you need to specify a PPN with -ppn or use --noppn"); } -if (!defined $output) { confess("you need to specify an output path, where the SIP will be stored"); } -if (!defined $external_id) { confess("you need to specify external ID"); } -if ((defined $external_id) && ($external_id !~ m#^[a-z0-9_-]+$#)) { confess("you need to specify a valid external ID (^[a-z0-9_-]+\$)"); } -if (!defined $external_workflow) { confess("you need to specify external workflow"); } -if ((defined $external_workflow) && ($external_workflow !~ m#^[a-z0-9_-]+$#)) { confess("you need to specify a valid external workflow (^[a-z0-9_-]+\$)"); } -if (!$external_value_descr) { confess("you need to specify an external value description (reason for archiving)"); } -if (!defined $external_conservation_flag) { $external_conservation_flag="false"; } else { $external_conservation_flag="true"; } -if (! -d $directory) { confess("you need to specify an IE directory, which needs to be archived, $!"); } -$directory = path($directory)->realpath->stringify; -path($output)->mkpath; -$output = path($output)->realpath->stringify; - -#=============================================================================== - -sub main { - # get date - my $export_to_archive_date = DateTime->now(time_zone=>'local')->iso8601(); - my $file_date = $export_to_archive_date; - $file_date =~ s/T/_/g; # replace 'T' with '_' - $file_date =~ s/:/-/g; # replace ':' with '-' - # prepare dirs - my $sip_root_dir = (defined $ppn)? "PPN-${ppn}_${file_date}" : "ID-${noppn}_${file_date}"; - my $content = path($output)->child($sip_root_dir)->child("data")->stringify; - path($content)->mkpath; - my $filecopyhash = SLUB::LZA::SIPBuilder::create_filecopyhash($directory, $content); - - # prepare dmd-sec - my $dmd = (defined $ppn)? SLUB::LZA::SIPBuilder::prepare_dmd_section_with_ppn( $ppn ) : SLUB::LZA::SIPBuilder::prepare_dmd_section_with_noppn( $noppn ); - # prepare amd-sec - my $amd = SLUB::LZA::SIPBuilder::prepare_amd_section( - $export_to_archive_date, - $external_workflow, - $external_id, - $external_conservation_flag, - $external_isil, - $external_value_descr - ); - # create fileSec - my $filesec = SLUB::LZA::SIPBuilder::prepare_files_sections($filecopyhash); - # prepare structmap - my $structmap = SLUB::LZA::SIPBuilder::prepare_struct_map($filecopyhash); - # create sip.xml - my $sip =<<"METS"; -<?xml version="1.0" encoding="utf-8"?> -<mets:mets xmlns:mets="http://www.loc.gov/METS/" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.loc.gov/METS/ http://www.loc.gov/standards/mets/version111/mets.xsd"> - $dmd - $amd - $filesec - $structmap -</mets:mets> -METS - - # write stuff out - SLUB::LZA::SIPBuilder::write_file( path($output)->child($sip_root_dir)->child("sip.xml")->stringify, $sip ); - # copy source to target - foreach my $source (sort keys (%{$filecopyhash})) { - my $target = path($filecopyhash->{$source}->{"target"})->stringify; # CHECK ON WINDOWS - my $basename = path($target)->parent->stringify; - if (! -d $basename) { - path($basename)->mkpath; - } - cp($source, $target, buffer) || confess ("could not copy from '$source' to '$target', $!"); - } - say "SIP '$sip_root_dir' build successfully in '$output'"; - - return; -} - - -#=============================================================================== - -main(); - -#=============================================================================== - - -__END__ - -=pod - -=head1 NAME - -preingest tool "SIP builder" script to create SIPs for SLUBArchive - -=head1 SYNOPSIS - -slubsipbuilder.pl [options] - - Options: - -help brief help message - -man full documentation - - -IE_directory=<IE dir> existing IE directory (absolute path!) - -ppn=<ppn>|-noppn=<noppn> SWB-PPN or any identifier (uses minimalistic MODS) - -SIP_output_path=<target dir> where to put the SIP dir (absolute path!) - -external_id=<id> mandatory, should be uniqe ID - -external_workflow=<workflow> mandatory, should be uniqe workflow name - -external_ISIL=<isil> optional, ISIL number of library - -external_value_descr=<text> mandatory, the reason why to archive - -external_conservation_flag optional, if set no other "original" still exists - -slubsipbuilder.pl --IE_directory=/export_dir_kitodo/10008 --ppn=457035137 --SIP_output_path=/tmp/mysip --external_id=10008 --external_workflow=kitodo --external_ISIL=DE-14 --external_value_descr="Gesetzlicher Auftrag" - -=head1 OPTIONS - -=over 8 - -=item B<-help> - -Print a brief help message and exits. - -=back - -=head1 DESCRIPTION - -B<This program> will process the given IE directory, add bibliographic metadata from catalogue with given PICA number and check and create a SIP directory ready for SLUBarchiv - -=cut diff --git a/bin/slubsipbuilderbagit.pl b/bin/slubsipbuilderbagit.pl new file mode 100755 index 0000000000000000000000000000000000000000..8366f7cce5ddb7122be7bbf72393c92ad3ecb7a4 --- /dev/null +++ b/bin/slubsipbuilderbagit.pl @@ -0,0 +1,778 @@ +#!/usr/bin/env perl +#=============================================================================== +# FILE: slubsipbuilderbagit.pl +# +# USAGE: perl -I lib/ bin/slubsipbuilderbagit.pl --save_option=copy --IE_directory=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/test2 --SIP_output_path=/home/bolkun/git/SLUB_SIP_Builder/tmp --ppn=457035137 --SIP_version=v2020.1 --external_id=10008 --external_workflow=kitodo --external_ISIL=DE-14 --external_value_descr="Gesetzlicher Auftrag" --rights_version=1.0 --rights_xml=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/rights/Fallbeispiel-02.xml +# +# DESCRIPTION: A CLI tool to create a valid SIP for SLUBArchiv +# +# REQUIREMENTS: perl install version 5.28 or higher, as all necessary modules required +# install Bib. Archive::BagIt::Base (If fails than you need extra "sudo apt install libperl-dev libperl5.28") +# link https://metacpan.org/source/RJESCHMI/Archive-BagIt-0.053.3/lib/Archive/BagIt/Base.pm +# BUGS: --- +# NOTES: related to official document "SLUBArchiv_Produzenten_SIP_Spezifikation_v2.0.pdf" +# --save_option=copy is RECOMMENDED than <replace> or <move>, becouse IE can be corrupted if process fails. Manual restauration needed!!! +# --add_meta_file="key: values" must be in double quots to be able to write whitespaces for values +# AUTHOR: Serhiy Bolkun (Serhiy.Bolkun@slub-dresden.de) +# ORGANIZATION: SLUB +# VERSION: 2.0 +# CREATED: 04.02.2020 +#=============================================================================== + + +use strict; +use warnings; +use 5.28.0; +package SLUB::LZA::SIPBuilderBagIt; + #use Archive::BagIt; + use Archive::BagIt::Base; + use File::Copy; # for move + use File::Copy::Recursive; # for dircopy() + use File::Path qw(rmtree); + use Term::ANSIColor; # colored print + use Carp; + use Path::Tiny; + use File::Find; + use LWP::UserAgent; # to get MARC data + use MARC::Record; + use XML::LibXML; + use XML::LibXSLT; + use XML::XPath; + use Encode; + use Data::Printer; + use XML::LibXML; + + our $VERBOSE = 0; # print ausgaben schalter 0 => on, 1 und größer = off + + # old SLUB_SIP_Builder functions + my $marc_mods_url = 'http://www.loc.gov/standards/mods/v3/MARC21slim2MODS3-6.xsl'; + my $marc_utils_url = 'http://www.loc.gov/standards/marcxml/xslt/MARC21slimUtils.xsl'; + my $swb_url = 'https://sru.bsz-bw.de/swb'; + my $searchkey = 'pica.swn'; + my $recordschema = 'marcxmlvbos'; + our $with_debug = 0; + + sub prepare_mods_section_with_noppn($){ + if(! defined $_[0]) { croak "noppn is not defined!"; } + if($_[0] eq "") { croak "noppn is empty string!"; } + + my $noppn = shift; + my $mods =<<"MODS"; +<mods version="3.6" + xmlns="http://www.loc.gov/mods/v3" + 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-6.xsd"> + <identifier>$noppn</identifier> +</mods> +MODS + return $mods; + } + + sub prepare_mods_section_with_ppn($){ + if(! defined $_[0]){ croak "ppn not defined!"; } + + my $ppn = shift; + my $mods = SLUB::LZA::SIPBuilderBagIt::get_mods_from($swb_url, $ppn, $searchkey, $recordschema); + + if($with_debug){ + SLUB::LZA::SIPBuilderBagIt::write_file("DEBUG_${ppn}_mods.xml", $mods); + } + # remove the <xml /> from beginning of the answer + $mods=~ s#<\?xml version="1.0" encoding="UTF-8"\?>#<!-- removed xml header from mods part -->#; + + return $mods; + } + + sub get_mods_from($$$$){ + # specification SRU/SRW BSZ: https://wiki.k10plus.de/pages/viewpage.action?pageId=132874251 + if(! defined $_[0]) { croak "url not defined!"; } + if(! defined $_[1]) { croak "ppn not defined!"; } + if(! defined $_[2]) { croak "key not defined!"; } + if(! defined $_[3]) { croak "schema not defined!"; } + if($_[0] eq "" || $_[1] eq "" || $_[2] eq "" || $_[3] eq ""){ + die "invalid parameters."; + } + #$mods = ($url, $ppn, $searchkey, $recordschema) + my $url = shift; + my $ppn = shift; # example: "457035137" for "Der Fichtelberg" + my $key = shift; + my $schema = shift; + + #### where to find XSLT + + my $ua = LWP::UserAgent->new; + $ua->agent("MyApp/0.1 "); + $ua->timeout(3600); #1h + + my $xsl_dir = SLUB::LZA::SIPBuilderBagIt::check_xsl_directory(); + SLUB::LZA::SIPBuilderBagIt::check_marc21_utility($xsl_dir, $ua); + SLUB::LZA::SIPBuilderBagIt::check_marc21_mods_xsl($xsl_dir, $ua); + + my $srubase = $url; # host + my $srusearchkey = $key; # SRU search key + my $sruvalue = $ppn; + my $srumaxrecords = 1; + my $srustartrecord = 1; + my $sruschema = $schema; + my $sru = "${srubase}?version=1.1&query=${srusearchkey}%3D${sruvalue}&operation=searchRetrieve&maximumRecords=${srumaxrecords}&startRecord=${srustartrecord}&recordSchema=${sruschema}"; + + if ($with_debug) {say "catalog-URL='$sru'";} + my $response = $ua->get($sru); # ask SWB for given PPN + if ($response->is_success) { + # parse ZiNG repsonse, extract MARC-data + my $xp = XML::XPath->new($response->decoded_content); + my $parser = XML::LibXML->new(); + if ($with_debug) { + say "write DEBUG_${ppn}_response.xml"; + SLUB::LZA::SIPBuilderBagIt::write_file("DEBUG_${ppn}_response.xml", $response->decoded_content); + } + my $recordData = $xp->findnodes_as_string('/*[local-name()="searchRetrieveResponse"]/*[local-name()="records"]/*[local-name()="record"]/*[local-name()="recordData"]/*'); + if (!$recordData) { croak("ERROR: Did not get any <recordData/> for PPN '$ppn' using '$sru'");} + my $marcblob = $parser->parse_string($recordData); + + + my $marcblob_patched = SLUB::LZA::SIPBuilderBagIt::patch_marc_response($marcblob); + if ($with_debug) { + say "write DEBUG_${ppn}_marc_unpatched.xml"; + SLUB::LZA::SIPBuilderBagIt::write_file("DEBUG_${ppn}_marc_unpatched.xml", $marcblob); + say "write DEBUG_${ppn}_marc.xml"; + SLUB::LZA::SIPBuilderBagIt::write_file("DEBUG_${ppn}_marc.xml", $marcblob_patched); + } + + my $marc_mods_patched_path = SLUB::LZA::SIPBuilderBagIt::check_marc21_mods_xsl($xsl_dir, $ua); + my $xslt = XML::LibXSLT->new(); + my $marcmods = XML::LibXML->load_xml(location => $marc_mods_patched_path, no_cdata => 1); + my $stylesheet = $xslt->parse_stylesheet($marcmods); + my $marc = $parser->parse_string($marcblob_patched); + my $result = $stylesheet->transform($marc); + if ($with_debug) { + say "write DEBUG_${ppn}_unpatched_mods.xml"; + SLUB::LZA::SIPBuilderBagIt::write_file("DEBUG_${ppn}_unpatched_mods.xml", $stylesheet->output_string($result)); + } + $result = patch_mods($result); + my $result_string = $stylesheet->output_string($result); + return $result_string; + } + else { + carp("Problem asking catalogue at $url using $ppn"); + } + + return; + } + + sub write_file($$){ + if(! defined $_[0]) { croak "filename not defined!"; } + if(! defined $_[1]) { croak "value not defined!"; } + if($_[0] eq "" || $_[1] eq ""){ die "invalid parameters."; } + + my $filename = $_[0]; + my $value = $_[1]; + + # write data to file (UTF-8) + open(my $fh, '>:encoding(UTF-8)', $filename) || (croak "Can't open '$filename', $!"); + print $fh $value; + close($fh) || (croak "could not close file '$filename', $!"); + return 1; + } + + sub check_xsl_directory{ + my $xsl_dir = path(__FILE__)->parent->realpath->parent->child("xsl"); + if (! $xsl_dir->is_dir) { + say "Rebuilding XSL directory '$xsl_dir'"; + $xsl_dir->mkpath() || confess("could not mkdir '$xsl_dir', $!"); + } + return $xsl_dir; + } + + sub check_marc21_utility($$){ + # check MARC21 utility xsl + if(! defined $_[0]) { croak "xsl directory not defined!"; } + if(! defined $_[1]) { croak "user agent not defined!"; } + if($_[0] eq "" || $_[1] eq ""){ die "invalid parameters."; } + + my $xsl_dir = shift; + my $ua = shift; + my $marc_utils_basename = path($marc_utils_url)->basename; + my $marc_utils_path = path($xsl_dir)->child($marc_utils_basename); + + if (!$marc_utils_path->is_file) { + say "Downloading MARC21 utility xsl '$marc_utils_url'"; + my $result = $ua->get($marc_utils_url); + if ($result->is_error) { + croak "Failed to download '$marc_utils_url', " . $result->error_as_HTML; + } + say "Saving MARC21 utility xsl to file '$marc_utils_path'"; + my $xsl = $result->decoded_content; + SLUB::LZA::SIPBuilderBagIt::write_file($marc_utils_path, $xsl); + } + return $marc_utils_path; + } + + sub check_marc21_mods_xsl($$){ + # check MARC21->MODS xsl + if(! defined $_[0]) { croak "xsl directory not defined!"; } + if(! defined $_[1]) { croak "user agent not defined!"; } + if($_[0] eq "" || $_[1] eq ""){ die "invalid parameters."; } + + my $xsl_dir = shift; + my $ua = shift; + my $marc_mods_basename = path($marc_mods_url)->basename; + my $marc_mods_path = path($xsl_dir)->child($marc_mods_basename)->stringify; + my $marc_mods_patched_basename = path($marc_mods_url)->basename(".xsl") . ".patched.xsl"; + my $marc_mods_patched_path = path($xsl_dir)->child($marc_mods_patched_basename); + + if (! $marc_mods_patched_path->is_file) { + say "Downloading MARC21->MODS xsl '$marc_mods_url'"; + my $result = $ua->get($marc_mods_url); + if ($result->is_error) { + croak "Failed to download '$marc_mods_url', " . $result->error_as_HTML; + } + say "Modifying MARC21->MODS xsl for offline use"; + my $xsl = $result->decoded_content; + SLUB::LZA::SIPBuilderBagIt::write_file($marc_mods_path, $xsl); + my $xsl_modified = $xsl; + my $marc_utils_path = SLUB::LZA::SIPBuilderBagIt::check_marc21_utility($xsl_dir, $ua); + $xsl_modified =~ s#$marc_utils_url#$marc_utils_path#g; + say "Saving MARC21->MODS xsl to file '$marc_mods_path'"; + SLUB::LZA::SIPBuilderBagIt::write_file($marc_mods_patched_path, $xsl_modified); + } + return $marc_mods_patched_path; + } + + sub patch_marc_response($){ + if(! defined $_[0]) { croak "marcobject not defined!"; } + if($_[0] eq ""){ die "invalid parameters."; } + + my $marcobj = shift; # marcobj expected as XML Parser object + my $xslt_patch_string = <<'PATCH2'; +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.loc.gov/MARC21/slim" xmlns:srw="http://www.loc.gov/zing/srw/" + exclude-result-prefixes="srw" version="1.0"> + <xsl:template match="/record"> + <xsl:element name="collection"> + <xsl:element name="record" namespace="http://www.loc.gov/MARC21/slim"> + <xsl:apply-templates select="@*"/> + <xsl:apply-templates select="node()"/> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template match="*"> + <xsl:element name="{local-name()}" namespace="http://www.loc.gov/MARC21/slim"> + <xsl:apply-templates select="node() | @*"/> + </xsl:element> + </xsl:template> + <xsl:template match="@*"> + <xsl:attribute name="{local-name()}"> + <xsl:value-of select="."/> + </xsl:attribute> + </xsl:template> +</xsl:stylesheet> +PATCH2 + my $xslt = XML::LibXSLT->new(); + my $xslt_patch = XML::LibXML->load_xml(string => $xslt_patch_string, no_cdata => 1); + my $stylesheet = $xslt->parse_stylesheet($xslt_patch); + my $result = $stylesheet->transform($marcobj); + + return $result; + } + + sub patch_mods($){ + # this will patch the mods-xml as a workaround for bugs in LOCs xslt files + if(! defined $_[0]) { croak "modsobject not defined!"; } + if($_[0] eq ""){ die "invalid parameters."; } + + my $modsobj = shift; # mods expected as XML Parser object + # TODO: Bugfix for /mets:mets/mets:dmdSec[1]/mets:mdWrap[1]/mets:xmlData[1]/mods:modsCollection[1]/mods:mods[1]/mods:relatedItem[2]/mods:internetMediaType[1] + my $xslt_patch_string = <<'PATCH'; +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:mods="http://www.loc.gov/mods/v3" + xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-6.xsd" + exclude-result-prefixes="xs" + version="1.0"> + <xsl:output encoding="UTF-8" indent="yes" method="xml"/> + <xsl:strip-space elements="*"/> + <xsl:template match="//mods:mods/mods:relatedItem[mods:internetMediaType]"> + <xsl:comment>patched wrong //mods:mods/mods:relatedItem[mods:internetMediaType]</xsl:comment> + </xsl:template> + <xsl:template match="@* | node()"> + <xsl:copy> + <xsl:apply-templates select="@* | node()"/> + </xsl:copy> + </xsl:template> +</xsl:stylesheet> +PATCH + my $xslt = XML::LibXSLT->new(); + my $xslt_patch = XML::LibXML->load_xml(string => $xslt_patch_string, no_cdata => 1); + my $stylesheet = $xslt->parse_stylesheet($xslt_patch); + my $result = $stylesheet->transform($modsobj); + + return $result; + } + + # new functions + sub create_slub_bagit($$){ + if(! defined $_[0]) { croak "ie_path is not defined!"; } + if(! defined $_[1]) { croak "array of hashes not defined for bag-info.txt!"; } + if(! -d $_[0]) { croak "path is not directory!" } + + my $ie_path = $_[0]; + my $refAddBagInfo = $_[1]; # ref to array of hashes + + #p($refAddBagInfo); + + # construct bag + my $oArchiveBagIt = Archive::BagIt::Base->make_bag($ie_path); # returns object->bag_info(arrayOfHashes); object->store + $oArchiveBagIt->bag_info($refAddBagInfo); + $oArchiveBagIt->store(); + $oArchiveBagIt->verify_bag(); + } + + sub print_scalar_data($$$$){ + my $priority = 0; + my $header = $_[0]; + my $p = $_[1]; + my $arrRef = $_[2]; + my $pColor = $_[3]; + + # header + if($header ne ""){ + print "----------------------------------------------------------------------------------\n" if $priority >= $VERBOSE; + printf "%" . length($header) . "s\n", colored($header, 'bold green') if $priority >= $VERBOSE; + print "----------------------------------------------------------------------------------\n" if $priority >= $VERBOSE; + } + # paragraph + if(($p ne "") && ($arrRef eq "")){ + printf "%" . length($p) . "s\n", colored($p, "bold $pColor") if $priority >= $VERBOSE; + } + + # paragraph with converted array + if(($p ne "") && ($arrRef ne "")){ + my $string = ""; + for my $i (0 .. $#$arrRef){ + if($i eq $#$arrRef){ + $string .= " $$arrRef[$i]"; + } else { + $string .= " $$arrRef[$i],"; + } + } + my $body = $p . $string; + printf "%" . length($body) . "s\n", colored($body, "bold $pColor") if $priority >= $VERBOSE; + } + } + + sub getBagItName($){ + if(! defined $_[0]) { croak "path for getting bagit name is not defined!"; } + if(! -d $_[0]) { croak "path is not directory!" } + my $bagit_name = $_[0]; + + # grep last directory from a path + if ($bagit_name =~ m/([^\/]+)$/){ + $bagit_name = $1; + } + return $bagit_name; + } + + sub getFileName($){ + if(! defined $_[0]) { croak "path with file name is not defined!"; } + if($_[0] eq ""){ croak "invalid parameters!"; } + my $file_name = $_[0]; + + # grep last directory from a path + if ($file_name =~ m/([^\/]+)$/){ + $file_name = $1; + } + + return $file_name; + } + + sub save_option($$$$){ + if(! defined $_[0]) { croak "save option not defined!"; } + if(! defined $_[1]) { croak "IE directory path not defined!"; } + if(! defined $_[2] && $_[0] eq "copy") { croak "output path not defined!"; } + if(! defined $_[2] && $_[0] eq "move") { croak "output path not defined!"; } + if(! defined $_[3]) { croak "sip root dir is not defined!"; } + + my $save = $_[0]; + my $directory = $_[1]; + my $output = $_[2]; + my $bagNewDir = $_[3]; + + if($save eq "replace"){ + # bag created on the same place where IE_directory under new name + my $bagNewPath = path($directory)->parent->stringify; + rename($directory, $bagNewPath . "/" . $bagNewDir); + $directory = $bagNewPath . "/" . $bagNewDir; + } elsif($save eq "copy"){ + File::Copy::Recursive::dircopy($directory, $output . "/" . $bagNewDir) or die "Could not perform dircopy() of $directory to $output: $!"; + $directory = $output . "/" . $bagNewDir; + } elsif($save eq "move"){ + move($directory, $output . "/" . $bagNewDir); + $directory = $output . "/" . $bagNewDir; + } + return $directory; + } + + sub getPayloadFiles($){ + if(! defined $_[0]) { croak "path is not defined!"; } + my $import_dir = $_[0]; + my @dirs; + # check if dir exists + if(! -d $import_dir) { + confess "ERROR: $import_dir does not exist!"; + } else { + opendir(DIR, $import_dir) or die $!; + while (my $dir_name = readdir(DIR)) { + # A file test to check that it is a directory + #next unless (-d $import_dir); + next if $dir_name eq '.'; + next if $dir_name eq '..'; + # fill array with directory names + push @dirs, $dir_name; + } + closedir(DIR); + } + return @dirs; + } + + sub validateRightsXML($$){ + if(! defined $_[0]) { croak "ie_path to rights.xsd not defined!"; } + if(! defined $_[1]) { croak "file name not defined!"; } + + my $ie_path = $_[0]; + my $rightsName = $_[1]; + + my $xsd_file = path(__FILE__)->parent->realpath->parent->child("xsd")->child("slub-rr-v09-2.xsd"); # absolute path + my $xml_file = $ie_path . '/meta/' . $rightsName; + + my $schema = XML::LibXML::Schema->new(location => $xsd_file); + my $parser = XML::LibXML->new; + my $doc = $parser->parse_file($xml_file); + + eval { $schema->validate($doc) }; + die "File rights.xml failed validation: $@" if $@; + + return 1; + } + + + # end package + +package main; +#=============================================================================== + +BEGIN{ + $INC{'SLUB/LZA/SIPBuilderBagIt.pm'} = 1; # needed because inlined module +} +return 1 if caller; # avoids main code running if module stuff is needed + +use SLUB::LZA::SIPBuilderBagIt; +use DateTime::Format::ISO8601; +use Getopt::Long; +use Path::Tiny; +use Carp; # confess() +use Data::Printer; # p() +use Term::ANSIColor; # colored print +use Pod::Usage; # pod2usage() +use File::Copy; +use File::Copy::Recursive; # for dirmove() + +my $save; +my $ieDirectory; +my $outputPath; +# +my $ppn; +my $noppn; +# bag-info data +my $sipVersion; +my $externalWorkflow; +my $externalId; +my $externalIsilId = ""; +my $exportToArchiveDate = DateTime->now(time_zone=>'local')->iso8601(); +my $hasConservationReason; +my $archivalValueDescription; +my $rightsVersion; +my @addKeyValue; +# +my @addBagInfo; # array of hashes +# not payload files +my $rightsFilePath; +my @addMetaFile; +# extra +my $help; +my $man; + +GetOptions( + "save_option=s" => \$save, # required + "IE_directory=s" => \$ieDirectory, # required + "SIP_output_path=s" => \$outputPath, # required, but by save=replace can be ignored + "ppn=s" => \$ppn, # semi-optional (choice 1 of 2) + "noppn=s" => \$noppn, # semi-optional (choice 2 of 2) + # bag-info data + "SIP_version=s" => \$sipVersion, # required + "external_workflow=s" => \$externalWorkflow, # required + "external_id=s" => \$externalId, # required + "external_ISIL=s" => \$externalIsilId, # optional, default: no ISIL + "external_conservation_flag" => \$hasConservationReason, # optional, default: no special conservation + "external_value_descr=s" => \$archivalValueDescription, # required + "rights_version=s" => \$rightsVersion, # required + # not payload files + "rights_xml=s" => \$rightsFilePath, # required + "add_meta_file=s" => \@addMetaFile, # optional + "add_key_value=s" => \@addKeyValue, # optional + # extra + "debug" => \$SLUB::LZA::SIPBuilderBagIt::with_debug, # optional + "help|?" => \$help, # optional + "man" => \$man, # optional +) or pod2usage(2); + +# help +if ($help) { pod2usage(1); } +#man +if ($man) { pod2usage(-exitval => 0, -verbose => 2); } +# save +if (!defined $save) { confess("you need to specify a --save_option, available <replace> or <copy> or <move>"); } +# ieDirectory +if (!defined $ieDirectory) { confess("you need to specify an --IE_directory, which needs to be archived"); } +if (! -d $ieDirectory) { confess("you need to specify a valid --IE_directory, status: is not a directory"); } +# outputPath +if (!defined $outputPath && $save eq "copy") { confess("you need to specify an --SIP_output_path, where the SIP will be stored"); } +if (!defined $outputPath && $save eq "move") { confess("you need to specify an --SIP_output_path, where the SIP will be stored"); } +# ppn, noppn +if (defined $ppn && defined $noppn) { confess("you can only specify either --ppn or --noppn"); } +if (!defined $ppn && !defined $noppn) { confess("you need to specify a PPN with --ppn or use --noppn"); } +#########################################################> bag-info.txt <############################################################################### +# sipversion +if (!defined $sipVersion) { + confess("you need to specify --SIP_version, current tool supports <v2020.1>"); +} else { + if ($sipVersion ne "v2020.1") { confess("not valid --SIP_version, current tool supports <v2020.1>"); } + utf8::decode($sipVersion); + push @addBagInfo, {'SLUBArchiv-sipVersion' => $sipVersion}; +} +# externalWorkflow +if (!defined $externalWorkflow) { + confess("you need to specify external workflow"); +} else { + if ($externalWorkflow !~ m#^[a-z0-9_-]+$#) { confess("you need to specify a valid --external_workflow (^[a-z0-9_-]+\$)"); } + utf8::decode($externalWorkflow); + push @addBagInfo, {'SLUBArchiv-externalWorkflow' => $externalWorkflow}; +} +# externalId +if (!defined $externalId) { + confess("you need to specify external ID"); +} else { + if ($externalId !~ m#^[a-z0-9_-]+$#) { confess("you need to specify a valid --external_id (^[a-z0-9_-]+\$)"); } + utf8::decode($externalId); + push @addBagInfo, {'SLUBArchiv-externalId' => $externalId}; +} +# externalIsilId +if (defined $externalIsilId) { + utf8::decode($externalIsilId); + push @addBagInfo, {'SLUBArchiv-externalIsilId' => $externalIsilId}; +} +# exportToArchiveDate +utf8::decode($exportToArchiveDate); +push @addBagInfo, {'SLUBArchiv-exportToArchiveDate' => $exportToArchiveDate}; +# hasConservationReason +if (!defined $hasConservationReason) { + $hasConservationReason = "false"; +} else { + $hasConservationReason = "true"; +} +utf8::decode($hasConservationReason); +push @addBagInfo, {'SLUBArchiv-hasConservationReason' => $hasConservationReason}; +# archivalValueDescription +if (!defined $archivalValueDescription) { + confess("you need to specify an --external_value_descr (reason for archiving)"); +} else { + utf8::decode($archivalValueDescription); + push @addBagInfo, {'SLUBArchiv-archivalValueDescription' => $archivalValueDescription}; +} +# rightsVersion +if (!defined $rightsVersion) { + confess("you need to specify --rights_version"); +} else { + if($rightsVersion ne "1.0") { confess("invalid --rights_version, supported version <1.0>"); } + utf8::decode($rightsVersion); + push @addBagInfo, {'SLUBArchiv-rightsVersion' => $rightsVersion}; +} +# addKeyValue +if (@addKeyValue) { + foreach my $zeile(@addKeyValue){ + if($zeile !~ m#^.*:.*$#){ # : must be minimum once present + confess('wrong construct in --add_key_value="' . $zeile . '", expected --add_key_value="key:value", regexp to match is (^[^:]+:[^:]+$)'); + } else { + utf8::decode($zeile); + my @keyvalue = split(/:/, $zeile, 2); # split on first : + my $key = $keyvalue[0]; + my $value = $keyvalue[1]; + if($key eq 'SLUBArchiv-sipVersion' || + $key eq 'SLUBArchiv-externalWorkflow' || + $key eq 'SLUBArchiv-externalId' || + $key eq 'SLUBArchiv-externalIsilId' || + $key eq 'SLUBArchiv-exportToArchiveDate' || + $key eq 'SLUBArchiv-hasConservationReason' || + $key eq 'SLUBArchiv-archivalValueDescription' || + $key eq 'SLUBArchiv-rightsVersion'){ + confess("Duplicate key $key present at --add_key_value. Notice: $key is reserved by SLUB Dresden."); + SLUB::LZA::SIPBuilderBagIt::print_scalar_data("", "INFO: Read Docu for more information at https://slubarchiv.slub-dresden.de/technische-standards-fuer-die-ablieferung-von-digitalen-dokumenten/", "", "white"); + } + if($key eq 'Bag-Count'){ + confess("$key present at --add_key_value. This key is not available due to SLUB spesification."); + SLUB::LZA::SIPBuilderBagIt::print_scalar_data("", "INFO: Read Docu for more information at https://slubarchiv.slub-dresden.de/technische-standards-fuer-die-ablieferung-von-digitalen-dokumenten/", "", "white"); + } + if($key eq 'Bag-Group-Identifier'){ + confess("$key present at --add_key_value. This key is not available due to SLUB spesification."); + SLUB::LZA::SIPBuilderBagIt::print_scalar_data("", "INFO: Read Docu for more information at https://slubarchiv.slub-dresden.de/technische-standards-fuer-die-ablieferung-von-digitalen-dokumenten/", "", "white"); + } + push @addBagInfo, {$key => $value}; + } + } +} +#p(@addKeyValue); +#p(@addBagInfo); # print data from array of hashes https://docstore.mik.ua/orelly/perl/prog3/ch09_03.htm +########################################################################################################################################################### +# rightsFilePath +if (!defined $rightsFilePath) { confess("you need to specify --rights_xml file, which needs to be added"); } +if (! -f $rightsFilePath) { confess("you need to specify --rights_xml file, status: is not a file"); } +# addMetaFile +if (@addMetaFile){ foreach my $file(@addMetaFile){ if(! -f $file){ confess("file $file at --add_meta_file, is not a file or could not be found"); } } } + +$ieDirectory = path($ieDirectory)->realpath->stringify; +if($save ne "replace") { + path($outputPath)->mkpath; + $outputPath = path($outputPath)->realpath->stringify; +} + +#=============================================================================== + +sub main{ + # prepare dirs + my $file_date = $exportToArchiveDate; + $file_date =~ s/T/_/g; # replace 'T' with '_' + $file_date =~ s/:/-/g; # replace ':' with '-' + my $sipRootDir = (defined $ppn)? "PPN-${ppn}_${file_date}" : "ID-${noppn}_${file_date}"; # Bag output dir name + my $ie_path = SLUB::LZA::SIPBuilderBagIt::save_option($save, $ieDirectory, $outputPath, $sipRootDir); + # data directory + if(! -d "$ie_path/data"){ + my @payload_files = SLUB::LZA::SIPBuilderBagIt::getPayloadFiles($ie_path); + mkdir("$ie_path/data") or die "Could not mkdir $ie_path/data: $!"; + foreach my $file(@payload_files){ + if(-f "$ie_path/$file") { move("$ie_path/$file", "$ie_path/data/$file") or die "Could not move $file payload files to $ie_path/data: $!"; } + if(-d "$ie_path/$file") { File::Copy::Recursive::dirmove("$ie_path/$file", "$ie_path/data/$file") or die "Could not move $file payload files to $ie_path/data: $!"; } + } + } + # meta directory + if(! -d "$ie_path/meta"){ + mkdir("$ie_path/meta") or die "Could not mkdir $ie_path/meta: $!"; + } + # meta files + if(@addMetaFile){ + foreach my $file(@addMetaFile){ + my $i = 1; + my $meta_file_name = SLUB::LZA::SIPBuilderBagIt::getFileName($file); + if($meta_file_name eq "rights.xml" || $meta_file_name eq "mods.xml"){ + foreach my $f(@addMetaFile){ + my $f_name = SLUB::LZA::SIPBuilderBagIt::getFileName($f); + while($f_name eq "$i.xml"){ + $i++; + } + } + SLUB::LZA::SIPBuilderBagIt::print_scalar_data("", "WARNING: Renaming " . $meta_file_name . " to $i.xml, cause meta filename <rights.xml> is reserved or <mods.xml> auto generated.", "", "yellow"); + SLUB::LZA::SIPBuilderBagIt::print_scalar_data("", "INFO: Read Docu for more information at https://slubarchiv.slub-dresden.de/technische-standards-fuer-die-ablieferung-von-digitalen-dokumenten/", "", "white"); + copy($file, "$ie_path/meta") or die "Copy failed: $!"; + rename("$ie_path/meta/$meta_file_name", "$ie_path/meta/$i.xml"); + }else{ + copy($file, "$ie_path/meta") or die "Copy failed: $!"; + } + } + } + # mods.xml + my $mods = (defined $ppn)? SLUB::LZA::SIPBuilderBagIt::prepare_mods_section_with_ppn($ppn) : SLUB::LZA::SIPBuilderBagIt::prepare_mods_section_with_noppn($noppn); # prepare mods-sec + SLUB::LZA::SIPBuilderBagIt::write_file("$ie_path/meta/mods.xml", $mods); + # rights.xml + if(SLUB::LZA::SIPBuilderBagIt::getFileName($rightsFilePath) ne "rights.xml"){ + my $rights_name = SLUB::LZA::SIPBuilderBagIt::getFileName($rightsFilePath); + SLUB::LZA::SIPBuilderBagIt::print_scalar_data("", "WARNING: Renaming " . $rights_name . " to rights.xml, cause meta filename <rights.xml> is reserved.", "", "yellow"); + SLUB::LZA::SIPBuilderBagIt::print_scalar_data("", "INFO: Read Docu for more information at https://slubarchiv.slub-dresden.de/technische-standards-fuer-die-ablieferung-von-digitalen-dokumenten/", "", "white"); + copy($rightsFilePath, "$ie_path/meta") or die "Copy failed: $!"; + rename("$ie_path/meta/$rights_name", "$ie_path/meta/rights.xml"); + }else{ + copy($rightsFilePath, "$ie_path/meta") or die "Copy failed: $!"; + } + SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_path, "rights.xml"); + # create slub bagit + SLUB::LZA::SIPBuilderBagIt::create_slub_bagit($ie_path, \@addBagInfo); + SLUB::LZA::SIPBuilderBagIt::print_scalar_data("", "SUCCESS: SLUB Bag at $ie_path build successfully!", "", "green"); + + return; +} + +#=============================================================================== + +main(); + +#=============================================================================== + +__END__ + +=pod + +=head1 NAME + +preingest tool "SLUB SIP Builder BagIt" script to create Bags for SLUBArchive + +=head1 SYNOPSIS + +slubsipbuilderbagit.pl [options] + +Options: + -help brief help message + -man full documentation + + -save_option=<option> save as <copy>, <move>, <replace> + -IE_directory=<IE dir> existing IE directory (absolute path!) + -SIP_output_path=<target dir> where to put the SIP dir (absolute path!) + -ppn=<ppn>|-noppn=<noppn> SWB-PPN or any identifier (uses minimalistic MODS) + + -SIP_version=<version> mandatory, needs for identification of SIP format, supported <v2020.1> + -external_workflow=<workflow> mandatory, should be uniqe workflow name + -external_id=<id> mandatory, should be uniqe ID + -external_ISIL=<isil> optional, ISIL number of library + -external_conservation_flag optional, if set no other "original" still exists + -external_value_descr=<text> mandatory, the reason why to archive + -rights_version=<version> mandatory, SLUB law managment specification, supported <1.0> + + -rights_xml=<file> mandatory, path to SLUB rights xml file(absolute path!) + -add_meta_file=<file> optional, can be repeated, additional meta files(absolute path!) + -add_key_value=<"key:value"> optional, can be repeated, additional key value pairs for bag-info.txt + +=head1 EXAMPLES +# Replace (minimalistic) NOT RECOMMENDED! IF FAILS, "IE" MUST BE MANUAL RESTORED TO THE PREVIOUS STATE!!! +perl -I lib/ bin/slubsipbuilderbagit.pl --save_option=replace --IE_directory=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/test2 --ppn=457035137 --SIP_version=v2020.1 --external_id=10008 --external_workflow=kitodo --external_ISIL=DE-14 --external_value_descr="Gesetzlicher Auftrag" --rights_version=1.0 --rights_xml=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/rights/Fallbeispiel-01.xml +# Copy (minimalistic) +perl -I lib/ bin/slubsipbuilderbagit.pl --save_option=copy --IE_directory=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/test2 --SIP_output_path=/home/bolkun/git/SLUB_SIP_Builder/tmp --ppn=457035137 --SIP_version=v2020.1 --external_id=10008 --external_workflow=kitodo --external_ISIL=DE-14 --external_value_descr="Gesetzlicher Auftrag" --rights_version=1.0 --rights_xml=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/rights/Fallbeispiel-02.xml +# Move (minimalistic) NOT RECOMMENDED! IF FAILS, "IE" MUST BE MANUAL RESTORED TO THE PREVIOUS STATE!!! +perl -I lib/ bin/slubsipbuilderbagit.pl --save_option=move --IE_directory=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/test2 --SIP_output_path=/home/bolkun/git/SLUB_SIP_Builder/tmp --ppn=457035137 --SIP_version=v2020.1 --external_id=10008 --external_workflow=kitodo --external_ISIL=DE-14 --external_value_descr="Gesetzlicher Auftrag" --rights_version=1.0 --rights_xml=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/rights/Fallbeispiel-03.xml +# Copy +perl -I lib/ bin/slubsipbuilderbagit.pl --save_option=copy --IE_directory=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/test2 --SIP_output_path=/home/bolkun/git/SLUB_SIP_Builder/tmp --ppn=457035137 --SIP_version=v2020.1 --external_id=10008 --external_workflow=kitodo --external_ISIL=DE-14 --external_value_descr="Gesetzlicher Auftrag" --rights_version=1.0 --rights_xml=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/rights/Fallbeispiel-01.xml --add_meta_file=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/meta/lido.xml --add_meta_file=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/meta/mods.xml --add_key_value="Author:Lew Nikolajewitsch Tolstoi" --add_key_value="Titel:Krieg und Frieden" --add_key_value="Genre:Roman" + +=head1 OPTIONS + +=over 8 + +=item B<-help> + +Print a brief help message and exits. + +=back + +=head1 DESCRIPTION + +B<This program> will process the given IE directory, add bibliographic metadata from catalogue with given PICA number and check and create a BagIt directory ready for SLUBarchiv + +=cut diff --git a/export_dir_kitodo/bagit/meta/bubble.xml b/export_dir_kitodo/bagit/meta/bubble.xml new file mode 100644 index 0000000000000000000000000000000000000000..3713df5e6c931dce354bb643d687460931e91de9 --- /dev/null +++ b/export_dir_kitodo/bagit/meta/bubble.xml @@ -0,0 +1 @@ +this is my rights.xml \ No newline at end of file diff --git a/export_dir_kitodo/bagit/meta/lido.xml b/export_dir_kitodo/bagit/meta/lido.xml new file mode 100644 index 0000000000000000000000000000000000000000..19b16cc72c67d3a63e9545d4ad01635e85e4c8d9 --- /dev/null +++ b/export_dir_kitodo/bagit/meta/lido.xml @@ -0,0 +1 @@ +<xml></xml> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/meta/mods.xml b/export_dir_kitodo/bagit/meta/mods.xml new file mode 100644 index 0000000000000000000000000000000000000000..ab512e26c7d17e941357c4e439a6fd31d85dc568 --- /dev/null +++ b/export_dir_kitodo/bagit/meta/mods.xml @@ -0,0 +1,38 @@ +<mods:mods xmlns:mods="http://www.loc.gov/mods/v3"> +<mods:location> +<mods:physicalLocation authority="marcorg" displayLabel="Saxon State Library, Dresden, +Germany">DE-14</mods:physicalLocation> +<mods:shelfLocator>Hist.Sax.M.37.t,120</mods:shelfLocator> +</mods:location> +<mods:relatedItem type="series"> +<mods:titleInfo> +<mods:title>Saxonica</mods:title> +</mods:titleInfo> +</mods:relatedItem> +<mods:recordInfo> +<mods:recordIdentifier source="http://digital.slub-dresden.de/oai/">oai:de:slub-dresden:db:id- +319037843</mods:recordIdentifier> +</mods:recordInfo> +<mods:physicalDescription> +<mods:digitalOrigin>reformatted digital</mods:digitalOrigin> +<mods:extent>[1] Bl.</mods:extent> +</mods:physicalDescription> +<mods:identifier type="urn">urn:nbn:de:bsz:14-db-id3190378431</mods:identifier> +<mods:titleInfo> +<mods:title>Eingabe der Handelskammer zu Leipzig den Entwurf eines Tabak-Steuer-Gesetzes +betr.</mods:title> +<mods:subTitle>an den Reichstag zu Berlin</mods:subTitle> +</mods:titleInfo> +<mods:language> +<mods:languageTerm authority="rfc3066" type="code">de</mods:languageTerm> +</mods:language> +<mods:originInfo> +<mods:place> +<mods:placeTerm type="text">[Leipzig]</mods:placeTerm> +</mods:place> +<mods:dateIssued keyDate="yes">1893</mods:dateIssued> +</mods:originInfo> +<mods:subject authority="slub"> +<mods:topic>eingdehaz</mods:topic> +</mods:subject> +</mods:mods> diff --git a/export_dir_kitodo/bagit/meta/rights.xml b/export_dir_kitodo/bagit/meta/rights.xml new file mode 100644 index 0000000000000000000000000000000000000000..3201b82290c78afdb5e85650061cae25fe930e26 --- /dev/null +++ b/export_dir_kitodo/bagit/meta/rights.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-1.xsd"> + <slubarchiv:copyrightStatus>publicdomain</slubarchiv:copyrightStatus> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/meta2/1.xml b/export_dir_kitodo/bagit/meta2/1.xml new file mode 100644 index 0000000000000000000000000000000000000000..58b432bed14e24d243c846656fdddd4d05a4d3ce --- /dev/null +++ b/export_dir_kitodo/bagit/meta2/1.xml @@ -0,0 +1 @@ +this is real 1.xml diff --git a/export_dir_kitodo/bagit/meta2/2.xml b/export_dir_kitodo/bagit/meta2/2.xml new file mode 100644 index 0000000000000000000000000000000000000000..db92e8151d5a028638b2d0160652fab9e2d77f38 --- /dev/null +++ b/export_dir_kitodo/bagit/meta2/2.xml @@ -0,0 +1 @@ +this is 2.xml \ No newline at end of file diff --git a/export_dir_kitodo/bagit/meta2/rights.xml b/export_dir_kitodo/bagit/meta2/rights.xml new file mode 100644 index 0000000000000000000000000000000000000000..cad6ed7c4d0bd07bcdcd604d077f7caeef87c3a9 --- /dev/null +++ b/export_dir_kitodo/bagit/meta2/rights.xml @@ -0,0 +1 @@ +this is meta2/rights.xml \ No newline at end of file diff --git a/export_dir_kitodo/bagit/rights/Fallbeispiel-01.xml b/export_dir_kitodo/bagit/rights/Fallbeispiel-01.xml new file mode 100644 index 0000000000000000000000000000000000000000..afc2677f84e2b7aeafeac8952251a514e5f461c5 --- /dev/null +++ b/export_dir_kitodo/bagit/rights/Fallbeispiel-01.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>publicdomain</slubarchiv:copyrightStatus> +</slubarchiv:rightsRecord> diff --git a/export_dir_kitodo/bagit/rights/Fallbeispiel-02.xml b/export_dir_kitodo/bagit/rights/Fallbeispiel-02.xml new file mode 100644 index 0000000000000000000000000000000000000000..54dd8318ee558560daae4ee320cec8b2742a5f0a --- /dev/null +++ b/export_dir_kitodo/bagit/rights/Fallbeispiel-02.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2017-10-10">Vertrag zw. Herrn Mustermann und SLUB</slubarchiv:contract> + </slubarchiv:permissions> + <slubarchiv:legalRestrictions> + <slubarchiv:personalRight>Gerichtsurteil Amtsgericht Dresden, AZ: 2993/3829002A</slubarchiv:personalRight> + </slubarchiv:legalRestrictions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/rights/Fallbeispiel-03.xml b/export_dir_kitodo/bagit/rights/Fallbeispiel-03.xml new file mode 100644 index 0000000000000000000000000000000000000000..562ad72c0cd1384291d2b4c5ed798a16eb1ce99f --- /dev/null +++ b/export_dir_kitodo/bagit/rights/Fallbeispiel-03.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:license url="https://creativecommons.org/publicdomain/zero/1.0/">CC0 1.0</slubarchiv:license> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/rights/Fallbeispiel-04.xml b/export_dir_kitodo/bagit/rights/Fallbeispiel-04.xml new file mode 100644 index 0000000000000000000000000000000000000000..d3d85e0d1a33e808b25e4cc9fa1d94c930061e4e --- /dev/null +++ b/export_dir_kitodo/bagit/rights/Fallbeispiel-04.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2017-01-01">Vereinbarung zur Digitalisierung und zur digitalen Präsentation von Beständen im Rahmen des Landesdigitalisierungsprogramms für Wissenschaft und Kultur zwischen Einrichtung X und der Sächsische Landesbibliothek – Staats- und Universitätsbibliothek Dresden (SLUB)</slubarchiv:contract> + <slubarchiv:license url="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</slubarchiv:license> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/rights/Fallbeispiel-05.xml b/export_dir_kitodo/bagit/rights/Fallbeispiel-05.xml new file mode 100644 index 0000000000000000000000000000000000000000..be18aee422a57d2b2106d4831f1ad7c71f8edfa8 --- /dev/null +++ b/export_dir_kitodo/bagit/rights/Fallbeispiel-05.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:orphanedWork/> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/rights/Fallbeispiel-06.xml b/export_dir_kitodo/bagit/rights/Fallbeispiel-06.xml new file mode 100644 index 0000000000000000000000000000000000000000..7edf44ca576d5d8dfb78fb03273ba46d2c3e2040 --- /dev/null +++ b/export_dir_kitodo/bagit/rights/Fallbeispiel-06.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2015-01-01">Rahmenvertrag zur Nutzung von vergriffenen Werken in Büchern zwischen Bund, Ländern, Verwertungsgesellschaft WORT und Verwertungsgesellschaft Bild-Kunst</slubarchiv:contract> + <slubarchiv:outOfPrintWork/> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/rights/Fallbeispiel-07.xml b/export_dir_kitodo/bagit/rights/Fallbeispiel-07.xml new file mode 100644 index 0000000000000000000000000000000000000000..5070a2b84fb4228c573aa7459fe726460cfb5e07 --- /dev/null +++ b/export_dir_kitodo/bagit/rights/Fallbeispiel-07.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2019-01-31">Vertrag zur Digitalisierung der Klemperer-Tagebücher zwischen dem Aufbau-Verlag und der SLUB</slubarchiv:contract> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/rights/Fallbeispiel-08a-undef.xml b/export_dir_kitodo/bagit/rights/Fallbeispiel-08a-undef.xml new file mode 100644 index 0000000000000000000000000000000000000000..75d2e3313cc9dec509857787ef41fff1f9ba80cd --- /dev/null +++ b/export_dir_kitodo/bagit/rights/Fallbeispiel-08a-undef.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-1.xsd"> + <slubarchiv:copyrightStatus>undefined</slubarchiv:copyrightStatus> + <slubarchiv:legalRestrictions> + <slubarchiv:childProtection>Nationalsozialistischer Inhalt</slubarchiv:childProtection> + </slubarchiv:legalRestrictions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/rights/Fallbeispiel-09.xml b/export_dir_kitodo/bagit/rights/Fallbeispiel-09.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e1f1373e688d698ce2902f17053af2d9d1291ac --- /dev/null +++ b/export_dir_kitodo/bagit/rights/Fallbeispiel-09.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2016-12-09">Kooperationsvereinbarung zwischen dem Freistaat Sachsen, vertreten durch das Landesamt für Umwelt, Landwirtschaft und Geologie (LfULG) und der Sächsischen Landesbibliothek - Staats- und Universitätsbibliothek Dresden (SLUB)</slubarchiv:contract> + </slubarchiv:permissions> + <slubarchiv:legalRestrictions> + <slubarchiv:confidentialContent>Dieses Dokument enthält Betriebs- und Geschäftsgeheimnisse.</slubarchiv:confidentialContent> + </slubarchiv:legalRestrictions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/rights/Fallbeispiel-10.xml b/export_dir_kitodo/bagit/rights/Fallbeispiel-10.xml new file mode 100644 index 0000000000000000000000000000000000000000..01fed1166c4ae81d1df0639fbc115e159421090c --- /dev/null +++ b/export_dir_kitodo/bagit/rights/Fallbeispiel-10.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2016-12-09">Kooperationsvereinbarung zwischen dem Freistaat Sachsen, vertreten durch das Landesamt für Umwelt, Landwirtschaft und Geologie (LfULG) und der Sächsischen Landesbibliothek - Staats- und Universitätsbibliothek Dresden (SLUB)</slubarchiv:contract> + </slubarchiv:permissions> + <slubarchiv:legalRestrictions> + <slubarchiv:confidentialContent>Dieses Dokument enthält Daten über sensible Einrichtungen.</slubarchiv:confidentialContent> + </slubarchiv:legalRestrictions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/rights/Fallbeispiel-11.xml b/export_dir_kitodo/bagit/rights/Fallbeispiel-11.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e97ef2f4c8309e5a0eef2c85214347313c7d418 --- /dev/null +++ b/export_dir_kitodo/bagit/rights/Fallbeispiel-11.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2016-12-09">Kooperationsvereinbarung zwischen dem Freistaat Sachsen, vertreten durch das Landesamt für Umwelt, Landwirtschaft und Geologie (LfULG) und der Sächsischen Landesbibliothek - Staats- und Universitätsbibliothek Dresden (SLUB)</slubarchiv:contract> + </slubarchiv:permissions> + <slubarchiv:legalRestrictions> + <slubarchiv:personalRight>Das Dokument enthält persönliche Daten, präzise Wohnorte oder andere Informationen mit Personenbezug.</slubarchiv:personalRight> + </slubarchiv:legalRestrictions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/rights/Fallbeispiel-12.xml b/export_dir_kitodo/bagit/rights/Fallbeispiel-12.xml new file mode 100644 index 0000000000000000000000000000000000000000..dd6aea1c55bfaa492d6b56aa276070509522aac2 --- /dev/null +++ b/export_dir_kitodo/bagit/rights/Fallbeispiel-12.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2016-12-09">Kooperationsvereinbarung zwischen dem Freistaat Sachsen, vertreten durch das Landesamt für Umwelt, Landwirtschaft und Geologie (LfULG) und der Sächsischen Landesbibliothek - Staats- und Universitätsbibliothek Dresden (SLUB)</slubarchiv:contract> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/rights/Fallbeispiel-13.xml b/export_dir_kitodo/bagit/rights/Fallbeispiel-13.xml new file mode 100644 index 0000000000000000000000000000000000000000..4b9b0dbaa786a0b27ce999db6d157791d41e32af --- /dev/null +++ b/export_dir_kitodo/bagit/rights/Fallbeispiel-13.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>publicdomain</slubarchiv:copyrightStatus> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/rights/Fallbeispiel-14.xml b/export_dir_kitodo/bagit/rights/Fallbeispiel-14.xml new file mode 100644 index 0000000000000000000000000000000000000000..d67bbe08e4579803dc08fc03c256707fa2bcac9d --- /dev/null +++ b/export_dir_kitodo/bagit/rights/Fallbeispiel-14.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2012-03-13">Lizenzvertrag zwischen der Sächsischen Landesbibliothek - Staats- und Universitätsbibliothek Dresden (SLUB) und dem Dresdner Geschichtsverein e.V., Redaktion Dresdner Hefte</slubarchiv:contract> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/rights/Fallbeispiel-15.xml b/export_dir_kitodo/bagit/rights/Fallbeispiel-15.xml new file mode 100644 index 0000000000000000000000000000000000000000..b0bd80dad0238ec384f7899342071b50493f6d92 --- /dev/null +++ b/export_dir_kitodo/bagit/rights/Fallbeispiel-15.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> + <slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2017-07-18">Einverständniserklärung für das elektronische Publizieren in den Digitalen Sammlungen der SLUB. Autor oder sonstige Rechteinhaber: Rat für Formgebung</slubarchiv:contract> + <slubarchiv:license url="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</slubarchiv:license> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/rights/Fallbeispiel-16.xml b/export_dir_kitodo/bagit/rights/Fallbeispiel-16.xml new file mode 100644 index 0000000000000000000000000000000000000000..8d9bddae032fcf5a266fb70e424f918b3485832f --- /dev/null +++ b/export_dir_kitodo/bagit/rights/Fallbeispiel-16.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:license url="https://www.govdata.de/dl-de/by-2-0">DL-DE BY 2.0</slubarchiv:license> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> diff --git a/export_dir_kitodo/bagit/test/data/test.txt b/export_dir_kitodo/bagit/test/data/test.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f3f31b13b1726146f8777621ec363583bbea240 --- /dev/null +++ b/export_dir_kitodo/bagit/test/data/test.txt @@ -0,0 +1 @@ +test file for payload. diff --git a/export_dir_kitodo/bagit/test/meta/Fallbeispiel-01.xml b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-01.xml new file mode 100644 index 0000000000000000000000000000000000000000..afc2677f84e2b7aeafeac8952251a514e5f461c5 --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-01.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>publicdomain</slubarchiv:copyrightStatus> +</slubarchiv:rightsRecord> diff --git a/export_dir_kitodo/bagit/test/meta/Fallbeispiel-02.xml b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-02.xml new file mode 100644 index 0000000000000000000000000000000000000000..54dd8318ee558560daae4ee320cec8b2742a5f0a --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-02.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2017-10-10">Vertrag zw. Herrn Mustermann und SLUB</slubarchiv:contract> + </slubarchiv:permissions> + <slubarchiv:legalRestrictions> + <slubarchiv:personalRight>Gerichtsurteil Amtsgericht Dresden, AZ: 2993/3829002A</slubarchiv:personalRight> + </slubarchiv:legalRestrictions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/test/meta/Fallbeispiel-03.xml b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-03.xml new file mode 100644 index 0000000000000000000000000000000000000000..562ad72c0cd1384291d2b4c5ed798a16eb1ce99f --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-03.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:license url="https://creativecommons.org/publicdomain/zero/1.0/">CC0 1.0</slubarchiv:license> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/test/meta/Fallbeispiel-04.xml b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-04.xml new file mode 100644 index 0000000000000000000000000000000000000000..d3d85e0d1a33e808b25e4cc9fa1d94c930061e4e --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-04.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2017-01-01">Vereinbarung zur Digitalisierung und zur digitalen Präsentation von Beständen im Rahmen des Landesdigitalisierungsprogramms für Wissenschaft und Kultur zwischen Einrichtung X und der Sächsische Landesbibliothek – Staats- und Universitätsbibliothek Dresden (SLUB)</slubarchiv:contract> + <slubarchiv:license url="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</slubarchiv:license> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/test/meta/Fallbeispiel-05.xml b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-05.xml new file mode 100644 index 0000000000000000000000000000000000000000..be18aee422a57d2b2106d4831f1ad7c71f8edfa8 --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-05.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:orphanedWork/> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/test/meta/Fallbeispiel-06.xml b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-06.xml new file mode 100644 index 0000000000000000000000000000000000000000..7edf44ca576d5d8dfb78fb03273ba46d2c3e2040 --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-06.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2015-01-01">Rahmenvertrag zur Nutzung von vergriffenen Werken in Büchern zwischen Bund, Ländern, Verwertungsgesellschaft WORT und Verwertungsgesellschaft Bild-Kunst</slubarchiv:contract> + <slubarchiv:outOfPrintWork/> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/test/meta/Fallbeispiel-07.xml b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-07.xml new file mode 100644 index 0000000000000000000000000000000000000000..5070a2b84fb4228c573aa7459fe726460cfb5e07 --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-07.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2019-01-31">Vertrag zur Digitalisierung der Klemperer-Tagebücher zwischen dem Aufbau-Verlag und der SLUB</slubarchiv:contract> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/test/meta/Fallbeispiel-08a-undef.xml b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-08a-undef.xml new file mode 100644 index 0000000000000000000000000000000000000000..75d2e3313cc9dec509857787ef41fff1f9ba80cd --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-08a-undef.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-1.xsd"> + <slubarchiv:copyrightStatus>undefined</slubarchiv:copyrightStatus> + <slubarchiv:legalRestrictions> + <slubarchiv:childProtection>Nationalsozialistischer Inhalt</slubarchiv:childProtection> + </slubarchiv:legalRestrictions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/test/meta/Fallbeispiel-09.xml b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-09.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e1f1373e688d698ce2902f17053af2d9d1291ac --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-09.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2016-12-09">Kooperationsvereinbarung zwischen dem Freistaat Sachsen, vertreten durch das Landesamt für Umwelt, Landwirtschaft und Geologie (LfULG) und der Sächsischen Landesbibliothek - Staats- und Universitätsbibliothek Dresden (SLUB)</slubarchiv:contract> + </slubarchiv:permissions> + <slubarchiv:legalRestrictions> + <slubarchiv:confidentialContent>Dieses Dokument enthält Betriebs- und Geschäftsgeheimnisse.</slubarchiv:confidentialContent> + </slubarchiv:legalRestrictions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/test/meta/Fallbeispiel-10.xml b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-10.xml new file mode 100644 index 0000000000000000000000000000000000000000..01fed1166c4ae81d1df0639fbc115e159421090c --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-10.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2016-12-09">Kooperationsvereinbarung zwischen dem Freistaat Sachsen, vertreten durch das Landesamt für Umwelt, Landwirtschaft und Geologie (LfULG) und der Sächsischen Landesbibliothek - Staats- und Universitätsbibliothek Dresden (SLUB)</slubarchiv:contract> + </slubarchiv:permissions> + <slubarchiv:legalRestrictions> + <slubarchiv:confidentialContent>Dieses Dokument enthält Daten über sensible Einrichtungen.</slubarchiv:confidentialContent> + </slubarchiv:legalRestrictions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/test/meta/Fallbeispiel-11.xml b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-11.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e97ef2f4c8309e5a0eef2c85214347313c7d418 --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-11.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2016-12-09">Kooperationsvereinbarung zwischen dem Freistaat Sachsen, vertreten durch das Landesamt für Umwelt, Landwirtschaft und Geologie (LfULG) und der Sächsischen Landesbibliothek - Staats- und Universitätsbibliothek Dresden (SLUB)</slubarchiv:contract> + </slubarchiv:permissions> + <slubarchiv:legalRestrictions> + <slubarchiv:personalRight>Das Dokument enthält persönliche Daten, präzise Wohnorte oder andere Informationen mit Personenbezug.</slubarchiv:personalRight> + </slubarchiv:legalRestrictions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/test/meta/Fallbeispiel-12.xml b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-12.xml new file mode 100644 index 0000000000000000000000000000000000000000..dd6aea1c55bfaa492d6b56aa276070509522aac2 --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-12.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2016-12-09">Kooperationsvereinbarung zwischen dem Freistaat Sachsen, vertreten durch das Landesamt für Umwelt, Landwirtschaft und Geologie (LfULG) und der Sächsischen Landesbibliothek - Staats- und Universitätsbibliothek Dresden (SLUB)</slubarchiv:contract> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/test/meta/Fallbeispiel-13.xml b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-13.xml new file mode 100644 index 0000000000000000000000000000000000000000..4b9b0dbaa786a0b27ce999db6d157791d41e32af --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-13.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>publicdomain</slubarchiv:copyrightStatus> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/test/meta/Fallbeispiel-14.xml b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-14.xml new file mode 100644 index 0000000000000000000000000000000000000000..d67bbe08e4579803dc08fc03c256707fa2bcac9d --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-14.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2012-03-13">Lizenzvertrag zwischen der Sächsischen Landesbibliothek - Staats- und Universitätsbibliothek Dresden (SLUB) und dem Dresdner Geschichtsverein e.V., Redaktion Dresdner Hefte</slubarchiv:contract> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/test/meta/Fallbeispiel-15.xml b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-15.xml new file mode 100644 index 0000000000000000000000000000000000000000..b0bd80dad0238ec384f7899342071b50493f6d92 --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-15.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> + <slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2017-07-18">Einverständniserklärung für das elektronische Publizieren in den Digitalen Sammlungen der SLUB. Autor oder sonstige Rechteinhaber: Rat für Formgebung</slubarchiv:contract> + <slubarchiv:license url="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</slubarchiv:license> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/test/meta/Fallbeispiel-16.xml b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-16.xml new file mode 100644 index 0000000000000000000000000000000000000000..8d9bddae032fcf5a266fb70e424f918b3485832f --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/Fallbeispiel-16.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:license url="https://www.govdata.de/dl-de/by-2-0">DL-DE BY 2.0</slubarchiv:license> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> diff --git a/export_dir_kitodo/bagit/test/meta/bubble.xml b/export_dir_kitodo/bagit/test/meta/bubble.xml new file mode 100644 index 0000000000000000000000000000000000000000..3713df5e6c931dce354bb643d687460931e91de9 --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/bubble.xml @@ -0,0 +1 @@ +this is my rights.xml \ No newline at end of file diff --git a/export_dir_kitodo/bagit/test/meta/lido.xml b/export_dir_kitodo/bagit/test/meta/lido.xml new file mode 100644 index 0000000000000000000000000000000000000000..19b16cc72c67d3a63e9545d4ad01635e85e4c8d9 --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/lido.xml @@ -0,0 +1 @@ +<xml></xml> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/test/meta/mods.xml b/export_dir_kitodo/bagit/test/meta/mods.xml new file mode 100644 index 0000000000000000000000000000000000000000..ab512e26c7d17e941357c4e439a6fd31d85dc568 --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/mods.xml @@ -0,0 +1,38 @@ +<mods:mods xmlns:mods="http://www.loc.gov/mods/v3"> +<mods:location> +<mods:physicalLocation authority="marcorg" displayLabel="Saxon State Library, Dresden, +Germany">DE-14</mods:physicalLocation> +<mods:shelfLocator>Hist.Sax.M.37.t,120</mods:shelfLocator> +</mods:location> +<mods:relatedItem type="series"> +<mods:titleInfo> +<mods:title>Saxonica</mods:title> +</mods:titleInfo> +</mods:relatedItem> +<mods:recordInfo> +<mods:recordIdentifier source="http://digital.slub-dresden.de/oai/">oai:de:slub-dresden:db:id- +319037843</mods:recordIdentifier> +</mods:recordInfo> +<mods:physicalDescription> +<mods:digitalOrigin>reformatted digital</mods:digitalOrigin> +<mods:extent>[1] Bl.</mods:extent> +</mods:physicalDescription> +<mods:identifier type="urn">urn:nbn:de:bsz:14-db-id3190378431</mods:identifier> +<mods:titleInfo> +<mods:title>Eingabe der Handelskammer zu Leipzig den Entwurf eines Tabak-Steuer-Gesetzes +betr.</mods:title> +<mods:subTitle>an den Reichstag zu Berlin</mods:subTitle> +</mods:titleInfo> +<mods:language> +<mods:languageTerm authority="rfc3066" type="code">de</mods:languageTerm> +</mods:language> +<mods:originInfo> +<mods:place> +<mods:placeTerm type="text">[Leipzig]</mods:placeTerm> +</mods:place> +<mods:dateIssued keyDate="yes">1893</mods:dateIssued> +</mods:originInfo> +<mods:subject authority="slub"> +<mods:topic>eingdehaz</mods:topic> +</mods:subject> +</mods:mods> diff --git a/export_dir_kitodo/bagit/test/meta/rights.xml b/export_dir_kitodo/bagit/test/meta/rights.xml new file mode 100644 index 0000000000000000000000000000000000000000..3201b82290c78afdb5e85650061cae25fe930e26 --- /dev/null +++ b/export_dir_kitodo/bagit/test/meta/rights.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-1.xsd"> + <slubarchiv:copyrightStatus>publicdomain</slubarchiv:copyrightStatus> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/export_dir_kitodo/bagit/test2/scans_tif/00000001.tif b/export_dir_kitodo/bagit/test2/scans_tif/00000001.tif new file mode 100644 index 0000000000000000000000000000000000000000..53ff885628eac6799fed0d9729f80c009eee8b3d Binary files /dev/null and b/export_dir_kitodo/bagit/test2/scans_tif/00000001.tif differ diff --git a/export_dir_kitodo/bagit/test2/scans_tif/00000002.tif b/export_dir_kitodo/bagit/test2/scans_tif/00000002.tif new file mode 100644 index 0000000000000000000000000000000000000000..b25d4e6c3f41f5a0dac1acd0c7bc8ed476c40820 Binary files /dev/null and b/export_dir_kitodo/bagit/test2/scans_tif/00000002.tif differ diff --git a/export_dir_kitodo/bagit/test2/test.txt b/export_dir_kitodo/bagit/test2/test.txt new file mode 100644 index 0000000000000000000000000000000000000000..1897e90346c2a60226554696f6b39c665ea9b589 --- /dev/null +++ b/export_dir_kitodo/bagit/test2/test.txt @@ -0,0 +1 @@ +test file for payload. diff --git a/export_dir_kitodo/bagit/test3/img/scans_tif/00000001.tif b/export_dir_kitodo/bagit/test3/img/scans_tif/00000001.tif new file mode 100644 index 0000000000000000000000000000000000000000..53ff885628eac6799fed0d9729f80c009eee8b3d Binary files /dev/null and b/export_dir_kitodo/bagit/test3/img/scans_tif/00000001.tif differ diff --git a/export_dir_kitodo/bagit/test3/img/scans_tif/00000002.tif b/export_dir_kitodo/bagit/test3/img/scans_tif/00000002.tif new file mode 100644 index 0000000000000000000000000000000000000000..b25d4e6c3f41f5a0dac1acd0c7bc8ed476c40820 Binary files /dev/null and b/export_dir_kitodo/bagit/test3/img/scans_tif/00000002.tif differ diff --git a/export_dir_kitodo/bagit/test3/test.txt b/export_dir_kitodo/bagit/test3/test.txt new file mode 100644 index 0000000000000000000000000000000000000000..1897e90346c2a60226554696f6b39c665ea9b589 --- /dev/null +++ b/export_dir_kitodo/bagit/test3/test.txt @@ -0,0 +1 @@ +test file for payload. diff --git a/lib/Archive/BagIt.pm b/lib/Archive/BagIt.pm new file mode 100644 index 0000000000000000000000000000000000000000..47fda772e48f72bcca7f11dd474e53eb4c707eb2 --- /dev/null +++ b/lib/Archive/BagIt.pm @@ -0,0 +1,530 @@ +package Archive::BagIt; + +use strict; +use 5.006; +use warnings; + + +# VERSION + +use utf8; +use open ':std', ':utf8'; +our @checksum_algos = qw(md5 sha1); +our $DEBUG=0; +use Encode qw(decode); +use File::Find; +use Data::Dumper; +#use Data::Printer; +=head1 WARNING + +This is experimental software for the moment and under active development. I +hope to have a beta version available soon. + +We use it fairly widely in-house, but it doesn't necessarily implement all of the specs. + +Email me with anything you need done urgently. + +Also: Check out Archive::BagIt::Fast if you are willing to add some extra dependencies to get +better speed by mmap-ing files. + +=head1 NAME + +Archive::BagIt - An interface to make and verify bags according to the BagIt standard + + +=head1 SYNOPSIS + +This modules will hopefully help with the basic commands needed to create +and verify a bag. My intention is not to be strict and enforce all of the +specification. The reference implementation is the java version +and I will endeavour to maintain compatibility with it. + + use Archive::BagIt; + + #read in an existing bag: + my $bag_dir = "/path/to/bag"; + my $bag = Archive::BagIt->new($bag_dir); + + + #construct bag in an existing directory + my $bag2 = Archive::BagIt->make_bag($bag_dir); + + # Validate a BagIt archive against its manifest + my $bag3 = Archive::BagIt->new($bag_dir); + my $is_valid = $bag3->verify_bag(); + + + + +=head1 SUBROUTINES + +=head2 new + +An Object Oriented Interface to a bag. Opens an existing bag. + + my $bag = Archive::BagIt->new('/path/to/bag'); + +=cut + +sub new { + my ($class,$bag_path) = @_; + my $self = {}; + bless $self, $class; + $bag_path=~s!/$!!; + $self->{'bag_path'} = $bag_path || ""; + if($bag_path) { + $self->_open(); + } + return $self; +} + +sub _open { + my($self) = @_; + + $self->_load_manifests(); + $self->_load_tagmanifests(); + + return $self; +} + +sub _load_manifests { + my ($self) = @_; + + my @manifests = $self->manifest_files(); + foreach my $manifest_file (@manifests) { + die("Cannot open $manifest_file: $!") unless (open (my $MANIFEST,"<:encoding(utf8)", $manifest_file)); + while (my $line = <$MANIFEST>) { + chomp($line); + my ($digest,$file); + ($digest, $file) = $line =~ /^([a-f0-9]+)\s+(.+)$/; + if(!$file) { + die ("This is not a valid manifest file"); + } else { + print "file: $file \n" if $DEBUG; + $self->{entries}->{$file} = $digest; + } + } + close($MANIFEST); + } + + return $self; + +} + +sub _load_tagmanifests { + my ($self) = @_; + + my @tagmanifests = $self->tagmanifest_files(); + foreach my $tagmanifest_file (@tagmanifests) { + die("Cannot open $tagmanifest_file: $!") unless (open(my $TAGMANIFEST,"<:encoding(utf8)", $tagmanifest_file)); + while (my $line = <$TAGMANIFEST>) { + chomp($line); + my($digest,$file) = split(/\s+/, $line, 2); + $self->{tagentries}->{$file} = $digest; + } + close($TAGMANIFEST); + + } + return $self; +} + +=head2 make_bag + +A constructor that will make and return a bag from a directory + +If a data directory exists, assume it is already a bag (no checking for invalid files in root) + +=cut + +sub make_bag { + my ($class, $bag_dir) = @_; + unless ( -d $bag_dir) { die ( "source bag directory doesn't exist"); } + unless ( -d $bag_dir."/data") { + rename ($bag_dir, $bag_dir.".tmp"); + mkdir ($bag_dir); + rename ($bag_dir.".tmp", $bag_dir."/data"); + } + my $self=$class->new($bag_dir); + $self->_write_bagit($bag_dir); + $self->_write_baginfo($bag_dir); + $self->_manifest_md5($bag_dir); + $self->_tagmanifest_md5($bag_dir); + $self->_open(); + return $self; +} + +sub _write_bagit { + my($self, $bagit) = @_; + open(my $BAGIT, ">", $bagit."/bagit.txt") or die("Can't open $bagit/bagit.txt for writing: $!"); + print($BAGIT "BagIt-Version: 0.97\nTag-File-Character-Encoding: UTF-8"); + close($BAGIT); + return 1; +} + + + +sub _write_baginfo { + use POSIX; + my($self, $bagit, %param) = @_; + open(my $BAGINFO, ">", $bagit."/bag-info.txt") or die("Can't open $bagit/bag-info.txt for writing: $!"); + $param{'Bagging-Date'} = POSIX::strftime("%F", gmtime(time)); + $param{'Bag-Software-Agent'} = 'Archive::BagIt <http://search.cpan.org/~rjeschmi/Archive-BagIt>'; + while(my($key, $value) = each(%param)) { + print($BAGINFO "$key: $value\n"); + } + close($BAGINFO); + return 1; +} + +sub _manifest_crc32 { + require String::CRC32; + my($self,$bagit) = @_; + my $manifest_file = "$bagit/manifest-crc32.txt"; + my $data_dir = "$bagit/data"; + + # Generate MD5 digests for all of the files under ./data + open(my $fh, ">:encoding(utf8)",$manifest_file) or die("Cannot create manifest-crc32.txt: $!\n"); + find( + sub { + $_=decode('utf8', $_); + my $file = decode('utf8', $File::Find::name); + if (-f $_) { + open(my $DATA, "<:encoding(utf8)", $_) or die("Cannot read $_: $!"); + my $digest = sprintf("%010d",crc32($DATA)); + close($DATA); + my $filename = substr($file, length($bagit) + 1); + print($fh "$digest $filename\n"); + } + }, + $data_dir + ); + close($fh); + return; +} + + +sub _manifest_md5 { + use Digest::MD5; + my($self, $bagit) = @_; + my $manifest_file = "$bagit/manifest-md5.txt"; + my $data_dir = "$bagit/data"; + print "creating manifest: $data_dir\n"; + # Generate MD5 digests for all of the files under ./data + open(my $md5_fh, ">:encoding(utf8)",$manifest_file) or die("Cannot create manifest-md5.txt: $!\n"); + find( + sub { + my $file = decode('utf8', $File::Find::name); + if (-f $_) { + open(my $DATA, "<:raw", "$_") or die("Cannot read $_: $!"); + my $digest = Digest::MD5->new->addfile($DATA)->hexdigest; + close($DATA); + my $filename = substr($file, length($bagit) + 1); + print($md5_fh "$digest $filename\n"); + #print "lineout: $digest $filename\n"; + } + }, + $data_dir + ); + close($md5_fh); + return; +} + +sub _tagmanifest_md5 { + my ($self, $bagit) = @_; + + use Digest::MD5; + + my $tagmanifest_file= "$bagit/tagmanifest-md5.txt"; + + open (my $md5_fh, ">:encoding(utf8)", $tagmanifest_file) or die ("Cannot create tagmanifest-md5.txt: $! \n"); + + find ( + sub { + $_ = decode('utf8',$_); + my $file = decode('utf8',$File::Find::name); + if ($_=~m/^data$/) { + $File::Find::prune=1; + } + elsif ($_=~m/^tagmanifest-.*\.txt/) { + # Ignore, we can't take digest from ourselves + } + elsif ( -f $_ ) { + open(my $DATA, "<:raw", "$_") or die("Cannot read $_: $!"); + my $digest = Digest::MD5->new->addfile($DATA)->hexdigest; + close($DATA); + my $filename = substr($file, length($bagit) + 1); + print($md5_fh "$digest $filename\n"); + } + }, $bagit); + + close($md5_fh); + return; +} + +=head2 verify_bag + +An interface to verify a bag. + +You might also want to check L<Archive::BagIt::Fast> to see a more direct way of +accessing files (and thus faster). + +=cut + +sub verify_bag { + my ($self,$opts) = @_; + #removed the ability to pass in a bag in the parameters, but might want options + #like $return all errors rather than dying on first one + my $bagit = $self->{'bag_path'}; + my $manifest_file = "$bagit/manifest-md5.txt"; + my $payload_dir = "$bagit/data"; + my %manifest = (); + my $return_all_errors = $opts->{return_all_errors}; + my %invalids; + my @payload = (); + + die("$manifest_file is not a regular file") unless -f ($manifest_file); + die("$payload_dir is not a directory") unless -d ($payload_dir); + + unless ($self->version() > .95) { + die ("Bag Version is unsupported"); + } + + # Read the manifest file + #print Dumper($self->{entries}); + foreach my $entry (keys(%{$self->{entries}})) { + $manifest{$entry} = $self->{entries}->{$entry}; + } + + # Compile a list of payload files + find(sub{ push(@payload, decode('utf8',$File::Find::name)) }, $payload_dir); + + # Evaluate each file against the manifest + my $digestobj = Digest::MD5->new(); + foreach my $file (@payload) { + next if (-d ($file)); + my $local_name = substr($file, length($bagit) + 1); + my ($digest); + #p %manifest; + unless ($manifest{$local_name}) { + die ("file found not in manifest: [$local_name]"); + } + #my $start_time=time(); + open(my $fh, "<:raw", "$bagit/$local_name") or die ("Cannot open $local_name"); + $digest = $digestobj->addfile($fh)->hexdigest; + close($fh); + #print "$bagit/$local_name md5 in ".(time()-$start_time)."\n"; + unless ($digest eq $manifest{$local_name}) { + if($return_all_errors) { + $invalids{$local_name} = $digest; + } + else { + die ("file: $local_name invalid"); + } + } + delete($manifest{$local_name}); + } + if($return_all_errors && keys(%invalids) ) { + foreach my $invalid (keys(%invalids)) { + print "invalid: $invalid hash: ".$invalids{$invalid}."\n"; + } + die ("bag verify failed with invalid files"); + } + # Make sure there are no missing files + if (keys(%manifest)) { die ("Missing files in bag"); } + + return 1; +} + +=head2 get_checksum + +This is the checksum for the bag, md5 of the manifest-md5.txt + +=cut + +sub get_checksum { + my($self) =@_; + my $bagit = $self->{'bag_path'}; + open(my $SRCFILE, "<:raw", $bagit."/manifest-md5.txt"); + my $srchex=Digest::MD5->new->addfile($SRCFILE)->hexdigest; + close($SRCFILE); + return $srchex; +} + +=head2 version + +Returns the bagit version according to the bagit.txt file. + +=cut + +sub version { + my($self) = @_; + my $bagit = $self->{'bag_path'}; + my $file = join("/", $bagit, "bagit.txt"); + open(my $BAGIT, "<", $file) or die("Cannot read $file: $!"); + my $version_string = <$BAGIT>; + my $encoding_string = <$BAGIT>; + close($BAGIT); + $version_string =~ /^BagIt-Version: ([0-9.]+)$/; + return $1 || 0; +} + +=head2 payload_files + +Returns an array with all of the payload files (those files that are below the data directory) + +=cut + +sub payload_files { + my($self) = @_; + my @payload = $self->_payload_files(); + return @payload; +} + +sub _payload_files{ + my($self) = @_; + + my $payload_dir = join( "/", $self->{"bag_path"}, "data"); + + my @payload=(); + File::Find::find( sub{ + + push(@payload,decode('utf8',$File::Find::name)); + #print "name: ".$File::Find::name."\n"; + }, $payload_dir); + + return @payload; + +} + +=head2 non_payload_files + +Returns an array with files that are in the root of the bag, non-manifest files + +=cut + +sub non_payload_files{ + my ($self) = @_; + my @non_payload = $self->_non_payload_files(); + return @non_payload; + +} + + +sub _non_payload_files { + my($self) = @_; + + my @payload = (); + File::Find::find( sub { + $File::Find::name = decode ('utf8', $File::Find::name); + if(-f $File::Find::name) { + my ($relpath) = ($File::Find::name=~m!$self->{"bag_path"}/(.*$)!); + push(@payload, $relpath); + } + elsif(-d _ && $_ eq "data") { + $File::Find::prune=1; + } + else { + #directories in the root other than data? + } + }, $self->{"bag_path"}); + + return @payload; + +} + + +=head2 manifest_files + +Return an array with the list of manifest files that exist in the bag + +=cut + +sub manifest_files { + my($self) = @_; + my @manifest_files; + foreach my $algo (@checksum_algos) { + my $manifest_file = $self->{"bag_path"}."/manifest-$algo.txt"; + if (-f $manifest_file) { + push @manifest_files, $manifest_file; + } + } + #print Dumper(@manifest_files); + return @manifest_files; +} + +=head2 tagmanifest_files + +Return an array with the list of tagmanifest files + +=cut + +sub tagmanifest_files { + my ($self) = @_; + my @tagmanifest_files; + foreach my $algo (@checksum_algos) { + my $tagmanifest_file = $self->{"bag_path"}."/tagmanifest-$algo.txt"; + if (-f $tagmanifest_file) { + push @tagmanifest_files, $tagmanifest_file; + } + } + return @tagmanifest_files; + +} +=head1 AUTHOR + +Robert Schmidt, E<lt>rjeschmi at gmail.comE<gt> +William Wueppelmann, E<lt>william at c7a.caE<gt> + + +=head1 BUGS + +Please report any bugs or feature requests to C<bug-archive-bagit at rt.cpan.org>, or through +the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Archive-BagIt>. I will be notified, and then you'll +automatically be notified of progress on your bug as I make changes. + + + + +=head1 SUPPORT + +You can find documentation for this module with the perldoc command. + + perldoc Archive::BagIt + + +You can also look for information at: + +=over 4 + +=item * RT: CPAN's request tracker (report bugs here) + +L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Archive-BagIt> + +=item * AnnoCPAN: Annotated CPAN documentation + +L<http://annocpan.org/dist/Archive-BagIt> + +=item * CPAN Ratings + +L<http://cpanratings.perl.org/d/Archive-BagIt> + +=item * Search CPAN + +L<http://search.cpan.org/dist/Archive-BagIt/> + +=back + + +=head1 COPYRIGHT + +Copyright (c) 2012, the above named author(s). + + +=head1 LICENSE + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +1; # End of Archive::BagIt diff --git a/lib/Archive/BagIt/Base.pm b/lib/Archive/BagIt/Base.pm new file mode 100644 index 0000000000000000000000000000000000000000..8c748523f7ba7d633bb1408a83f07927154dedbf --- /dev/null +++ b/lib/Archive/BagIt/Base.pm @@ -0,0 +1,744 @@ +use strict; +use warnings; + +package Archive::BagIt::Base; + +use Moose; +use namespace::autoclean; + +use utf8; +use open ':std', ':encoding(utf8)'; +use Encode qw(decode); +use File::Find; +use File::Spec; +use File::stat; +use Digest::MD5; +use Class::Load qw(load_class); +use Carp; + +# VERSION + +use Sub::Quote; + +my $DEBUG=0; + +=head1 NAME + +Achive::BagIt::Base - The common base for both Bagit and dotBagIt + +=cut + +has 'bag_path' => ( + is => 'rw', +); + +has 'bag_path_arr' => ( + is => 'ro', + lazy => 1, + builder => '_build_bag_path_arr', +); + +has 'metadata_path' => ( + is=> 'ro', + lazy => 1, + builder => '_build_metadata_path', +); + +sub _build_metadata_path { + my ($self) = @_; + return $self->bag_path; +} + + +has 'metadata_path_arr' => ( + is =>'ro', + lazy => 1, + builder => '_build_metadata_path_arr', +); + +has 'rel_metadata_path' => ( + is => 'ro', + lazy => 1, + builder => '_build_rel_metadata_path', +); + +has 'payload_path' => ( + is => 'ro', + lazy => 1, + builder => '_build_payload_path', +); + +sub _build_payload_path { + my ($self) = @_; + return $self->bag_path."/data"; +} + +has 'payload_path_arr' => ( + is => 'ro', + lazy => 1, + builder => '_build_payload_path_arr', +); + +has 'rel_payload_path' => ( + is => 'ro', + lazy => 1, + builder => '_build_rel_payload_path', +); + +has 'checksum_algos' => ( + is => 'ro', + lazy => 1, + builder => '_build_checksum_algos', +); + +has 'bag_version' => ( + is => 'ro', + lazy => 1, + builder => '_build_bag_version', +); + +has 'bag_info' => ( + is => 'rw', + lazy => 1, + builder => '_build_bag_info', +); + +# bag_info_by_key() +sub bag_info_by_key { + my ($self, $searchkey) = @_; + my $info = $self->bag_info(); + if (defined $searchkey) { + foreach my $entry (@{$info}) { + my ($key, $value) = each %{$entry}; + if (defined $key && $key eq $searchkey) { + return $value; + } + } + } + return; +} + + +sub _replace_bag_info_by_first_match { + my ($self, $searchkey, $newvalue) = @_; + my $info = $self->bag_info(); + if (defined $searchkey) { + if ($searchkey =~ m/:/) { croak "key should not contain a colon! (searchkey='$searchkey')"; } + my $size = scalar( @{$info}); + for (my $idx=0; $idx< $size; $idx++) { + my %entry = %{ $info->[$idx] }; + my ($key, $value) = each %entry; + if ((defined $key) && ($key eq $searchkey)) { + $info->[$idx] = {$searchkey => $newvalue}; + return $idx; + } + } + } + return; +} + +sub _add_or_replace_bag_info { + my ($self, $searchkey, $newvalue) = @_; + if (defined $searchkey) { + if ($searchkey =~ m/:/) { croak "key should not contain a colon! (searchkey='$searchkey')"; } + if (defined $self->{bag_info}) { + my $idx = $self->_replace_bag_info_by_first_match( $searchkey, $newvalue); + if (defined $idx) { return $idx;} + } + push @{$self->{bag_info}}, {$searchkey => $newvalue}; + return -1; + } +} + + +has 'forced_fixity_algorithm' => ( + is => 'ro', + lazy => 1, + builder => '_build_forced_fixity_algorithm', +); + +has 'bag_checksum' => ( + is => 'ro', + lazy => 1, + builder => '_build_bag_checksum', +); + +has 'manifest_files' => ( + is => 'ro', + lazy => 1, + builder => '_build_manifest_files', +); + +has 'tagmanifest_files' => ( + is => 'ro', + lazy => 1, + builder => '_build_tagmanifest_files', +); + +has 'manifest_entries' => ( + is => 'ro', + lazy => 1, + builder => '_build_manifest_entries', +); + +has 'tagmanifest_entries' => ( + is => 'ro', + lazy => 1, + builder => '_build_tagmanifest_entries', +); + +has 'payload_files' => ( # relatively to bagit base + is => 'ro', + lazy => 1, + builder => '_build_payload_files', +); + +has 'non_payload_files' => ( + is=>'ro', + lazy => 1, + builder => '_build_non_payload_files', +); + +has 'plugins' => ( + is=>'rw', + isa=>'HashRef', +); + +has 'manifests' => ( + is=>'rw', + isa=>'HashRef', +); + +has 'algos' => ( + is=>'rw', + isa=>'HashRef', + +); + +=head2 BUILDARGS + +The constructor sub, will create a bag with a single argument +=cut + +around 'BUILDARGS' , sub { + my $orig = shift; + my $class = shift; + if (@_ == 1 && !ref $_[0]) { + return $class->$orig(bag_path=>$_[0]); + } + else { + return $class->$orig(@_); + } +}; + +sub BUILD { + my ($self, $args) = @_; + return $self->load_plugins(("Archive::BagIt::Plugin::Manifest::MD5", "Archive::BagIt::Plugin::Manifest::SHA512")); +} + +sub _build_bag_path_arr { + my ($self) = @_; + my @split_path = File::Spec->splitdir($self->bag_path); + return @split_path; +} + +sub _build_payload_path_arr { + my ($self) = @_; + my @split_path = File::Spec->splitdir($self->payload_path); + return @split_path; +} + +sub _build_rel_payload_path { + my ($self) = @_; + my $rel_path = File::Spec->abs2rel( $self->payload_path, $self->bag_path ) ; + return $rel_path; +} + +sub _build_metadata_path_arr { + my ($self) = @_; + my @split_path = File::Spec->splitdir($self->metadata_path); + return @split_path; +} + +sub _build_rel_metadata_path { + my ($self) = @_; + my $rel_path = File::Spec->abs2rel( $self->metadata_path, $self->bag_path ) ; + return $rel_path; +} + +sub _build_checksum_algos { + my($self) = @_; + my $checksums = [ 'md5', 'sha1', 'sha256', 'sha512' ]; + return $checksums; +} + +sub _build_bag_checksum { + my($self) =@_; + my $bagit = $self->{'bag_path'}; + open(my $SRCFILE, "<:raw", $bagit."/manifest-md5.txt"); + my $srchex=Digest::MD5->new->addfile($SRCFILE)->hexdigest; + close($SRCFILE); + return $srchex; +} + +sub _build_manifest_files { + my($self) = @_; + my @manifest_files; + foreach my $algo (@{$self->checksum_algos}) { + my $manifest_file = $self->metadata_path."/manifest-$algo.txt"; + if (-f $manifest_file) { + push @manifest_files, $manifest_file; + } + } + #print Dumper(@manifest_files); + return \@manifest_files; +} + +sub _build_tagmanifest_files { + my ($self) = @_; + my @tagmanifest_files; + foreach my $algo (@{$self->checksum_algos}) { + my $tagmanifest_file = $self->metadata_path."/tagmanifest-$algo.txt"; + if (-f $tagmanifest_file) { + push @tagmanifest_files, $tagmanifest_file; + } + } + return \@tagmanifest_files; + +} + +sub _build_tagmanifest_entries { + my ($self) = @_; + + my @tagmanifests = @{$self->tagmanifest_files}; + my $tagmanifest_entries = {}; + foreach my $tagmanifest_file (@tagmanifests) { + die("Cannot open $tagmanifest_file: $!") unless (open(my $TAGMANIFEST,"<:encoding(utf8)", $tagmanifest_file)); + while (my $line = <$TAGMANIFEST>) { + chomp($line); + my($digest,$file) = split(/\s+/, $line, 2); + $tagmanifest_entries->{$file} = $digest; + } + close($TAGMANIFEST); + + } + return $tagmanifest_entries; +} + +sub _build_manifest_entries { + my ($self) = @_; + + my @manifests = @{$self->manifest_files}; + my $manifest_entries = {}; + foreach my $manifest_file (@manifests) { + die("Cannot open $manifest_file: $!") unless (open (my $MANIFEST, "<:encoding(utf8)", $manifest_file)); + while (my $line = <$MANIFEST>) { + chomp($line); + my ($digest,$file); + ($digest, $file) = $line =~ /^([a-f0-9]+)\s+(.+)/; + if(!$file) { + die ("This is not a valid manifest file"); + } else { + print "file: $file \n" if $DEBUG; + $manifest_entries->{$file} = $digest; + } + } + close($MANIFEST); + } + + return $manifest_entries; + +} + +sub _build_payload_files{ + my($self) = @_; + + my $payload_dir = $self->payload_path; + my $payload_reldir = $self->rel_payload_path; + + my @payload=(); + File::Find::find( sub{ + $File::Find::name = decode ('utf8', $File::Find::name); + $_ = decode ('utf8', $_); + if (-f $_) { + my $rel_path=File::Spec->catdir($self->rel_payload_path,File::Spec->abs2rel($File::Find::name, $payload_dir)); + push(@payload,$rel_path); + } + elsif($self->metadata_path_arr > $self->payload_path_arr && -d _ && $_ eq $self->rel_metadata_path) { + #print "pruning ".$File::Find::name."\n"; + $File::Find::prune=1; + } + else { + #payload directories + } + #print "name: ".$File::Find::name."\n"; + }, $payload_dir); + + #print p(@payload); + + return wantarray ? @payload : \@payload; + +} + +sub _build_bag_version { + my($self) = @_; + my $bagit = $self->metadata_path; + my $file = join("/", $bagit, "bagit.txt"); + open(my $BAGIT, "<", $file) or die("Cannot read $file: $!"); + my $version_string = <$BAGIT>; + my $encoding_string = <$BAGIT>; + close($BAGIT); + $version_string =~ /^BagIt-Version: ([0-9.]+)$/; + return $1 || 0; +} + +sub __sort_bag_info { + my @sorted = sort { + my %tmpa = %{$a}; + my %tmpb = %{$b}; + my ($ka, $va) = each %tmpa; + my ($kb, $vb) = each %tmpb; + my $kres = $ka cmp $kb; + if ($kres != 0) { + return $kres; + } else { + return $va cmp $vb; + } + } @_; + return @sorted; +} + +sub _parse_bag_info { # parses a bag-info textblob + my ($self, $textblob) = @_; + # metadata elements are OPTIONAL and MAY be repeated. Because "bag- + # info.txt" is intended for human reading and editing, ordering MAY be + # significant and the ordering of metadata elements MUST be preserved. + # + # A metadata element MUST consist of a label, a colon ":", a single + # linear whitespace character (space or tab), and a value that is + # terminated with an LF, a CR, or a CRLF. + # + # The label MUST NOT contain a colon (:), LF, or CR. The label MAY + # contain linear whitespace characters but MUST NOT start or end with + # whitespace. + # + # It is RECOMMENDED that lines not exceed 79 characters in length. + # Long values MAY be continued onto the next line by inserting a LF, + # CR, or CRLF, and then indenting the next line with one or more linear + # white space characters (spaces or tabs). Except for linebreaks, such + # padding does not form part of the value. + # + # Implementations wishing to support previous BagIt versions MUST + # accept multiple linear whitespace characters before and after the + # colon when the bag version is earlier than 1.0; such whitespace does + # not form part of the label or value. + # find all labels + my @labels; + while ($textblob =~ s/^([^:\s]+)\s*:\s*//m) { # label if starts with chars not colon or whitespace followed by zero or more spaces, a colon, zero or more spaces + # label found + my $label = $1; my $value=""; + + if ($textblob =~ s/(.+?)(?=^\S)//ms) { + # value if rest string starts with chars not \r and/or \n until a non-whitespace after \r\n + $value =$1; + chomp $value; + } elsif ($textblob =~ s/(.*)//s) { + $value = $1; + chomp $value; + } + if (defined $label) { + push @labels, { "$label" => "$value" }; + } + } + # The RFC does not allow reordering: + #my @sorted = __sort_bag_info(@labels); + #return \@sorted; + return \@labels; +} + +sub _build_bag_info { + my ($self) = @_; + my $bagit = $self->metadata_path; + my $file = join("/", $bagit, "bag-info.txt"); + open(my $BAGINFO, "<", $file) or die("Cannot read $file: $!"); + my @lines; + foreach my $line (<$BAGINFO>) { + push @lines, $line; + } + close($BAGINFO); + my $lines = join("", @lines); + return $self->_parse_bag_info ($lines); + +} + +sub _build_non_payload_files { + my($self) = @_; + + my @non_payload = (); + + File::Find::find( sub{ + $File::Find::name = decode('utf8', $File::Find::name); + $_=decode ('utf8', $_); + if (-f $_) { + my $rel_path=File::Spec->catdir($self->rel_metadata_path,File::Spec->abs2rel($File::Find::name, $self->metadata_path)); + #print "pushing ".$rel_path." payload_dir: $payload_dir \n"; + push(@non_payload,$rel_path); + } + elsif($self->metadata_path_arr < $self->payload_path_arr && -d _ && $_ eq $self->rel_payload_path) { + #print "pruning ".$File::Find::name."\n"; + $File::Find::prune=1; + } + else { + #payload directories + } + #print "name: ".$File::Find::name."\n"; + }, $self->metadata_path); + + return wantarray ? @non_payload : \@non_payload; + +} + +sub _build_forced_fixity_algorithm { + my ($self) = @_; + if ($self->bag_version() >= 1.0) { + return Archive::BagIt::Plugin::Algorithm::SHA512->new(bagit => $self); + } + else { + return Archive::BagIt::Plugin::Algorithm::MD5->new(bagit => $self); + } +} + +=head2 load_plugins + +As default SHA512 and MD5 will be loaded and therefore used. If you want to create a bag only with one or a specific +checksum-algorithm, you could use this method to (re-)register it. It expects list of strings with namespace of type: +Archive::BagIt::Plugin::Algorithm::XXX where XXX is your chosen fixity algorithm. + +=cut + +sub load_plugins { + my ($self, @plugins) = @_; + + #p(@plugins); + my $loaded_plugins = $self->plugins; + @plugins = grep { not exists $loaded_plugins->{$_} } @plugins; + + return if @plugins == 0; + foreach my $plugin (@plugins) { + load_class ($plugin) or die ("Can't load $plugin"); + $plugin->new({bagit => $self}); + } + + return 1; +} + +=head2 verify_bag + +An interface to verify a bag. + +You might also want to check Archive::BagIt::Fast to see a more direct way of accessing files (and thus faster). + + +=cut + +sub verify_bag { + my ($self,$opts) = @_; + #removed the ability to pass in a bag in the parameters, but might want options + #like $return all errors rather than dying on first one + my $bagit = $self->bag_path; + my $version = $self->bag_version(); # to call trigger + my $manifest_file = $self->metadata_path."/manifest-".$self->forced_fixity_algorithm()->name().".txt"; # FIXME: use plugin instead + my $payload_dir = $self->payload_path; + my $return_all_errors = $opts->{return_all_errors}; + my %invalids; + my @payload = @{$self->payload_files}; + + die("$manifest_file is not a regular file for bagit $version") unless -f ($manifest_file); + die("$payload_dir is not a directory") unless -d ($payload_dir); + + unless ($version > .95) { + die ("Bag Version $version is unsupported"); + } + + # Read the manifest file + #print Dumper($self->{entries}); + my %manifest = %{$self->manifest_entries}; + + # Evaluate each file against the manifest + my $digestobj = $self->forced_fixity_algorithm(); + foreach my $local_name (@payload) { # local_name is relative to bagit base + my ($digest); + unless ($manifest{"$local_name"}) { + die ("file found not in manifest: [$local_name] (bag-path:$bagit)"); + } + if (! -r "$bagit/$local_name" ) {die ("Cannot open $bagit/$local_name");} + $digest = $digestobj->verify_file( "$bagit/$local_name"); + print "digest of $bagit/$local_name: $digest\n" if $DEBUG; + unless ($digest eq $manifest{$local_name}) { + if($return_all_errors) { + $invalids{$local_name} = $digest; + } + else { + die ("file: $bagit/$local_name invalid"); + } + } + delete($manifest{$local_name}); + } + if($return_all_errors && keys(%invalids) ) { + foreach my $invalid (keys(%invalids)) { + print "invalid: $invalid hash: ".$invalids{$invalid}."\n"; + } + die ("bag verify for bagit $version failed with invalid files"); + } + # Make sure there are no missing files + if (keys(%manifest)) { die ("Missing files in bag".p(%manifest)); } + + return 1; +} + +=head2 calc_payload_oxum() + +returns an array with octets and streamcount of payload-dir + +=cut + + + +sub calc_payload_oxum { + my($self) = @_; + my @payload = @{$self->payload_files}; + my $octets=0; + my $streamcount = scalar @payload; + foreach my $local_name (@payload) {# local_name is relative to bagit base + my $file = $self->bag_path()."/$local_name"; + my $sb = stat($file); + $octets += $sb->size; + } + return ($octets, $streamcount); +} + +=head2 calc_bagsize() + +returns a string with human readable size of paylod + +=cut + +sub calc_bagsize { + my($self) = @_; + my ($octets,$streamcount) = $self->calc_payload_oxum(); + if ($octets < 1024) { return "$octets B"; } + elsif ($octets < 1024*1024) {return sprintf("%0.1f kB", $octets/1024); } + elsif ($octets < 1024*1024*1024) {return sprintf "%0.1f MB", $octets/(1024*1024); } + elsif ($octets < 1024*1024*1024*1024) {return sprintf "%0.1f GB", $octets/(1024*1024*1024); } + else { return sprintf "%0.2f TB", $octets/(1024*1024*1024*1024); } +} + +sub create_bagit { + my($self) = @_; + open(my $BAGIT, ">", $self->metadata_path."/bagit.txt") or die("Can't open $self->metadata_path/bagit.txt for writing: $!"); + print($BAGIT "BagIt-Version: 1.0\nTag-File-Character-Encoding: UTF-8"); + close($BAGIT); + return 1; +} + +# FIXME: How to add user staff in bag-info.txt? +sub create_baginfo { + use POSIX; + my($self) = @_; # because bag-info.txt allows multiple key-value-entries, hash is replaced + $self->_add_or_replace_bag_info('Bagging-Date', POSIX::strftime("%F", gmtime(time))); + $self->_add_or_replace_bag_info('Bag-Software-Agent', 'Archive::BagIt <https://metacpan.org/pod/Archive::BagIt>'); + my ($octets, $streams) = $self->calc_payload_oxum(); + $self->_add_or_replace_bag_info('Payload-Oxum', "$octets.$streams"); + $self->_add_or_replace_bag_info('Bag-Size', $self->calc_bagsize()); + # The RFC does not allow reordering: + open(my $BAGINFO, ">", $self->metadata_path."/bag-info.txt") or die("Can't open $self->metadata_path/bag-info.txt for writing: $!"); + foreach my $entry (@{ $self->bag_info() }) { + my %tmp = %{ $entry }; + my ($key, $value) = each %tmp; + if ($key =~ m/:/) { carp "key should not contain a colon! (searchkey='$key')"; } + print($BAGINFO "$key: $value\n"); + } + close($BAGINFO); + return 1; +} + +=head2 store + +store a bagit-obj if bagit directory-structure was already constructed, + +=cut + +sub store { + my($self) = @_; + $self->create_bagit(); + $self->create_baginfo(); + # it is important to create all manifest files first, because tagmanifest should include all manifest-xxx.txt + foreach my $algorithm ( keys %{ $self->manifests }) { + $self->manifests->{$algorithm}->create_manifest(); + } + foreach my $algorithm ( keys %{ $self->manifests }) { + + $self->manifests->{$algorithm}->create_tagmanifest(); + } + return 1; +} + +=head2 init_metadata + +A constructor that will just create the metadata directory + +This won't make a bag, but it will create the conditions to do that eventually + +=cut + +sub init_metadata { + my ($class, $bag_path) = @_; + unless ( -d $bag_path) { die ( "source bag directory doesn't exist"); } + my $self = $class->new(bag_path=>$bag_path); + warn "no payload path\n" if ! -d $self->payload_path; + unless ( -d $self->payload_path) { + rename ($bag_path, $bag_path.".tmp"); + mkdir ($bag_path); + rename ($bag_path.".tmp", $self->payload_path); + } + unless ( -d $self->metadata_path) { + #metadata path is not the root path for some reason + mkdir ($self->metadata_path); + } + + $self->store(); + + # FIXME: deprecated? + #foreach my $algorithm (keys %{$self->manifests}) { + #$self->manifests->{$algorithm}->create_bagit(); + #$self->manifests->{$algorithm}->create_baginfo(); + #} + + return $self; +} + + +=head2 make_bag + +A constructor that will make and return a bag from a directory, + +It expects a preliminary bagit-dir exists. +If there a data directory exists, assume it is already a bag (no checking for invalid files in root) + + +=cut + +sub make_bag { + my ($class, $bag_path) = @_; + my $isa = ref $class; + if ($isa eq "Archive::BagIt::Base") { # not a class, but an object! + die "make_bag() only a class subroutine, not useable with objects. Try store() instead!\n"; + } + my $self = $class->init_metadata($bag_path); + return $self; +} + + +__PACKAGE__->meta->make_immutable; + +1; diff --git a/lib/Archive/BagIt/DotBagIt.pm b/lib/Archive/BagIt/DotBagIt.pm new file mode 100644 index 0000000000000000000000000000000000000000..fc746e26077a0c5a75fb92d3dc3888f6acde028b --- /dev/null +++ b/lib/Archive/BagIt/DotBagIt.pm @@ -0,0 +1,43 @@ +use strict; +use warnings; + + +package Archive::BagIt::DotBagIt; + +# VERSION + +use Sub::Quote; +use Moose; + +extends "Archive::BagIt::Base"; + +=head1 NAME + +Archive::BagIt::DotBagIt - The inside-out version of BagIt + +=cut + +has 'metadata_path' => ( + is=> 'ro', + lazy => 1, + builder => '_build_metadata_path', +); + +sub _build_metadata_path { + my ($self) = @_; + return $self->bag_path."/.bagit"; +} + +has 'payload_path' => ( + is => 'ro', + lazy => 1, + builder => '_build_payload_path', +); + +sub _build_payload_path { + my ($self) = @_; + return $self->bag_path; + +} + +1; diff --git a/lib/Archive/BagIt/Fast.pm b/lib/Archive/BagIt/Fast.pm new file mode 100644 index 0000000000000000000000000000000000000000..a9a659d8e7ba2d6862dccdfcfab313d7d0b0613e --- /dev/null +++ b/lib/Archive/BagIt/Fast.pm @@ -0,0 +1,94 @@ +package Archive::BagIt::Fast; + +use strict; +use warnings; +use parent "Archive::BagIt"; + +# VERSION + +use IO::AIO; +use Time::HiRes qw(time); +=head1 NAME + +Archive::BagIt::Fast - For people who are willing to rely on some other modules in order to get better performance + +=cut + + + +sub verify_bag { + my ($self,$opts) = @_; + use IO::AIO; + #removed the ability to pass in a bag in the parameters, but might want options + #like $return all errors rather than dying on first one + my $bagit = $self->{'bag_path'}; + my $manifest_file = "$bagit/manifest-md5.txt"; + my $payload_dir = "$bagit/data"; + my %manifest = (); + my $return_all_errors = $opts->{return_all_errors}; + my $MMAP_MIN = $opts->{mmap_min} || 8000000; + my %invalids; + my @payload = (); + die("$manifest_file is not a regular file") unless -f ($manifest_file); + die("$payload_dir is not a directory") unless -d ($payload_dir); + # Read the manifest file + #print Dumper($self->{entries}); + foreach my $entry (keys( @{$self->{entries}})) { + $manifest{$entry} = $self->{entries}->{$entry}; + } + # Compile a list of payload files + File::Find::find(sub{ push(@payload, $File::Find::name) }, $payload_dir); + # Evaluate each file against the manifest + my $digestobj = new Digest::MD5; # FIXME: use plugins instead + foreach my $file (@payload) { + next if (-d ($file)); + my $local_name = substr($file, length($bagit) + 1); + my ($digest); + unless ($manifest{$local_name}) { + die ("file found not in manifest: [$local_name]"); + } + + open(my $fh, "<:raw", "$bagit/$local_name") or die ("Cannot open $local_name"); + stat $fh; + $self->{stats}->{files}->{"$bagit/$local_name"}->{size}= -s _; + $self->{stats}->{size} += -s _; + my $start_time = time(); + if (-s _ < $MMAP_MIN ) { + sysread $fh, my $data, -s _; + $digest = $digestobj->add($data)->hexdigest; + } + elsif ( -s _ < 1500000000) { + IO::AIO::mmap my $data, -s _, IO::AIO::PROT_READ, IO::AIO::MAP_SHARED, $fh or die "mmap: $!"; + $digest = $digestobj->add($data)->hexdigest; + } + else { + $digest = $digestobj->addfile($fh)->hexdigest; # FIXME: use plugins instead + } + my $finish_time = time(); + $self->{stats}->{files}->{"$bagit/$local_name"}->{verify_time}= ($finish_time - $start_time); + $self->{stats}->{verify_time} += ($finish_time-$start_time); + close($fh); + unless ($digest eq $manifest{$local_name}) { + if($return_all_errors) { + $invalids{$local_name} = $digest; + } + else { + die ("file: $local_name invalid"); + } + } + delete($manifest{$local_name}); + } + if($return_all_errors && keys(%invalids) ) { + foreach my $invalid (keys(%invalids)) { + print "invalid: $invalid hash: ".$invalids{$invalid}."\n"; + } + die ("bag verify failed with invalid files"); + } + # Make sure there are no missing files + if (keys(%manifest)) { die ("Missing files in bag"); } + + return 1; +} + + +1; diff --git a/lib/Archive/BagIt/Plugin/Algorithm/MD5.pm b/lib/Archive/BagIt/Plugin/Algorithm/MD5.pm new file mode 100644 index 0000000000000000000000000000000000000000..e08094a04ed92c1bbd798deafd7121e7e7aa89d7 --- /dev/null +++ b/lib/Archive/BagIt/Plugin/Algorithm/MD5.pm @@ -0,0 +1,59 @@ +use strict; +use warnings; + +#ABSTRACT: The default MD5 algorithm plugin + +package Archive::BagIt::Plugin::Algorithm::MD5; + +use Moose; +use namespace::autoclean; + +with 'Archive::BagIt::Role::Algorithm'; + +has 'plugin_name' => ( + is => 'ro', + default => 'Archive::BagIt::Plugin::Algorithm::MD5', +); + +has 'name' => ( + is => 'ro', + isa => 'Str', + default => 'md5', +); + +has '_digest_md5' => ( + is => 'ro', + lazy => 1, + builder => '_build_digest_md5', + init_arg => undef, +); + +sub _build_digest_md5 { + my ($self) = @_; + my $digest_md5 = new Digest::MD5; + return $digest_md5; +} + +sub get_hash_string { + my ($self, $fh) = @_; + my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) + = stat $fh; + my $buffer; + while (read($fh, $buffer, $blksize)) { + $self->_digest_md5->add($buffer); + } + return $self->_digest_md5->hexdigest; + +} + +sub verify_file { + my ($self, $filename) = @_; + open(my $fh, '<', $filename) || die ("Can't open '$filename', $!"); + binmode($fh); + my $digest = $self->get_hash_string($fh); + close $fh || die("could not close file '$filename', $!"); + return $digest; +} +__PACKAGE__->meta->make_immutable; +1; diff --git a/lib/Archive/BagIt/Plugin/Algorithm/SHA512.pm b/lib/Archive/BagIt/Plugin/Algorithm/SHA512.pm new file mode 100644 index 0000000000000000000000000000000000000000..9ffa6fcf32b0459fe19eb7671c837b8b270b5334 --- /dev/null +++ b/lib/Archive/BagIt/Plugin/Algorithm/SHA512.pm @@ -0,0 +1,58 @@ +use strict; +use warnings; + +#ABSTRACT: The default SHA algorithms plugin + +package Archive::BagIt::Plugin::Algorithm::SHA512; + +use Moose; +use namespace::autoclean; + +with 'Archive::BagIt::Role::Algorithm'; + +has 'plugin_name' => ( + is => 'ro', + default => 'Archive::BagIt::Plugin::Algorithm::SHA512', +); + +has 'name' => ( + is => 'ro', + isa => 'Str', + default => 'sha512', +); + +has '_digest_sha' => ( + is => 'ro', + lazy => 1, + builder => '_build_digest_sha', + init_arg => undef, +); + +sub _build_digest_sha { + my ($self) = @_; + my $digest = Digest::SHA->new("512"); + return $digest; +} + +sub get_hash_string { + my ($self, $fh) = @_; + my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) + = stat $fh; + my $buffer; + while (read($fh, $buffer, $blksize)) { + $self->_digest_sha->add($buffer); + } + return $self->_digest_sha->hexdigest; +} + +sub verify_file { + my ($self, $filename) = @_; + open(my $fh, '<', $filename) || die ("Can't open '$filename', $!"); + binmode($fh); + my $digest = $self->get_hash_string($fh); + close $fh || die("could not close file '$filename', $!"); + return $digest; +} +__PACKAGE__->meta->make_immutable; +1; diff --git a/lib/Archive/BagIt/Plugin/Manifest/MD5.pm b/lib/Archive/BagIt/Plugin/Manifest/MD5.pm new file mode 100644 index 0000000000000000000000000000000000000000..befc7b29304d086492deb05aed47d86bc87269ee --- /dev/null +++ b/lib/Archive/BagIt/Plugin/Manifest/MD5.pm @@ -0,0 +1,48 @@ +use strict; +use warnings; + +#ABSTRACT: The md5 plugin (default) +package Archive::BagIt::Plugin::Manifest::MD5; + +use Moose; +with 'Archive::BagIt::Role::Manifest'; + + +use Digest::MD5; +use Sub::Quote; + +has 'plugin_name' => ( + is => 'ro', + default => 'Archive::BagIt::Plugin::Manifest::MD5', +); + +has 'manifest_path' => ( + is => 'ro', +); + +has 'manifest_files' => ( + is => 'ro', +); + +has 'algorithm' => ( + is => 'rw', +); + +sub BUILD { + my ($self) = @_; + $self->bagit->load_plugins(("Archive::BagIt::Plugin::Algorithm::MD5")); + $self->algorithm($self->bagit->plugins->{"Archive::BagIt::Plugin::Algorithm::MD5"}); +} + +sub verify_file { + my ($self, $fh) = @_; +} + +sub verify { + my ($self) =@_; + + +} + + +1; diff --git a/lib/Archive/BagIt/Plugin/Manifest/SHA512.pm b/lib/Archive/BagIt/Plugin/Manifest/SHA512.pm new file mode 100644 index 0000000000000000000000000000000000000000..b7932a1a4b4847da1d7d12e3685caf7571495814 --- /dev/null +++ b/lib/Archive/BagIt/Plugin/Manifest/SHA512.pm @@ -0,0 +1,48 @@ +use strict; +use warnings; + +#ABSTRACT: The md5 plugin (default) +package Archive::BagIt::Plugin::Manifest::SHA512; + +use Moose; +with 'Archive::BagIt::Role::Manifest'; + + +use Digest::SHA; +use Sub::Quote; + +has 'plugin_name' => ( + is => 'ro', + default => 'Archive::BagIt::Plugin::Manifest::SHA512', +); + +has 'manifest_path' => ( + is => 'ro', +); + +has 'manifest_files' => ( + is => 'ro', +); + +has 'algorithm' => ( + is => 'rw', +); + +sub BUILD { + my ($self) = @_; + $self->bagit->load_plugins(("Archive::BagIt::Plugin::Algorithm::SHA512")); + $self->algorithm($self->bagit->plugins->{"Archive::BagIt::Plugin::Algorithm::SHA512"}); +} + +sub verify_file { + my ($self, $fh) = @_; +} + +sub verify { + my ($self) =@_; + + +} + + +1; diff --git a/lib/Archive/BagIt/Role/Algorithm.pm b/lib/Archive/BagIt/Role/Algorithm.pm new file mode 100644 index 0000000000000000000000000000000000000000..ab2cfd23a19e9d5ea69dc67cec4c3a8557303329 --- /dev/null +++ b/lib/Archive/BagIt/Role/Algorithm.pm @@ -0,0 +1,38 @@ +use strict; +use warnings; + +#ABSTRACT: A role that defines the interface to a hashing algorithm +# + +package Archive::BagIt::Role::Algorithm; + +use Moose::Role; +with 'Archive::BagIt::Role::Plugin'; + +use Data::Printer; + +has 'name' => ( + is => 'ro', +); + + +sub get_hash_string { + my ($self, $fh) = @_; +} + +sub verify_file { + my ($self, $fh) = @_; +} + +sub register_plugin { + my ($class, $bagit) =@_; + + my $self = $class->new({bagit=>$bagit}); + + my $plugin_name = $self->plugin_name; + #p ($self); + $self->bagit->plugins( { $plugin_name => $self }); + $self->bagit->algos( {$self->name => $self }); +} + +1; diff --git a/lib/Archive/BagIt/Role/Manifest.pm b/lib/Archive/BagIt/Role/Manifest.pm new file mode 100644 index 0000000000000000000000000000000000000000..25b0daa27bc82dc84db9dc36f5344209baf15186 --- /dev/null +++ b/lib/Archive/BagIt/Role/Manifest.pm @@ -0,0 +1,79 @@ +use strict; +use warnings; +package Archive::BagIt::Role::Manifest; + +use Moose::Role; +with 'Archive::BagIt::Role::Plugin'; + +use namespace::autoclean; + +has 'algorithm' => ( + is => 'rw', + isa=>'HashRef', +); + +sub BUILD {} + +after BUILD => sub { + my $self = shift; + my $algorithm = $self->algorithm->name; + $self->{bagit}->{manifests}->{$algorithm} = $self; +}; + +sub verify_file { + +} + +sub verify { + +} + +sub manifest { + +} + +sub create_manifest { + my ($self) = @_; + + my $algo = $self->algorithm->name; + my $manifest_file = $self->bagit->metadata_path."/manifest-${algo}.txt"; + # Generate digests for all of the files under ./data + open(my $fh, ">",$manifest_file) or die("Cannot create manifest-${algo}.txt: $!\n"); + foreach my $rel_payload_file (@{$self->bagit->payload_files}) { + #print "rel_payload_file: ".$rel_payload_file; + my $payload_file = File::Spec->catdir($self->bagit->bag_path, $rel_payload_file); + my $digest = $self->algorithm->verify_file( $payload_file ); + print($fh "$digest $rel_payload_file\n"); + #print "lineout: $digest $filename\n"; + } + close($fh); + +} + +sub create_tagmanifest { + my ($self) = @_; + + my $algo = $self->algorithm->name; + my $tagmanifest_file= $self->bagit->metadata_path."/tagmanifest-${algo}.txt"; + + open (my $fh, ">", $tagmanifest_file) or die ("Cannot create tagmanifest-${algo}.txt: $! \n"); + + foreach my $rel_nonpayload_file (@{$self->bagit->non_payload_files}) { + my $nonpayload_file = File::Spec->catdir($self->bagit->bag_path, $rel_nonpayload_file); + if ($rel_nonpayload_file=~m/tagmanifest-.*\.txt$/) { + # Ignore, we can't take digest from ourselves + } + elsif ( -f $nonpayload_file ) { # non-payload is all which is not payload, this allows user to define and handle own subdirs + my $digest = $self->algorithm->verify_file( $nonpayload_file ); + print($fh "$digest $rel_nonpayload_file\n"); + } + else { + die("A file or directory that doesn't match: $rel_nonpayload_file"); + } + } + + close($fh); +} + + +1; diff --git a/lib/Archive/BagIt/Role/Plugin.pm b/lib/Archive/BagIt/Role/Plugin.pm new file mode 100644 index 0000000000000000000000000000000000000000..3e7a8b307c84151ae59eb8ef0d5164e9925d5bd2 --- /dev/null +++ b/lib/Archive/BagIt/Role/Plugin.pm @@ -0,0 +1,28 @@ +use strict; +use warnings; +package Archive::BagIt::Role::Plugin; + +use Moose::Role; + +use namespace::autoclean; + +has plugin_name => ( + is => 'ro', + isa => 'Str', + default => __PACKAGE__, +); + +has bagit => ( + is => 'ro', + isa => 'Archive::BagIt::Base', + required => 1, + weak_ref => 1, +); + +sub BUILD { + my ($self) = @_; + my $plugin_name = $self->plugin_name; + $self->bagit->plugins( { $plugin_name => $self }); +} + +1; diff --git a/t/slubsipbuilder.t b/t/slubsipbuilderbagit.t old mode 100755 new mode 100644 similarity index 61% rename from t/slubsipbuilder.t rename to t/slubsipbuilderbagit.t index 6c5549955e452742908edab08a4c52cc8e691482..fe7e7a0c6a4657765500a6e414ed1eb006080a8b --- a/t/slubsipbuilder.t +++ b/t/slubsipbuilderbagit.t @@ -1,691 +1,683 @@ -#!/usr/bin/perl -w -use strict; -use warnings; -use diagnostics; - -use Test::More tests => 78; -use Test::Output; -use Test::Exception; -use Test::File; -use Path::Tiny; - -# *** Read before running tests *** -# Warning: While running project "SLUB_SIP_Builder" two directories "export_dir_kitodo" and "tmp/mysip" will be created. -# Start scipt in the project directory to run all tests properly. - -### prepare -BEGIN { - use Path::Tiny; - push @INC, Path::Tiny::path(__FILE__)->parent->parent->path("bin")->absolute->stringify; - require "slubsipbuilder.pl"; - $INC{'SLUB/LZA/SIPBuilder.pm'} = 1; # needed because inlined module -} -my $unpatched_mods=<<'UNPATCHED_MODS'; -<?xml version="1.0" encoding="UTF-8"?> -<mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/mods/v3" version="3.6" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-6.xsd"><titleInfo><nonSort xml:space="preserve">Der </nonSort><title>Fichtelberg</title><subTitle>Berg der unbekannten Rekorrde</subTitle></titleInfo><name type="personal"><namePart>Schneider, Dirk</namePart><role><roleTerm type="text">FilmemacherIn</roleTerm></role><role><roleTerm authority="marcrelator" type="code">fmk</roleTerm></role><nameIdentifier>(DE-627)1235502279 (DE-576)165502274</nameIdentifier></name><typeOfResource>moving image</typeOfResource><genre authority="rdacontent">zweidimensionales bewegtes Bild</genre><genre authority="gnd-content">Film</genre><originInfo><place><placeTerm type="code" authority="marccountry">xx</placeTerm></place><dateIssued encoding="marc">2014</dateIssued><issuance>monographic</issuance></originInfo><originInfo eventType="publication"><place><placeTerm type="text">[Leipzig]</placeTerm></place><publisher>top ten tv</publisher><dateIssued>[2014]</dateIssued></originInfo><language><languageTerm authority="iso639-2b" type="code">ger</languageTerm></language><physicalDescription><form authority="marccategory">electronic resource</form><form authority="marcsmd">remote</form><extent>1 Online-Ressource (1 Videodatei, 29:49) farbig</extent><form type="media" authority="rdamedia">Computermedien</form><form type="carrier" authority="rdacarrier">Online-Ressource</form></physicalDescription><targetAudience authority="marctarget">juvenile</targetAudience><note type="statement of responsibility" altRepGroup="00">ein Film von Dirk Schneider</note><note>Dokumentarfilm. Deutschland. 2014</note><relatedItem type="series"><titleInfo><title>MDR</title></titleInfo></relatedItem><relatedItem type="series"><titleInfo><title>Der Osten - entdecke wo du lebst</title></titleInfo></relatedItem><identifier type="oclc">946544758</identifier><recordInfo><descriptionStandard>rda</descriptionStandard><recordContentSource authority="marcorg">DE-576</recordContentSource><recordCreationDate encoding="marc">160304</recordCreationDate><recordChangeDate encoding="iso8601">20160510144338.0</recordChangeDate><recordIdentifier source="DE-576">457035137</recordIdentifier><recordOrigin>Converted from MARCXML to MODS version 3.6 using MARC21slim2MODS3-6.xsl - (Revision 1.119 2018/06/21)</recordOrigin><languageOfCataloging><languageTerm authority="iso639-2b" type="code">ger</languageTerm></languageOfCataloging></recordInfo></mods> -UNPATCHED_MODS -my $patched_mods=<<'PATCHED_MODS'; -<?xml version="1.0" encoding="UTF-8"?> -<mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/mods/v3" version="3.6" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-6.xsd"><titleInfo><nonSort xml:space="preserve">Der </nonSort><title>Fichtelberg</title><subTitle>Berg der unbekannten Rekorrde</subTitle></titleInfo><name type="personal"><namePart>Schneider, Dirk</namePart><role><roleTerm type="text">FilmemacherIn</roleTerm></role><role><roleTerm authority="marcrelator" type="code">fmk</roleTerm></role><nameIdentifier>(DE-627)1235502279 (DE-576)165502274</nameIdentifier></name><typeOfResource>moving image</typeOfResource><genre authority="rdacontent">zweidimensionales bewegtes Bild</genre><genre authority="gnd-content">Film</genre><originInfo><place><placeTerm type="code" authority="marccountry">xx</placeTerm></place><dateIssued encoding="marc">2014</dateIssued><issuance>monographic</issuance></originInfo><originInfo eventType="publication"><place><placeTerm type="text">[Leipzig]</placeTerm></place><publisher>top ten tv</publisher><dateIssued>[2014]</dateIssued></originInfo><language><languageTerm authority="iso639-2b" type="code">ger</languageTerm></language><physicalDescription><form authority="marccategory">electronic resource</form><form authority="marcsmd">remote</form><extent>1 Online-Ressource (1 Videodatei, 29:49) farbig</extent><form type="media" authority="rdamedia">Computermedien</form><form type="carrier" authority="rdacarrier">Online-Ressource</form></physicalDescription><targetAudience authority="marctarget">juvenile</targetAudience><note type="statement of responsibility" altRepGroup="00">ein Film von Dirk Schneider</note><note>Dokumentarfilm. Deutschland. 2014</note><relatedItem type="series"><titleInfo><title>MDR</title></titleInfo></relatedItem><relatedItem type="series"><titleInfo><title>Der Osten - entdecke wo du lebst</title></titleInfo></relatedItem><identifier type="oclc">946544758</identifier><recordInfo><descriptionStandard>rda</descriptionStandard><recordContentSource authority="marcorg">DE-576</recordContentSource><recordCreationDate encoding="marc">160304</recordCreationDate><recordChangeDate encoding="iso8601">20160510144338.0</recordChangeDate><recordIdentifier source="DE-576">457035137</recordIdentifier><recordOrigin>Converted from MARCXML to MODS version 3.6 using MARC21slim2MODS3-6.xsl - (Revision 1.119 2018/06/21)</recordOrigin><languageOfCataloging><languageTerm authority="iso639-2b" type="code">ger</languageTerm></languageOfCataloging></recordInfo></mods> -PATCHED_MODS -my $unpatched_mods_obj = XML::LibXML->load_xml(string => $unpatched_mods); - -my $unpatched_marcblob=<<'UNPATCHED_MARCBLOB'; -<?xml version="1.0"?> -<record xmlns="http://www.loc.gov/MARC21/slim"> - <leader> cgm a22 4500</leader> - <controlfield tag="001">457035137</controlfield> - <controlfield tag="003">DE-576</controlfield> - <controlfield tag="005">20160510144338.0</controlfield> - <controlfield tag="006">m o | | </controlfield> - <controlfield tag="007">cr uuu---uuuuu</controlfield> - <controlfield tag="007">vu uuuuuu</controlfield> - <controlfield tag="008">160304s2014 xx ger c</controlfield> - <datafield tag="035" ind1=" " ind2=" "> - <subfield code="a">(DE-627)1655506501</subfield> - </datafield> - <datafield tag="035" ind1=" " ind2=" "> - <subfield code="a">(DE-576)457035137</subfield> - </datafield> - <datafield tag="035" ind1=" " ind2=" "> - <subfield code="a">(DE-599)BSZ457035137</subfield> - </datafield> - <datafield tag="035" ind1=" " ind2=" "> - <subfield code="a">(OCoLC)946544758</subfield> - </datafield> - <datafield tag="040" ind1=" " ind2=" "> - <subfield code="a">DE-576</subfield> - <subfield code="b">ger</subfield> - <subfield code="c">DE-576</subfield> - <subfield code="e">rda</subfield> - </datafield> - <datafield tag="041" ind1=" " ind2=" "> - <subfield code="a">ger</subfield> - </datafield> - <datafield tag="245" ind1="1" ind2="4"> - <subfield code="a">Der Fichtelberg</subfield> - <subfield code="b">Berg der unbekannten Rekorrde</subfield> - <subfield code="c">ein Film von Dirk Schneider</subfield> - </datafield> - <datafield tag="264" ind1=" " ind2="1"> - <subfield code="a">[Leipzig]</subfield> - <subfield code="b">top ten tv</subfield> - <subfield code="c">[2014]</subfield> - </datafield> - <datafield tag="264" ind1=" " ind2="4"> - <subfield code="c">© 2014</subfield> - </datafield> - <datafield tag="300" ind1=" " ind2=" "> - <subfield code="a">1 Online-Ressource (1 Videodatei, 29:49)</subfield> - <subfield code="b">farbig</subfield> - </datafield> - <datafield tag="336" ind1=" " ind2=" "> - <subfield code="a">zweidimensionales bewegtes Bild</subfield> - <subfield code="b">tdi</subfield> - <subfield code="2">rdacontent</subfield> - </datafield> - <datafield tag="337" ind1=" " ind2=" "> - <subfield code="a">Computermedien</subfield> - <subfield code="b">c</subfield> - <subfield code="2">rdamedia</subfield> - </datafield> - <datafield tag="338" ind1=" " ind2=" "> - <subfield code="a">Online-Ressource</subfield> - <subfield code="b">cr</subfield> - <subfield code="2">rdacarrier</subfield> - </datafield> - <datafield tag="490" ind1="0" ind2=" "> - <subfield code="a">MDR</subfield> - </datafield> - <datafield tag="490" ind1="0" ind2=" "> - <subfield code="a">Der Osten - entdecke wo du lebst</subfield> - </datafield> - <datafield tag="500" ind1=" " ind2=" "> - <subfield code="a">Dokumentarfilm. Deutschland. 2014</subfield> - </datafield> - <datafield tag="591" ind1=" " ind2=" "> - <subfield code="a">Fernsehmitschnitt (SWB)</subfield> - </datafield> - <datafield tag="655" ind1=" " ind2="7"> - <subfield code="a">Film</subfield> - <subfield code="0">(DE-588)4017102-4</subfield> - <subfield code="0">(DE-627)104559683</subfield> - <subfield code="0">(DE-576)208918531</subfield> - <subfield code="2">gnd-content</subfield> - </datafield> - <datafield tag="700" ind1="1" ind2=" "> - <subfield code="a">Schneider, Dirk</subfield> - <subfield code="e">FilmemacherIn</subfield> - <subfield code="0">(DE-627)1235502279</subfield> - <subfield code="0">(DE-576)165502274</subfield> - <subfield code="4">fmk</subfield> - </datafield> - <datafield tag="935" ind1=" " ind2=" "> - <subfield code="c">vide</subfield> - </datafield> - <datafield tag="937" ind1=" " ind2=" "> - <subfield code="a">Dokumentarfilm</subfield> - <subfield code="b">Deutschland</subfield> - <subfield code="c">2014</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">000 xxxxxcx a22 zn 4500</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">001 901795887</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">003 DE-576</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">004 457035137</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">005 20160510125331</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">008 160304||||||||||||||||ger|||||||</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">040 </subfield> - <subfield code="a">DE-14</subfield> - <subfield code="c">DE-576</subfield> - <subfield code="d">DE-14</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">852 </subfield> - <subfield code="z">Fernsehmitschnitt: MDR, 04.02.2014. - Beilage</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">852 </subfield> - <subfield code="a">DE-14</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">852 1</subfield> - <subfield code="9">00</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">866 </subfield> - <subfield code="x">ddsu,pn</subfield> - </datafield> -</record> -UNPATCHED_MARCBLOB - -my $patched_marcblob =<<'PATCHED_MARCBLOB'; -<?xml version="1.0"?> -<record xmlns="http://www.loc.gov/MARC21/slim"> - <leader> cgm a22 4500</leader> - <controlfield tag="001">457035137</controlfield> - <controlfield tag="003">DE-576</controlfield> - <controlfield tag="005">20160510144338.0</controlfield> - <controlfield tag="006">m o | | </controlfield> - <controlfield tag="007">cr uuu---uuuuu</controlfield> - <controlfield tag="007">vu uuuuuu</controlfield> - <controlfield tag="008">160304s2014 xx ger c</controlfield> - <datafield tag="035" ind1=" " ind2=" "> - <subfield code="a">(DE-627)1655506501</subfield> - </datafield> - <datafield tag="035" ind1=" " ind2=" "> - <subfield code="a">(DE-576)457035137</subfield> - </datafield> - <datafield tag="035" ind1=" " ind2=" "> - <subfield code="a">(DE-599)BSZ457035137</subfield> - </datafield> - <datafield tag="035" ind1=" " ind2=" "> - <subfield code="a">(OCoLC)946544758</subfield> - </datafield> - <datafield tag="040" ind1=" " ind2=" "> - <subfield code="a">DE-576</subfield> - <subfield code="b">ger</subfield> - <subfield code="c">DE-576</subfield> - <subfield code="e">rda</subfield> - </datafield> - <datafield tag="041" ind1=" " ind2=" "> - <subfield code="a">ger</subfield> - </datafield> - <datafield tag="245" ind1="1" ind2="4"> - <subfield code="a">Der Fichtelberg</subfield> - <subfield code="b">Berg der unbekannten Rekorrde</subfield> - <subfield code="c">ein Film von Dirk Schneider</subfield> - </datafield> - <datafield tag="264" ind1=" " ind2="1"> - <subfield code="a">[Leipzig]</subfield> - <subfield code="b">top ten tv</subfield> - <subfield code="c">[2014]</subfield> - </datafield> - <datafield tag="264" ind1=" " ind2="4"> - <subfield code="c">© 2014</subfield> - </datafield> - <datafield tag="300" ind1=" " ind2=" "> - <subfield code="a">1 Online-Ressource (1 Videodatei, 29:49)</subfield> - <subfield code="b">farbig</subfield> - </datafield> - <datafield tag="336" ind1=" " ind2=" "> - <subfield code="a">zweidimensionales bewegtes Bild</subfield> - <subfield code="b">tdi</subfield> - <subfield code="2">rdacontent</subfield> - </datafield> - <datafield tag="337" ind1=" " ind2=" "> - <subfield code="a">Computermedien</subfield> - <subfield code="b">c</subfield> - <subfield code="2">rdamedia</subfield> - </datafield> - <datafield tag="338" ind1=" " ind2=" "> - <subfield code="a">Online-Ressource</subfield> - <subfield code="b">cr</subfield> - <subfield code="2">rdacarrier</subfield> - </datafield> - <datafield tag="490" ind1="0" ind2=" "> - <subfield code="a">MDR</subfield> - </datafield> - <datafield tag="490" ind1="0" ind2=" "> - <subfield code="a">Der Osten - entdecke wo du lebst</subfield> - </datafield> - <datafield tag="500" ind1=" " ind2=" "> - <subfield code="a">Dokumentarfilm. Deutschland. 2014</subfield> - </datafield> - <datafield tag="591" ind1=" " ind2=" "> - <subfield code="a">Fernsehmitschnitt (SWB)</subfield> - </datafield> - <datafield tag="655" ind1=" " ind2="7"> - <subfield code="a">Film</subfield> - <subfield code="0">(DE-588)4017102-4</subfield> - <subfield code="0">(DE-627)104559683</subfield> - <subfield code="0">(DE-576)208918531</subfield> - <subfield code="2">gnd-content</subfield> - </datafield> - <datafield tag="700" ind1="1" ind2=" "> - <subfield code="a">Schneider, Dirk</subfield> - <subfield code="e">FilmemacherIn</subfield> - <subfield code="0">(DE-627)1235502279</subfield> - <subfield code="0">(DE-576)165502274</subfield> - <subfield code="4">fmk</subfield> - </datafield> - <datafield tag="935" ind1=" " ind2=" "> - <subfield code="c">vide</subfield> - </datafield> - <datafield tag="937" ind1=" " ind2=" "> - <subfield code="a">Dokumentarfilm</subfield> - <subfield code="b">Deutschland</subfield> - <subfield code="c">2014</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">000 xxxxxcx a22 zn 4500</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">001 901795887</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">003 DE-576</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">004 457035137</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">005 20160510125331</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">008 160304||||||||||||||||ger|||||||</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">040 </subfield> - <subfield code="a">DE-14</subfield> - <subfield code="c">DE-576</subfield> - <subfield code="d">DE-14</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">852 </subfield> - <subfield code="z">Fernsehmitschnitt: MDR, 04.02.2014. - Beilage</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">852 </subfield> - <subfield code="a">DE-14</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">852 1</subfield> - <subfield code="9">00</subfield> - </datafield> - <datafield tag="LOK" ind1=" " ind2=" "> - <subfield code="0">866 </subfield> - <subfield code="x">ddsu,pn</subfield> - </datafield> -</record> -PATCHED_MARCBLOB -my $unpatched_marcblob_obj = XML::LibXML->load_xml(string => $unpatched_marcblob); - -my $unpatched_marc21slimutils = <<'UNPATCHED_MARC21SLIMUTIL'; -<?xml version='1.0'?> -<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" - xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - - <!-- 08/08/08: tmee added corrected chopPunctuation templates for 260c --> - <!-- 08/19/04: ntra added "marc:" prefix to datafield element --> - <!-- 12/14/07: ntra added url encoding template --> - <!-- url encoding --> - - <xsl:variable name="ascii"> - <xsl:text> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~</xsl:text> - </xsl:variable> - - <xsl:variable name="latin1"> - <xsl:text> ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ</xsl:text> - </xsl:variable> - <!-- Characters that usually don't need to be escaped --> - <xsl:variable name="safe"> - <xsl:text>!'()*-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~</xsl:text> - </xsl:variable> - - <xsl:variable name="hex">0123456789ABCDEF</xsl:variable> - - - <xsl:template name="datafield"> - <xsl:param name="tag"/> - <xsl:param name="ind1"> - <xsl:text> </xsl:text> - </xsl:param> - <xsl:param name="ind2"> - <xsl:text> </xsl:text> - </xsl:param> - <xsl:param name="subfields"/> - <xsl:element name="marc:datafield"> - <xsl:attribute name="tag"> - <xsl:value-of select="$tag"/> - </xsl:attribute> - <xsl:attribute name="ind1"> - <xsl:value-of select="$ind1"/> - </xsl:attribute> - <xsl:attribute name="ind2"> - <xsl:value-of select="$ind2"/> - </xsl:attribute> - <xsl:copy-of select="$subfields"/> - </xsl:element> - </xsl:template> - - <xsl:template name="subfieldSelect"> - <xsl:param name="codes">abcdefghijklmnopqrstuvwxyz</xsl:param> - <xsl:param name="delimeter"> - <xsl:text> </xsl:text> - </xsl:param> - <xsl:variable name="str"> - <xsl:for-each select="marc:subfield"> - <xsl:if test="contains($codes, @code)"> - <xsl:value-of select="text()"/> - <xsl:value-of select="$delimeter"/> - </xsl:if> - </xsl:for-each> - </xsl:variable> - <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/> - </xsl:template> - - <xsl:template name="buildSpaces"> - <xsl:param name="spaces"/> - <xsl:param name="char"> - <xsl:text> </xsl:text> - </xsl:param> - <xsl:if test="$spaces>0"> - <xsl:value-of select="$char"/> - <xsl:call-template name="buildSpaces"> - <xsl:with-param name="spaces" select="$spaces - 1"/> - <xsl:with-param name="char" select="$char"/> - </xsl:call-template> - </xsl:if> - </xsl:template> - - <xsl:template name="chopPunctuation"> - <xsl:param name="chopString"/> - <xsl:param name="punctuation"> - <xsl:text>.:,;/ </xsl:text> - </xsl:param> - <xsl:variable name="length" select="string-length($chopString)"/> - <xsl:choose> - <xsl:when test="$length=0"/> - <xsl:when test="contains($punctuation, substring($chopString,$length,1))"> - <xsl:call-template name="chopPunctuation"> - <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/> - <xsl:with-param name="punctuation" select="$punctuation"/> - </xsl:call-template> - </xsl:when> - <xsl:when test="not($chopString)"/> - <xsl:otherwise> - <xsl:value-of select="$chopString"/> - </xsl:otherwise> - </xsl:choose> - </xsl:template> - - <xsl:template name="chopPunctuationFront"> - <xsl:param name="chopString"/> - <xsl:variable name="length" select="string-length($chopString)"/> - <xsl:choose> - <xsl:when test="$length=0"/> - <xsl:when test="contains('.:,;/[ ', substring($chopString,1,1))"> - <xsl:call-template name="chopPunctuationFront"> - <xsl:with-param name="chopString" select="substring($chopString,2,$length - 1)" - /> - </xsl:call-template> - </xsl:when> - <xsl:when test="not($chopString)"/> - <xsl:otherwise> - <xsl:value-of select="$chopString"/> - </xsl:otherwise> - </xsl:choose> - </xsl:template> - - <xsl:template name="chopPunctuationBack"> - <xsl:param name="chopString"/> - <xsl:param name="punctuation"> - <xsl:text>.:,;/] </xsl:text> - </xsl:param> - <xsl:variable name="length" select="string-length($chopString)"/> - <xsl:choose> - <xsl:when test="$length=0"/> - <xsl:when test="contains($punctuation, substring($chopString,$length,1))"> - <xsl:call-template name="chopPunctuation"> - <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/> - <xsl:with-param name="punctuation" select="$punctuation"/> - </xsl:call-template> - </xsl:when> - <xsl:when test="not($chopString)"/> - <xsl:otherwise> - <xsl:value-of select="$chopString"/> - </xsl:otherwise> - </xsl:choose> - </xsl:template> - - <!-- nate added 12/14/2007 for lccn.loc.gov: url encode ampersand, etc. --> - <xsl:template name="url-encode"> - - <xsl:param name="str"/> - - <xsl:if test="$str"> - <xsl:variable name="first-char" select="substring($str,1,1)"/> - <xsl:choose> - <xsl:when test="contains($safe,$first-char)"> - <xsl:value-of select="$first-char"/> - </xsl:when> - <xsl:otherwise> - <xsl:variable name="codepoint"> - <xsl:choose> - <xsl:when test="contains($ascii,$first-char)"> - <xsl:value-of - select="string-length(substring-before($ascii,$first-char)) + 32" - /> - </xsl:when> - <xsl:when test="contains($latin1,$first-char)"> - <xsl:value-of - select="string-length(substring-before($latin1,$first-char)) + 160"/> - <!-- was 160 --> - </xsl:when> - <xsl:otherwise> - <xsl:message terminate="no">Warning: string contains a character - that is out of range! Substituting "?".</xsl:message> - <xsl:text>63</xsl:text> - </xsl:otherwise> - </xsl:choose> - </xsl:variable> - <xsl:variable name="hex-digit1" - select="substring($hex,floor($codepoint div 16) + 1,1)"/> - <xsl:variable name="hex-digit2" select="substring($hex,$codepoint mod 16 + 1,1)"/> - <!-- <xsl:value-of select="concat('%',$hex-digit2)"/> --> - <xsl:value-of select="concat('%',$hex-digit1,$hex-digit2)"/> - </xsl:otherwise> - </xsl:choose> - <xsl:if test="string-length($str) > 1"> - <xsl:call-template name="url-encode"> - <xsl:with-param name="str" select="substring($str,2)"/> - </xsl:call-template> - </xsl:if> - </xsl:if> - </xsl:template> -</xsl:stylesheet> -<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp. -<metaInformation> -<scenarios/><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/> -</metaInformation> ---> -UNPATCHED_MARC21SLIMUTIL - -my $structmap_res = "<mets:structMap TYPE=\"PHYSICAL\"> - <mets:div ID=\"PHYS_0000\" TYPE=\"ieDir\"> - <mets:div ID=\"PHYS_000000000000000_LZA\" TYPE=\"fileorderSequence\"> -<mets:fptr FILEID=\"FILE_000000000000000_LZA\" /> -</mets:div> - </mets:div> -</mets:structMap> -"; - -my $filesec_res = "<mets:fileSec> - <mets:fileGrp USE=\"LZA\"> - <mets:file ID=\"FILE_000000000000000_LZA\" CHECKSUMTYPE=\"MD5\" CHECKSUM=\"d41d8cd98f00b204e9800998ecf8427e\"> -<mets:FLocat xmlns:xlink=\"http://www.w3.org/1999/xlink\" LOCTYPE=\"URL\" xlink:href=\"file://data/test.txt\"/> -</mets:file> - </mets:fileGrp> -</mets:fileSec> -"; - -my $noppn_dmd_res = "<mets:dmdSec ID=\"DMDLOG_0000\"> - <!-- bibliographic metadata --> - <mets:mdWrap MDTYPE=\"MODS\"> - <mets:xmlData> - <mods version=\"3.6\" - xmlns=\"http://www.loc.gov/mods/v3\" - 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-6.xsd\"> - <identifier>string</identifier> -</mods> - - </mets:xmlData> - </mets:mdWrap> -</mets:dmdSec> -"; - -# preparation -my $xsl_path = path(__FILE__)->parent->parent->child('xsl'); -my $export_dir_kitodo_path = path(__FILE__)->parent->parent->child('export_dir_kitodo'); -my $valid_ie_dir = "10_00-8"; -my $not_valid_ie_dir = "10_00-8+"; -my $valid_ie_dir_path = $export_dir_kitodo_path->absolute . "/" . $valid_ie_dir; -my $not_valid_ie_dir_path = $export_dir_kitodo_path->absolute . "/" . $not_valid_ie_dir; -my $file = "test.txt"; -my $file2 = "test+.txt"; -if(! -d $export_dir_kitodo_path) { mkdir $export_dir_kitodo_path or die "Error creating directory: $export_dir_kitodo_path"; } -if(! -d $export_dir_kitodo_path->child($valid_ie_dir)) { mkdir $export_dir_kitodo_path->child($valid_ie_dir) or die "Error creating directory: $export_dir_kitodo_path->child($valid_ie_dir)"; } -if(! -f $export_dir_kitodo_path->child($valid_ie_dir)->child($file)) { - open FILE, '>'.$export_dir_kitodo_path->child($valid_ie_dir)->child($file) or die "Unable to create $file"; - close FILE; -} -if(! -d $export_dir_kitodo_path->child($not_valid_ie_dir)) { mkdir $export_dir_kitodo_path->child($not_valid_ie_dir) or die "Error creating directory: $export_dir_kitodo_path->child($not_valid_ie_dir)"; } -if(! -f $export_dir_kitodo_path->child($not_valid_ie_dir)->child($file2)) { - open FILE, '>'.$export_dir_kitodo_path->child($not_valid_ie_dir)->child($file2) or die "Unable to create $file"; - close FILE; -} - -my $mysip_path = path(__FILE__)->parent->parent->child('tmp')->child('mysip'); -if(! -d $mysip_path->parent) { mkdir $mysip_path->parent or die "Error creating directory: tmp";} -if(! -d $mysip_path) { mkdir $mysip_path or die "Error creating directory: $mysip_path";} - -#~ structure of input output folders -#~ . -#~ ├── export_dir_kitodo -#~ │ ├── 10_00-8 -#~ │ │ └── test.txt -#~ │ │ -#~ │ └── 10_00-8+ -#~ │ └── test+.txt -#~ └── tmp -#~ └── mysip - -my $ua = LWP::UserAgent->new; -my $request = HTTP::Request->new('GET' => "https://sru.bsz-bw.de/swbf"); -my $response = $ua->request($request); -my $marc21slimutils_file = $xsl_path->child('MARC21slimUtils.xsl'); -my $useragent_obj = LWP::UserAgent->new; -$useragent_obj->agent("MyApp/0.1 "); -$useragent_obj->timeout(3600); #1h -my $filecopyhash = SLUB::LZA::SIPBuilder::create_filecopyhash($valid_ie_dir_path, $mysip_path->absolute . "/PPN-457035137_2019-10-14_08-46-50/data"); -# ensure no dir exists, then run test -if ($xsl_path->is_dir) { $xsl_path->remove_tree; } - -### tests -BEGIN { use_ok("SLUB::LZA::SIPBuilder"); } -# -is(SLUB::LZA::SIPBuilder::check_xsl_directory(), $xsl_path->absolute, "check_xsl_directory(), return value if not exist"); -ok($xsl_path->is_dir, "check_xsl_directory(), created if not exist"); -is(SLUB::LZA::SIPBuilder::check_xsl_directory(), $xsl_path->absolute, "check_xsl_directory(), return value if exist"); -ok($xsl_path->is_dir, "check_xsl_directory(), untouched if exist"); -# -SKIP: { - skip "No response from server https://sru.bsz-bw.de/swb", 1 unless ! $response->is_error; - like(SLUB::LZA::SIPBuilder::get_mods_from("https://sru.bsz-bw.de/swb", "457035137", "pica.swn", "marcxmlvbos"), qr//, "get_mods_from()"); -}; -throws_ok{ SLUB::LZA::SIPBuilder::get_mods_from("", "457035137", "pica.swn", "marcxmlvbos"); } qr/invalid parameters/, "get_mods_from(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::get_mods_from("https://sru.bsz-bw.de/swb", "", "pica.swn", "marcxmlvbos"); } qr/invalid parameters/, "get_mods_from(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::get_mods_from("https://sru.bsz-bw.de/swb", "457035137", "", "marcxmlvbos"); } qr/invalid parameters/, "get_mods_from(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::get_mods_from("https://sru.bsz-bw.de/swb", "457035137", "pica.swn", ""); } qr/invalid parameters/, "get_mods_from(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::get_mods_from(undef, "457035137", "pica.swn", "marcxmlvbos"); } qr/url not defined/, "get_mods_from(\$url, \$ppn, \$key, \$schema), url undef"; -throws_ok{ SLUB::LZA::SIPBuilder::get_mods_from("https://sru.bsz-bw.de/swb", undef, "pica.swn", "marcxmlvbos"); } qr/ppn not defined/, "get_mods_from(\$url, \$ppn, \$key, \$schema), ppn undef"; -throws_ok{ SLUB::LZA::SIPBuilder::get_mods_from("https://sru.bsz-bw.de/swb", "457035137", undef, "marcxmlvbos"); } qr/key not defined/, "get_mods_from(\$url, \$ppn, \$key, \$schema), key undef"; -throws_ok{ SLUB::LZA::SIPBuilder::get_mods_from("https://sru.bsz-bw.de/swb", "457035137", "pica.swn", undef); } qr/schema not defined/, "get_mods_from(\$url, \$ppn, \$key, \$schema), schema undef"; -# -ok(SLUB::LZA::SIPBuilder::write_file($marc21slimutils_file, $unpatched_marc21slimutils), "write_file()"); -throws_ok{ SLUB::LZA::SIPBuilder::write_file("", $unpatched_marc21slimutils); } qr/invalid parameters/, "write_file(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::write_file($marc21slimutils_file, ""); } qr/invalid parameters/, "write_file(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::write_file(undef, $unpatched_marc21slimutils); } qr/filename not defined/, "write_file(\$filename, \$value), filename undef"; -throws_ok{ SLUB::LZA::SIPBuilder::write_file($marc21slimutils_file, undef); } qr/value not defined/, "write_file(\$filename, \$value), value undef"; -# -is(SLUB::LZA::SIPBuilder::patch_mods($unpatched_mods_obj), $patched_mods, "patch_mods()"); -throws_ok{ SLUB::LZA::SIPBuilder::patch_mods(""); } qr/invalid parameters/, "patch_mods(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::patch_mods(undef); } qr/modsobject not defined/, "patch_mods(\$modsobj), modsobj undef"; -# -is(SLUB::LZA::SIPBuilder::patch_marc_response($unpatched_marcblob_obj), $patched_marcblob, "patch_marc_response()"); -throws_ok{ SLUB::LZA::SIPBuilder::patch_marc_response(""); } qr/invalid parameters/, "patch_marc_response(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::patch_marc_response(undef); } qr/marcobject not defined/, "patch_marc_response(\$marcobj), marcobj undef"; -# -is(SLUB::LZA::SIPBuilder::check_marc21_utility($xsl_path, $useragent_obj), $marc21slimutils_file , "check_marc21_utility()"); -throws_ok{ SLUB::LZA::SIPBuilder::check_marc21_utility("", $useragent_obj); } qr/invalid parameters/, "check_marc21_utility(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::check_marc21_utility($xsl_path, ""); } qr/invalid parameters/, "check_marc21_utility(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::check_marc21_utility(undef, $useragent_obj); } qr/xsl directory not defined/, "check_marc21_utility(\$xsl_dir, \$useragent), xsl_dir undef"; -throws_ok{ SLUB::LZA::SIPBuilder::check_marc21_utility($xsl_path, undef); } qr/user agent not defined/, "check_marc21_utility(\$xsl_dir, \$useragent), useragent undef"; -# -is(SLUB::LZA::SIPBuilder::check_marc21_mods_xsl($xsl_path, $useragent_obj), 'xsl/MARC21slim2MODS3-6.patched.xsl' , "check_marc21_mods_xsl()"); -throws_ok{ SLUB::LZA::SIPBuilder::check_marc21_mods_xsl("", $useragent_obj); } qr/invalid parameters/, "check_marc21_mods_xsl(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::check_marc21_mods_xsl($xsl_path, ""); } qr/invalid parameters/, "check_marc21_mods_xsl(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::check_marc21_mods_xsl(undef, $useragent_obj); } qr/xsl directory not defined/, "check_marc21_mods_xsl(\$xsl_dir, \$useragent), xsl_dir undef"; -throws_ok{ SLUB::LZA::SIPBuilder::check_marc21_mods_xsl($xsl_path, undef); } qr/user agent not defined/, "check_marc21_mods_xsl(\$xsl_dir, \$useragent), useragent undef"; -# -like(SLUB::LZA::SIPBuilder::create_filecopyhash($valid_ie_dir_path, $mysip_path->absolute . "/PPN-457035137_2019-10-14_08-46-50/data"), qr/HASH/, "create_filecopyhash()"); -throws_ok{ SLUB::LZA::SIPBuilder::create_filecopyhash("", $mysip_path->absolute . "/PPN-457035137_2019-10-14_08-46-50/data"); } qr/invalid parameters/, "create_filecopyhash(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::create_filecopyhash($valid_ie_dir_path, ""); } qr/invalid parameters/, "create_filecopyhash(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::create_filecopyhash($valid_ie_dir_path, undef); } qr/content not defined/, "create_filecopyhash(\$directory, \$content), content undef"; -throws_ok{ SLUB::LZA::SIPBuilder::create_filecopyhash(undef, $mysip_path->absolute . "/PPN-number_date_time/data"); } qr/directory not defined/, "create_filecopyhash(\$directory, \$content), directory undef"; -# -SKIP: { - skip "No response from server https://sru.bsz-bw.de/swb", 1 unless ! $response->is_error; - like(SLUB::LZA::SIPBuilder::prepare_dmd_section_with_ppn("457035137"), qr//, "prepare_dmd_section_with_ppn()"); -}; -throws_ok{ SLUB::LZA::SIPBuilder::prepare_dmd_section_with_ppn(""); } qr/invalid parameters/, "prepare_dmd_section_with_ppn(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::prepare_dmd_section_with_ppn(undef); } qr/ppn not defined/, "prepare_dmd_section_with_ppn(\$ppn), ppn undef"; -# -ok(SLUB::LZA::SIPBuilder::prepare_dmd_section_with_noppn("string") eq $noppn_dmd_res, "prepare_dmd_section_with_noppn()"); -throws_ok{ SLUB::LZA::SIPBuilder::prepare_files_sections(""); } qr/Can't use string/, "prepare_dmd_section_with_noppn(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::prepare_dmd_section_with_noppn(undef); } qr/noppn not defined/, "prepare_dmd_section_with_noppn(\$noppn), noppn undef"; -# -like(SLUB::LZA::SIPBuilder::prepare_amd_section("2019-10-14T13:33:56", "kitodo", "10008", "false", "DE-14", "Gesetzlicher Auftrag"), qr//, "prepare_amd_section()"); -like(SLUB::LZA::SIPBuilder::prepare_amd_section("2019-10-14T13:33:56", "kitodo", "10008", "false", "", "Gesetzlicher Auftrag"), qr//, "prepare_amd_section() with no externel_isil"); -throws_ok{ SLUB::LZA::SIPBuilder::prepare_amd_section("", "kitodo", "10008", "false", "DE-14", "Gesetzlicher Auftrag"); } qr/invalid parameters/, "prepare_amd_section(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::prepare_amd_section("2019-10-14T13:33:56", "", "10008", "false", "DE-14", "Gesetzlicher Auftrag"); } qr/invalid parameters/, "prepare_amd_section(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::prepare_amd_section("2019-10-14T13:33:56", "kitodo", "", "false", "DE-14", "Gesetzlicher Auftrag"); } qr/invalid parameters/, "prepare_amd_section(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::prepare_amd_section("2019-10-14T13:33:56", "kitodo", "10008", "", "DE-14", "Gesetzlicher Auftrag"); } qr/invalid parameters/, "prepare_amd_section(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::prepare_amd_section("2019-10-14T13:33:56", "kitodo", "10008", "false", "DE-14", ""); } qr/invalid parameters/, "prepare_amd_section(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::prepare_amd_section(undef, "kitodo", "10008", "false", "DE-14", "Gesetzlicher Auftrag"); } qr/export to archive date not defined/, "prepare_amd_section(\$export_to_archive_date, \$external_workflow, \$external_id, \$external_conservation_flag, \$external_isil, \$external_value_descr), export_to_archive_date undef"; -throws_ok{ SLUB::LZA::SIPBuilder::prepare_amd_section("2019-10-14T13:33:56", undef, "10008", "false", "DE-14", "Gesetzlicher Auftrag"); } qr/external workflow not defined/, "prepare_amd_section(\$export_to_archive_date, \$external_workflow, \$external_id, \$external_conservation_flag, \$external_isil, \$external_value_descr), external_workflow undef"; -throws_ok{ SLUB::LZA::SIPBuilder::prepare_amd_section("2019-10-14T13:33:56", "kitodo", undef, "false", "DE-14", "Gesetzlicher Auftrag"); } qr/external id not defined/, "prepare_amd_section(\$export_to_archive_date, \$external_workflow, \$external_id, \$external_conservation_flag, \$external_isil, \$external_value_descr), external_id undef"; -throws_ok{ SLUB::LZA::SIPBuilder::prepare_amd_section("2019-10-14T13:33:56", "kitodo", "10008", undef, "DE-14", "Gesetzlicher Auftrag"); } qr/external conservation flag not defined/, "prepare_amd_section(\$export_to_archive_date, \$external_workflow, \$external_id, \$external_conservation_flag, \$external_isil, \$external_value_descr), external_conservation_flag undef"; -throws_ok{ SLUB::LZA::SIPBuilder::prepare_amd_section("2019-10-14T13:33:56", "kitodo", "10008", "false", undef, "Gesetzlicher Auftrag"); } qr/external isil not defined/, "prepare_amd_section(\$export_to_archive_date, \$external_workflow, \$external_id, \$external_conservation_flag, \$external_isil, \$external_value_descr), external_isil undef"; -throws_ok{ SLUB::LZA::SIPBuilder::prepare_amd_section("2019-10-14T13:33:56", "kitodo", "10008", "false", "DE-14", undef); } qr/external value description not defined/, "prepare_amd_section(\$export_to_archive_date, \$external_workflow, \$external_id, \$external_conservation_flag, \$external_isil, \$external_value_descr), external_value_descr undef"; -# -ok(SLUB::LZA::SIPBuilder::prepare_files_sections($filecopyhash) eq $filesec_res, "prepare_files_sections()"); -throws_ok{ SLUB::LZA::SIPBuilder::prepare_files_sections(""); } qr/Can't use string/, "prepare_files_sections(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::prepare_files_sections(\$filecopyhash); } qr/Not a HASH reference/, "prepare_files_sections(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::prepare_files_sections(undef); } qr/filecopyhash not defined/, "prepare_files_sections(\$filecopyhash), filecopyhash undef"; -# -ok(SLUB::LZA::SIPBuilder::prepare_struct_map($filecopyhash) eq $structmap_res, "prepare_struct_map()"); -throws_ok{ SLUB::LZA::SIPBuilder::prepare_struct_map(""); } qr/Can't use string/, "prepare_struct_map(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::prepare_struct_map(\$filecopyhash); } qr/Not a HASH reference/, "prepare_struct_map(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::prepare_struct_map(undef); } qr/filecopyhash not defined/, "prepare_struct_map(\$filecopyhash), filecopyhash undef"; -# -is(SLUB::LZA::SIPBuilder::check_directory($valid_ie_dir_path, $valid_ie_dir), "", "check_directory()"); -throws_ok{ SLUB::LZA::SIPBuilder::check_directory("", $valid_ie_dir); } qr/invalid parameters/, "check_directory(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::check_directory($valid_ie_dir_path, ""); } qr/invalid parameters/, "check_directory(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::check_directory(undef, $valid_ie_dir); } qr/fullname not defined/, "check_directory(\$valid_ie_dir_path, \$valid_ie_dir), valid_ie_dir_path undef"; -throws_ok{ SLUB::LZA::SIPBuilder::check_directory($valid_ie_dir_path, undef); } qr/entry not defined/, "check_directory(\$valid_ie_dir_path, \$valid_ie_dir), valid_ie_dir undef"; -like(SLUB::LZA::SIPBuilder::check_directory($export_dir_kitodo_path->absolute . "/LFvNRFgzZQ6nXnK0wvOXqYGA3jBuHrQWWkw2ngWL/5CglQ5VNjq1kCNTVPhcRDYy59PpQg/0g9XWHBkgunA4FXGefoX5RToHrXgE6cY35wLdviFjE2gAf9mpQSTnC/hpH4omOsAl6I9UfU4HYoo4drqLGjn0QP80SPm6TRWThtKmb6dj7iWm1UfFOo9W19vcCQQIcz/1Aa_080B-", "1Aa_080B-"), qr/expected maximum 255 characters/, "validate_directory(\$valid_ie_dir_path, \$valid_ie_dir), expected valid_ie_dir_path max 255 characters"); -like(SLUB::LZA::SIPBuilder::check_directory($not_valid_ie_dir_path, $not_valid_ie_dir), qr/you need to specify/, "check_directory(\$valid_ie_dir_path, \$valid_ie_dir), file or directory must be valid to (^[A-Za-z0-9_.-]+\$)"); -like(SLUB::LZA::SIPBuilder::check_directory($valid_ie_dir_path . "/../", $valid_ie_dir), qr/relativ path/, "check_directory(\$valid_ie_dir_path, \$valid_ie_dir), relative path in form ../ is not allowed"); -# -is(SLUB::LZA::SIPBuilder::validate_directory($valid_ie_dir_path), "", "validate_directory()"); -throws_ok{ SLUB::LZA::SIPBuilder::validate_directory(""); } qr/Could not find/, "validate_directory(), invalid parameters"; -throws_ok{ SLUB::LZA::SIPBuilder::validate_directory(undef); } qr/directory not defined/, "validate_directory(\$directory), directory undef"; - -1; +#!/usr/bin/perl -w +use strict; +use warnings; +use diagnostics; + +use Test::More tests => 78; +use Test::Output; +use Test::Exception; +use Test::File; +use Path::Tiny; +use File::Copy::Recursive; # for dircopy() +use File::Path qw(rmtree); + + +# *** Read before running tests *** +# Usage: perl -I lib/ t/slubsipbuilderbagit.t +# Warning: While running project "SLUB_SIP_Builder" two directories "export_dir_kitodo/bagit" and "tmp/bagit" will be created. +# Start scipt in the project directory to run all tests properly. + +### prepare +BEGIN { + use Path::Tiny; + push @INC, Path::Tiny::path(__FILE__)->parent->parent->path("bin")->absolute->stringify; + require "slubsipbuilderbagit.pl"; + $INC{'SLUB/LZA/SIPBuilderBagIt.pm'} = 1; # needed because inlined module +} +my $unpatched_mods=<<'UNPATCHED_MODS'; +<?xml version="1.0" encoding="UTF-8"?> +<mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/mods/v3" version="3.6" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-6.xsd"><titleInfo><nonSort xml:space="preserve">Der </nonSort><title>Fichtelberg</title><subTitle>Berg der unbekannten Rekorrde</subTitle></titleInfo><name type="personal"><namePart>Schneider, Dirk</namePart><role><roleTerm type="text">FilmemacherIn</roleTerm></role><role><roleTerm authority="marcrelator" type="code">fmk</roleTerm></role><nameIdentifier>(DE-627)1235502279 (DE-576)165502274</nameIdentifier></name><typeOfResource>moving image</typeOfResource><genre authority="rdacontent">zweidimensionales bewegtes Bild</genre><genre authority="gnd-content">Film</genre><originInfo><place><placeTerm type="code" authority="marccountry">xx</placeTerm></place><dateIssued encoding="marc">2014</dateIssued><issuance>monographic</issuance></originInfo><originInfo eventType="publication"><place><placeTerm type="text">[Leipzig]</placeTerm></place><publisher>top ten tv</publisher><dateIssued>[2014]</dateIssued></originInfo><language><languageTerm authority="iso639-2b" type="code">ger</languageTerm></language><physicalDescription><form authority="marccategory">electronic resource</form><form authority="marcsmd">remote</form><extent>1 Online-Ressource (1 Videodatei, 29:49) farbig</extent><form type="media" authority="rdamedia">Computermedien</form><form type="carrier" authority="rdacarrier">Online-Ressource</form></physicalDescription><targetAudience authority="marctarget">juvenile</targetAudience><note type="statement of responsibility" altRepGroup="00">ein Film von Dirk Schneider</note><note>Dokumentarfilm. Deutschland. 2014</note><relatedItem type="series"><titleInfo><title>MDR</title></titleInfo></relatedItem><relatedItem type="series"><titleInfo><title>Der Osten - entdecke wo du lebst</title></titleInfo></relatedItem><identifier type="oclc">946544758</identifier><recordInfo><descriptionStandard>rda</descriptionStandard><recordContentSource authority="marcorg">DE-576</recordContentSource><recordCreationDate encoding="marc">160304</recordCreationDate><recordChangeDate encoding="iso8601">20160510144338.0</recordChangeDate><recordIdentifier source="DE-576">457035137</recordIdentifier><recordOrigin>Converted from MARCXML to MODS version 3.6 using MARC21slim2MODS3-6.xsl + (Revision 1.119 2018/06/21)</recordOrigin><languageOfCataloging><languageTerm authority="iso639-2b" type="code">ger</languageTerm></languageOfCataloging></recordInfo></mods> +UNPATCHED_MODS +my $patched_mods=<<'PATCHED_MODS'; +<?xml version="1.0" encoding="UTF-8"?> +<mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/mods/v3" version="3.6" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-6.xsd"><titleInfo><nonSort xml:space="preserve">Der </nonSort><title>Fichtelberg</title><subTitle>Berg der unbekannten Rekorrde</subTitle></titleInfo><name type="personal"><namePart>Schneider, Dirk</namePart><role><roleTerm type="text">FilmemacherIn</roleTerm></role><role><roleTerm authority="marcrelator" type="code">fmk</roleTerm></role><nameIdentifier>(DE-627)1235502279 (DE-576)165502274</nameIdentifier></name><typeOfResource>moving image</typeOfResource><genre authority="rdacontent">zweidimensionales bewegtes Bild</genre><genre authority="gnd-content">Film</genre><originInfo><place><placeTerm type="code" authority="marccountry">xx</placeTerm></place><dateIssued encoding="marc">2014</dateIssued><issuance>monographic</issuance></originInfo><originInfo eventType="publication"><place><placeTerm type="text">[Leipzig]</placeTerm></place><publisher>top ten tv</publisher><dateIssued>[2014]</dateIssued></originInfo><language><languageTerm authority="iso639-2b" type="code">ger</languageTerm></language><physicalDescription><form authority="marccategory">electronic resource</form><form authority="marcsmd">remote</form><extent>1 Online-Ressource (1 Videodatei, 29:49) farbig</extent><form type="media" authority="rdamedia">Computermedien</form><form type="carrier" authority="rdacarrier">Online-Ressource</form></physicalDescription><targetAudience authority="marctarget">juvenile</targetAudience><note type="statement of responsibility" altRepGroup="00">ein Film von Dirk Schneider</note><note>Dokumentarfilm. Deutschland. 2014</note><relatedItem type="series"><titleInfo><title>MDR</title></titleInfo></relatedItem><relatedItem type="series"><titleInfo><title>Der Osten - entdecke wo du lebst</title></titleInfo></relatedItem><identifier type="oclc">946544758</identifier><recordInfo><descriptionStandard>rda</descriptionStandard><recordContentSource authority="marcorg">DE-576</recordContentSource><recordCreationDate encoding="marc">160304</recordCreationDate><recordChangeDate encoding="iso8601">20160510144338.0</recordChangeDate><recordIdentifier source="DE-576">457035137</recordIdentifier><recordOrigin>Converted from MARCXML to MODS version 3.6 using MARC21slim2MODS3-6.xsl + (Revision 1.119 2018/06/21)</recordOrigin><languageOfCataloging><languageTerm authority="iso639-2b" type="code">ger</languageTerm></languageOfCataloging></recordInfo></mods> +PATCHED_MODS +my $unpatched_mods_obj = XML::LibXML->load_xml(string => $unpatched_mods); + +my $unpatched_marcblob=<<'UNPATCHED_MARCBLOB'; +<?xml version="1.0"?> +<record xmlns="http://www.loc.gov/MARC21/slim"> + <leader> cgm a22 4500</leader> + <controlfield tag="001">457035137</controlfield> + <controlfield tag="003">DE-576</controlfield> + <controlfield tag="005">20160510144338.0</controlfield> + <controlfield tag="006">m o | | </controlfield> + <controlfield tag="007">cr uuu---uuuuu</controlfield> + <controlfield tag="007">vu uuuuuu</controlfield> + <controlfield tag="008">160304s2014 xx ger c</controlfield> + <datafield tag="035" ind1=" " ind2=" "> + <subfield code="a">(DE-627)1655506501</subfield> + </datafield> + <datafield tag="035" ind1=" " ind2=" "> + <subfield code="a">(DE-576)457035137</subfield> + </datafield> + <datafield tag="035" ind1=" " ind2=" "> + <subfield code="a">(DE-599)BSZ457035137</subfield> + </datafield> + <datafield tag="035" ind1=" " ind2=" "> + <subfield code="a">(OCoLC)946544758</subfield> + </datafield> + <datafield tag="040" ind1=" " ind2=" "> + <subfield code="a">DE-576</subfield> + <subfield code="b">ger</subfield> + <subfield code="c">DE-576</subfield> + <subfield code="e">rda</subfield> + </datafield> + <datafield tag="041" ind1=" " ind2=" "> + <subfield code="a">ger</subfield> + </datafield> + <datafield tag="245" ind1="1" ind2="4"> + <subfield code="a">Der Fichtelberg</subfield> + <subfield code="b">Berg der unbekannten Rekorrde</subfield> + <subfield code="c">ein Film von Dirk Schneider</subfield> + </datafield> + <datafield tag="264" ind1=" " ind2="1"> + <subfield code="a">[Leipzig]</subfield> + <subfield code="b">top ten tv</subfield> + <subfield code="c">[2014]</subfield> + </datafield> + <datafield tag="264" ind1=" " ind2="4"> + <subfield code="c">© 2014</subfield> + </datafield> + <datafield tag="300" ind1=" " ind2=" "> + <subfield code="a">1 Online-Ressource (1 Videodatei, 29:49)</subfield> + <subfield code="b">farbig</subfield> + </datafield> + <datafield tag="336" ind1=" " ind2=" "> + <subfield code="a">zweidimensionales bewegtes Bild</subfield> + <subfield code="b">tdi</subfield> + <subfield code="2">rdacontent</subfield> + </datafield> + <datafield tag="337" ind1=" " ind2=" "> + <subfield code="a">Computermedien</subfield> + <subfield code="b">c</subfield> + <subfield code="2">rdamedia</subfield> + </datafield> + <datafield tag="338" ind1=" " ind2=" "> + <subfield code="a">Online-Ressource</subfield> + <subfield code="b">cr</subfield> + <subfield code="2">rdacarrier</subfield> + </datafield> + <datafield tag="490" ind1="0" ind2=" "> + <subfield code="a">MDR</subfield> + </datafield> + <datafield tag="490" ind1="0" ind2=" "> + <subfield code="a">Der Osten - entdecke wo du lebst</subfield> + </datafield> + <datafield tag="500" ind1=" " ind2=" "> + <subfield code="a">Dokumentarfilm. Deutschland. 2014</subfield> + </datafield> + <datafield tag="591" ind1=" " ind2=" "> + <subfield code="a">Fernsehmitschnitt (SWB)</subfield> + </datafield> + <datafield tag="655" ind1=" " ind2="7"> + <subfield code="a">Film</subfield> + <subfield code="0">(DE-588)4017102-4</subfield> + <subfield code="0">(DE-627)104559683</subfield> + <subfield code="0">(DE-576)208918531</subfield> + <subfield code="2">gnd-content</subfield> + </datafield> + <datafield tag="700" ind1="1" ind2=" "> + <subfield code="a">Schneider, Dirk</subfield> + <subfield code="e">FilmemacherIn</subfield> + <subfield code="0">(DE-627)1235502279</subfield> + <subfield code="0">(DE-576)165502274</subfield> + <subfield code="4">fmk</subfield> + </datafield> + <datafield tag="935" ind1=" " ind2=" "> + <subfield code="c">vide</subfield> + </datafield> + <datafield tag="937" ind1=" " ind2=" "> + <subfield code="a">Dokumentarfilm</subfield> + <subfield code="b">Deutschland</subfield> + <subfield code="c">2014</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">000 xxxxxcx a22 zn 4500</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">001 901795887</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">003 DE-576</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">004 457035137</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">005 20160510125331</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">008 160304||||||||||||||||ger|||||||</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">040 </subfield> + <subfield code="a">DE-14</subfield> + <subfield code="c">DE-576</subfield> + <subfield code="d">DE-14</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">852 </subfield> + <subfield code="z">Fernsehmitschnitt: MDR, 04.02.2014. - Beilage</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">852 </subfield> + <subfield code="a">DE-14</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">852 1</subfield> + <subfield code="9">00</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">866 </subfield> + <subfield code="x">ddsu,pn</subfield> + </datafield> +</record> +UNPATCHED_MARCBLOB + +my $patched_marcblob =<<'PATCHED_MARCBLOB'; +<?xml version="1.0"?> +<record xmlns="http://www.loc.gov/MARC21/slim"> + <leader> cgm a22 4500</leader> + <controlfield tag="001">457035137</controlfield> + <controlfield tag="003">DE-576</controlfield> + <controlfield tag="005">20160510144338.0</controlfield> + <controlfield tag="006">m o | | </controlfield> + <controlfield tag="007">cr uuu---uuuuu</controlfield> + <controlfield tag="007">vu uuuuuu</controlfield> + <controlfield tag="008">160304s2014 xx ger c</controlfield> + <datafield tag="035" ind1=" " ind2=" "> + <subfield code="a">(DE-627)1655506501</subfield> + </datafield> + <datafield tag="035" ind1=" " ind2=" "> + <subfield code="a">(DE-576)457035137</subfield> + </datafield> + <datafield tag="035" ind1=" " ind2=" "> + <subfield code="a">(DE-599)BSZ457035137</subfield> + </datafield> + <datafield tag="035" ind1=" " ind2=" "> + <subfield code="a">(OCoLC)946544758</subfield> + </datafield> + <datafield tag="040" ind1=" " ind2=" "> + <subfield code="a">DE-576</subfield> + <subfield code="b">ger</subfield> + <subfield code="c">DE-576</subfield> + <subfield code="e">rda</subfield> + </datafield> + <datafield tag="041" ind1=" " ind2=" "> + <subfield code="a">ger</subfield> + </datafield> + <datafield tag="245" ind1="1" ind2="4"> + <subfield code="a">Der Fichtelberg</subfield> + <subfield code="b">Berg der unbekannten Rekorrde</subfield> + <subfield code="c">ein Film von Dirk Schneider</subfield> + </datafield> + <datafield tag="264" ind1=" " ind2="1"> + <subfield code="a">[Leipzig]</subfield> + <subfield code="b">top ten tv</subfield> + <subfield code="c">[2014]</subfield> + </datafield> + <datafield tag="264" ind1=" " ind2="4"> + <subfield code="c">© 2014</subfield> + </datafield> + <datafield tag="300" ind1=" " ind2=" "> + <subfield code="a">1 Online-Ressource (1 Videodatei, 29:49)</subfield> + <subfield code="b">farbig</subfield> + </datafield> + <datafield tag="336" ind1=" " ind2=" "> + <subfield code="a">zweidimensionales bewegtes Bild</subfield> + <subfield code="b">tdi</subfield> + <subfield code="2">rdacontent</subfield> + </datafield> + <datafield tag="337" ind1=" " ind2=" "> + <subfield code="a">Computermedien</subfield> + <subfield code="b">c</subfield> + <subfield code="2">rdamedia</subfield> + </datafield> + <datafield tag="338" ind1=" " ind2=" "> + <subfield code="a">Online-Ressource</subfield> + <subfield code="b">cr</subfield> + <subfield code="2">rdacarrier</subfield> + </datafield> + <datafield tag="490" ind1="0" ind2=" "> + <subfield code="a">MDR</subfield> + </datafield> + <datafield tag="490" ind1="0" ind2=" "> + <subfield code="a">Der Osten - entdecke wo du lebst</subfield> + </datafield> + <datafield tag="500" ind1=" " ind2=" "> + <subfield code="a">Dokumentarfilm. Deutschland. 2014</subfield> + </datafield> + <datafield tag="591" ind1=" " ind2=" "> + <subfield code="a">Fernsehmitschnitt (SWB)</subfield> + </datafield> + <datafield tag="655" ind1=" " ind2="7"> + <subfield code="a">Film</subfield> + <subfield code="0">(DE-588)4017102-4</subfield> + <subfield code="0">(DE-627)104559683</subfield> + <subfield code="0">(DE-576)208918531</subfield> + <subfield code="2">gnd-content</subfield> + </datafield> + <datafield tag="700" ind1="1" ind2=" "> + <subfield code="a">Schneider, Dirk</subfield> + <subfield code="e">FilmemacherIn</subfield> + <subfield code="0">(DE-627)1235502279</subfield> + <subfield code="0">(DE-576)165502274</subfield> + <subfield code="4">fmk</subfield> + </datafield> + <datafield tag="935" ind1=" " ind2=" "> + <subfield code="c">vide</subfield> + </datafield> + <datafield tag="937" ind1=" " ind2=" "> + <subfield code="a">Dokumentarfilm</subfield> + <subfield code="b">Deutschland</subfield> + <subfield code="c">2014</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">000 xxxxxcx a22 zn 4500</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">001 901795887</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">003 DE-576</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">004 457035137</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">005 20160510125331</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">008 160304||||||||||||||||ger|||||||</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">040 </subfield> + <subfield code="a">DE-14</subfield> + <subfield code="c">DE-576</subfield> + <subfield code="d">DE-14</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">852 </subfield> + <subfield code="z">Fernsehmitschnitt: MDR, 04.02.2014. - Beilage</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">852 </subfield> + <subfield code="a">DE-14</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">852 1</subfield> + <subfield code="9">00</subfield> + </datafield> + <datafield tag="LOK" ind1=" " ind2=" "> + <subfield code="0">866 </subfield> + <subfield code="x">ddsu,pn</subfield> + </datafield> +</record> +PATCHED_MARCBLOB +my $unpatched_marcblob_obj = XML::LibXML->load_xml(string => $unpatched_marcblob); + +my $unpatched_marc21slimutils = <<'UNPATCHED_MARC21SLIMUTIL'; +<?xml version='1.0'?> +<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + + <!-- 08/08/08: tmee added corrected chopPunctuation templates for 260c --> + <!-- 08/19/04: ntra added "marc:" prefix to datafield element --> + <!-- 12/14/07: ntra added url encoding template --> + <!-- url encoding --> + + <xsl:variable name="ascii"> + <xsl:text> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~</xsl:text> + </xsl:variable> + + <xsl:variable name="latin1"> + <xsl:text> ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ</xsl:text> + </xsl:variable> + <!-- Characters that usually don't need to be escaped --> + <xsl:variable name="safe"> + <xsl:text>!'()*-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~</xsl:text> + </xsl:variable> + + <xsl:variable name="hex">0123456789ABCDEF</xsl:variable> + + + <xsl:template name="datafield"> + <xsl:param name="tag"/> + <xsl:param name="ind1"> + <xsl:text> </xsl:text> + </xsl:param> + <xsl:param name="ind2"> + <xsl:text> </xsl:text> + </xsl:param> + <xsl:param name="subfields"/> + <xsl:element name="marc:datafield"> + <xsl:attribute name="tag"> + <xsl:value-of select="$tag"/> + </xsl:attribute> + <xsl:attribute name="ind1"> + <xsl:value-of select="$ind1"/> + </xsl:attribute> + <xsl:attribute name="ind2"> + <xsl:value-of select="$ind2"/> + </xsl:attribute> + <xsl:copy-of select="$subfields"/> + </xsl:element> + </xsl:template> + + <xsl:template name="subfieldSelect"> + <xsl:param name="codes">abcdefghijklmnopqrstuvwxyz</xsl:param> + <xsl:param name="delimeter"> + <xsl:text> </xsl:text> + </xsl:param> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield"> + <xsl:if test="contains($codes, @code)"> + <xsl:value-of select="text()"/> + <xsl:value-of select="$delimeter"/> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/> + </xsl:template> + + <xsl:template name="buildSpaces"> + <xsl:param name="spaces"/> + <xsl:param name="char"> + <xsl:text> </xsl:text> + </xsl:param> + <xsl:if test="$spaces>0"> + <xsl:value-of select="$char"/> + <xsl:call-template name="buildSpaces"> + <xsl:with-param name="spaces" select="$spaces - 1"/> + <xsl:with-param name="char" select="$char"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template name="chopPunctuation"> + <xsl:param name="chopString"/> + <xsl:param name="punctuation"> + <xsl:text>.:,;/ </xsl:text> + </xsl:param> + <xsl:variable name="length" select="string-length($chopString)"/> + <xsl:choose> + <xsl:when test="$length=0"/> + <xsl:when test="contains($punctuation, substring($chopString,$length,1))"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/> + <xsl:with-param name="punctuation" select="$punctuation"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="not($chopString)"/> + <xsl:otherwise> + <xsl:value-of select="$chopString"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="chopPunctuationFront"> + <xsl:param name="chopString"/> + <xsl:variable name="length" select="string-length($chopString)"/> + <xsl:choose> + <xsl:when test="$length=0"/> + <xsl:when test="contains('.:,;/[ ', substring($chopString,1,1))"> + <xsl:call-template name="chopPunctuationFront"> + <xsl:with-param name="chopString" select="substring($chopString,2,$length - 1)" + /> + </xsl:call-template> + </xsl:when> + <xsl:when test="not($chopString)"/> + <xsl:otherwise> + <xsl:value-of select="$chopString"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="chopPunctuationBack"> + <xsl:param name="chopString"/> + <xsl:param name="punctuation"> + <xsl:text>.:,;/] </xsl:text> + </xsl:param> + <xsl:variable name="length" select="string-length($chopString)"/> + <xsl:choose> + <xsl:when test="$length=0"/> + <xsl:when test="contains($punctuation, substring($chopString,$length,1))"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/> + <xsl:with-param name="punctuation" select="$punctuation"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="not($chopString)"/> + <xsl:otherwise> + <xsl:value-of select="$chopString"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- nate added 12/14/2007 for lccn.loc.gov: url encode ampersand, etc. --> + <xsl:template name="url-encode"> + + <xsl:param name="str"/> + + <xsl:if test="$str"> + <xsl:variable name="first-char" select="substring($str,1,1)"/> + <xsl:choose> + <xsl:when test="contains($safe,$first-char)"> + <xsl:value-of select="$first-char"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="codepoint"> + <xsl:choose> + <xsl:when test="contains($ascii,$first-char)"> + <xsl:value-of + select="string-length(substring-before($ascii,$first-char)) + 32" + /> + </xsl:when> + <xsl:when test="contains($latin1,$first-char)"> + <xsl:value-of + select="string-length(substring-before($latin1,$first-char)) + 160"/> + <!-- was 160 --> + </xsl:when> + <xsl:otherwise> + <xsl:message terminate="no">Warning: string contains a character + that is out of range! Substituting "?".</xsl:message> + <xsl:text>63</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="hex-digit1" + select="substring($hex,floor($codepoint div 16) + 1,1)"/> + <xsl:variable name="hex-digit2" select="substring($hex,$codepoint mod 16 + 1,1)"/> + <!-- <xsl:value-of select="concat('%',$hex-digit2)"/> --> + <xsl:value-of select="concat('%',$hex-digit1,$hex-digit2)"/> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="string-length($str) > 1"> + <xsl:call-template name="url-encode"> + <xsl:with-param name="str" select="substring($str,2)"/> + </xsl:call-template> + </xsl:if> + </xsl:if> + </xsl:template> +</xsl:stylesheet> +<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp. +<metaInformation> +<scenarios/><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/> +</metaInformation> +--> +UNPATCHED_MARC21SLIMUTIL + +my $noppn_mods_res = "<mods version=\"3.6\" + xmlns=\"http://www.loc.gov/mods/v3\" + 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-6.xsd\"> + <identifier>string</identifier> +</mods> +"; + +# preparation +my $xsl_path = path(__FILE__)->parent->parent->child('xsl'); +# input +my $export_dir_kitodo_path = path(__FILE__)->parent->parent->child('export_dir_kitodo'); +if(! -d $export_dir_kitodo_path) { mkdir $export_dir_kitodo_path or die "Error creating directory: $export_dir_kitodo_path"; } +my $input_path = path(__FILE__)->parent->parent->child('export_dir_kitodo')->child('bagit'); +if(! -d $input_path) { mkdir $input_path or die "Error creating directory: $input_path"; } +# output +my $output_path = path(__FILE__)->parent->parent->child('tmp')->child('bagit'); +if(! -d $output_path->parent) { mkdir $output_path->parent or die "Error creating directory: tmp";} +if(! -d $output_path) { mkdir $output_path or die "Error creating directory: $output_path";} +# create ie +my $ie = 'test'; +my @addBagInfo; +push @addBagInfo, {'SLUBArchiv-sipVersion' => 'v2020.1'}; +push @addBagInfo, {'Author' => 'Taras Schevchenko'}; +my $ie_input_path = $input_path . '/' . $ie; +my $ie_output_path = $output_path . '/' . $ie; +my $file_name = $ie_output_path . '/data/' . 'test.txt'; +if(! -d $input_path->child("test")){ mkdir $input_path->child("test") or die "Error creating directory: " . $input_path->child("test"); } +if(! -d $input_path->child("test")->child("data")){ mkdir $input_path->child("test")->child("data") or die "Error creating directory: " . $input_path->child("test")->("data"); } +if(! -f $input_path->child("test")->child("data")->child("test.txt")) { + open(my $fh, '>:encoding(UTF-8)', $input_path->child("test")->child("data")->child("test.txt")) or die "Could not open file " . $input_path->child("test")->child("data")->child("test.txt") . " $!"; + print $fh "test file for payload.\n"; + close $fh; +} +if(! -d $input_path->child("test")->child("meta")){ mkdir $input_path->child("test")->child("meta") or die "Error creating directory: " . $input_path->child("test")->child("meta"); } +# copy Fallbeispiele-*.xml (as rights.xml) file to output_path/meta +my $rightsXMLPath = path(__FILE__)->parent->realpath->parent->child("export_dir_kitodo")->child("bagit")->child("rights"); # absolute path +File::Copy::Recursive::dircopy($rightsXMLPath, "$ie_input_path/meta") or die "Could not perform dircopy() of $rightsXMLPath to $ie_input_path/meta: $!"; +# copy other meta files to output_path/meta +my $otherMetaPath = path(__FILE__)->parent->realpath->parent->child("export_dir_kitodo")->child("bagit")->child("meta"); # absolute path +File::Copy::Recursive::dircopy($otherMetaPath, "$ie_input_path/meta") or die "Could not perform dircopy() of $rightsXMLPath to $ie_input_path/meta: $!"; +# delete bagit from last session +rmtree $ie_output_path; +# copy new ie to output_path +File::Copy::Recursive::dircopy($ie_input_path, $ie_output_path) or die "Could not perform dircopy() of $ie_input_path to $ie_output_path: $!"; + +#~ structure of input output folders for tests +#~ . +#~ ├── export_dir_kitodo +#~ │ └─── bagit +#~ │ └── test +#~ │ +#~ └── tmp +#~ └── bagit +#~ └── test + +my $ua = LWP::UserAgent->new; +my $request = HTTP::Request->new('GET' => "https://sru.bsz-bw.de/swbf"); +my $response = $ua->request($request); +my $marc21slimutils_file = $xsl_path->child('MARC21slimUtils.xsl'); +my $useragent_obj = LWP::UserAgent->new; +$useragent_obj->agent("MyApp/0.1 "); +$useragent_obj->timeout(3600); #1h + +# ensure no dir exists, then run test +if($xsl_path->is_dir){ $xsl_path->remove_tree; } + +### tests +BEGIN { use_ok("SLUB::LZA::SIPBuilderBagIt"); } +# +is(SLUB::LZA::SIPBuilderBagIt::check_xsl_directory(), $xsl_path->absolute, "check_xsl_directory(), return value if not exist"); +ok($xsl_path->is_dir, "check_xsl_directory(), created if not exist"); +is(SLUB::LZA::SIPBuilderBagIt::check_xsl_directory(), $xsl_path->absolute, "check_xsl_directory(), return value if exist"); +ok($xsl_path->is_dir, "check_xsl_directory(), untouched if exist"); +# +SKIP: { + skip "No response from server https://sru.bsz-bw.de/swb", 1 unless ! $response->is_error; + like(SLUB::LZA::SIPBuilderBagIt::get_mods_from("https://sru.bsz-bw.de/swb", "457035137", "pica.swn", "marcxmlvbos"), qr//, "get_mods_from()"); +}; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::get_mods_from("", "457035137", "pica.swn", "marcxmlvbos"); } qr/invalid parameters/, "get_mods_from(), invalid parameters"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::get_mods_from("https://sru.bsz-bw.de/swb", "", "pica.swn", "marcxmlvbos"); } qr/invalid parameters/, "get_mods_from(), invalid parameters"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::get_mods_from("https://sru.bsz-bw.de/swb", "457035137", "", "marcxmlvbos"); } qr/invalid parameters/, "get_mods_from(), invalid parameters"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::get_mods_from("https://sru.bsz-bw.de/swb", "457035137", "pica.swn", ""); } qr/invalid parameters/, "get_mods_from(), invalid parameters"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::get_mods_from(undef, "457035137", "pica.swn", "marcxmlvbos"); } qr/url not defined/, "get_mods_from(\$url, \$ppn, \$key, \$schema), url undef"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::get_mods_from("https://sru.bsz-bw.de/swb", undef, "pica.swn", "marcxmlvbos"); } qr/ppn not defined/, "get_mods_from(\$url, \$ppn, \$key, \$schema), ppn undef"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::get_mods_from("https://sru.bsz-bw.de/swb", "457035137", undef, "marcxmlvbos"); } qr/key not defined/, "get_mods_from(\$url, \$ppn, \$key, \$schema), key undef"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::get_mods_from("https://sru.bsz-bw.de/swb", "457035137", "pica.swn", undef); } qr/schema not defined/, "get_mods_from(\$url, \$ppn, \$key, \$schema), schema undef"; +# +ok(SLUB::LZA::SIPBuilderBagIt::write_file($marc21slimutils_file, $unpatched_marc21slimutils), "write_file()"); +throws_ok{ SLUB::LZA::SIPBuilderBagIt::write_file("", $unpatched_marc21slimutils); } qr/invalid parameters/, "write_file(), invalid parameters"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::write_file($marc21slimutils_file, ""); } qr/invalid parameters/, "write_file(), invalid parameters"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::write_file(undef, $unpatched_marc21slimutils); } qr/filename not defined/, "write_file(\$filename, \$value), filename undef"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::write_file($marc21slimutils_file, undef); } qr/value not defined/, "write_file(\$filename, \$value), value undef"; +# +is(SLUB::LZA::SIPBuilderBagIt::patch_mods($unpatched_mods_obj), $patched_mods, "patch_mods()"); +throws_ok{ SLUB::LZA::SIPBuilderBagIt::patch_mods(""); } qr/invalid parameters/, "patch_mods(), invalid parameters"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::patch_mods(undef); } qr/modsobject not defined/, "patch_mods(\$modsobj), modsobj undef"; +# +is(SLUB::LZA::SIPBuilderBagIt::patch_marc_response($unpatched_marcblob_obj), $patched_marcblob, "patch_marc_response()"); +throws_ok{ SLUB::LZA::SIPBuilderBagIt::patch_marc_response(""); } qr/invalid parameters/, "patch_marc_response(), invalid parameters"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::patch_marc_response(undef); } qr/marcobject not defined/, "patch_marc_response(\$marcobj), marcobj undef"; +# +is(SLUB::LZA::SIPBuilderBagIt::check_marc21_utility($xsl_path, $useragent_obj), $marc21slimutils_file , "check_marc21_utility()"); +throws_ok{ SLUB::LZA::SIPBuilderBagIt::check_marc21_utility("", $useragent_obj); } qr/invalid parameters/, "check_marc21_utility(), invalid parameters"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::check_marc21_utility($xsl_path, ""); } qr/invalid parameters/, "check_marc21_utility(), invalid parameters"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::check_marc21_utility(undef, $useragent_obj); } qr/xsl directory not defined/, "check_marc21_utility(\$xsl_dir, \$useragent), xsl_dir undef"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::check_marc21_utility($xsl_path, undef); } qr/user agent not defined/, "check_marc21_utility(\$xsl_dir, \$useragent), useragent undef"; +# +is(SLUB::LZA::SIPBuilderBagIt::check_marc21_mods_xsl($xsl_path, $useragent_obj), 'xsl/MARC21slim2MODS3-6.patched.xsl' , "check_marc21_mods_xsl()"); +throws_ok{ SLUB::LZA::SIPBuilderBagIt::check_marc21_mods_xsl("", $useragent_obj); } qr/invalid parameters/, "check_marc21_mods_xsl(), invalid parameters"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::check_marc21_mods_xsl($xsl_path, ""); } qr/invalid parameters/, "check_marc21_mods_xsl(), invalid parameters"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::check_marc21_mods_xsl(undef, $useragent_obj); } qr/xsl directory not defined/, "check_marc21_mods_xsl(\$xsl_dir, \$useragent), xsl_dir undef"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::check_marc21_mods_xsl($xsl_path, undef); } qr/user agent not defined/, "check_marc21_mods_xsl(\$xsl_dir, \$useragent), useragent undef"; +# +SKIP: { + skip "No response from server https://sru.bsz-bw.de/swb", 1 unless ! $response->is_error; + like(SLUB::LZA::SIPBuilderBagIt::prepare_mods_section_with_ppn("457035137"), qr//, "prepare_mods_section_with_ppn()"); +}; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::prepare_mods_section_with_ppn(""); } qr/invalid parameters/, "prepare_mods_section_with_ppn(), invalid parameters"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::prepare_mods_section_with_ppn(undef); } qr/ppn not defined/, "prepare_mods_section_with_ppn(\$ppn), ppn undef"; +# +is(SLUB::LZA::SIPBuilderBagIt::prepare_mods_section_with_noppn("string"), $noppn_mods_res, "prepare_mods_section_with_noppn()"); +throws_ok{ SLUB::LZA::SIPBuilderBagIt::prepare_mods_section_with_noppn(""); } qr/noppn is empty string!/, "prepare_mods_section_with_noppn(), noppn is empty string!"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::prepare_mods_section_with_noppn(undef); } qr/noppn is not defined/, "prepare_mods_section_with_noppn(\$noppn), noppn undef"; +# test new +ok(SLUB::LZA::SIPBuilderBagIt::create_slub_bagit($ie_output_path, \@addBagInfo), "create_slub_bagit()"); +throws_ok{ SLUB::LZA::SIPBuilderBagIt::create_slub_bagit(undef, \@addBagInfo); } qr/ie_path is not defined/, "create_slub_bagit(\$ie_path, \$refAddBagInfo), ie_path undef"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::create_slub_bagit($ie_output_path, undef); } qr/array of hashes not defined for bag-info.txt/, "create_slub_bagit(\$ie_path, \$refAddBagInfo), refAddBagInfo undef"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::create_slub_bagit("", \@addBagInfo); } qr/path is not directory/, "create_slub_bagit(), invalid parameters"; +# +is(SLUB::LZA::SIPBuilderBagIt::getBagItName($ie_output_path), $ie, "getBagItName()"); +throws_ok{ SLUB::LZA::SIPBuilderBagIt::getBagItName(undef); } qr/path for getting bagit name is not defined/, "getBagItName(\$bagit_name), bagit_name undef"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::getBagItName(""); } qr/path is not directory/, "getBagItName(), invalid parameters"; +# +is(SLUB::LZA::SIPBuilderBagIt::getFileName($file_name), "test.txt", "getFileName()"); +throws_ok{ SLUB::LZA::SIPBuilderBagIt::getFileName(undef); } qr/path with file name is not defined/, "getFileName(\$file_name), file_name undef"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::getFileName(""); } qr/invalid parameters/, "getFileName(), invalid parameters"; +# +is(SLUB::LZA::SIPBuilderBagIt::save_option("copy", $ie_input_path, $ie_output_path, "ID-10000000_2020-01-01_20-00-00"), $ie_output_path . "/ID-10000000_2020-01-01_20-00-00", "save_option()"); +rmtree $ie_output_path . "/ID-10000000_2020-01-01_20-00-00"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::save_option(undef, $ie_input_path, $ie_output_path, "ID-10000000_2020-01-01_20-00-00"); } qr/save option not defined/, "save_option(\$save, \$directory, \$output, \$bagNewDir), save undef"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::save_option("copy", undef, $ie_output_path, "ID-10000000_2020-01-01_20-00-00"); } qr/IE directory path not defined/, "save_option(\$save, \$directory, \$output, \$bagNewDir), directory undef"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::save_option("copy", $ie_input_path, undef, "ID-10000000_2020-01-01_20-00-00"); } qr/output path not defined/, "save_option(\$save, \$directory, \$output, \$bagNewDir), for \$save=copy directory undef"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::save_option("move", $ie_input_path, undef, "ID-10000000_2020-01-01_20-00-00"); } qr/output path not defined/, "save_option(\$save, \$directory, \$output, \$bagNewDir), for \$save=move directory undef"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::save_option("copy", $ie_input_path, $ie_output_path, undef); } qr/sip root dir is not defined/, "save_option(\$save, \$directory, \$output, \$bagNewDir), bagNewDir undef"; +# +is(SLUB::LZA::SIPBuilderBagIt::getPayloadFiles($ie_input_path), 2, "getPayloadFiles()"); # meta, data +throws_ok{ SLUB::LZA::SIPBuilderBagIt::getPayloadFiles(undef); } qr/path is not defined/, "getPayloadFiles(\$import_dir), import_dir undef"; +# +is(SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_input_path, "Fallbeispiel-01.xml"), 1, "validateRightsXML() Fallbeispiel-01.xml"); +is(SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_input_path, "Fallbeispiel-02.xml"), 1, "validateRightsXML() Fallbeispiel-02.xml"); +is(SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_input_path, "Fallbeispiel-03.xml"), 1, "validateRightsXML() Fallbeispiel-03.xml"); +is(SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_input_path, "Fallbeispiel-04.xml"), 1, "validateRightsXML() Fallbeispiel-04.xml"); +is(SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_input_path, "Fallbeispiel-05.xml"), 1, "validateRightsXML() Fallbeispiel-05.xml"); +is(SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_input_path, "Fallbeispiel-06.xml"), 1, "validateRightsXML() Fallbeispiel-06.xml"); +is(SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_input_path, "Fallbeispiel-07.xml"), 1, "validateRightsXML() Fallbeispiel-07.xml"); +is(SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_input_path, "Fallbeispiel-08a-undef.xml"), 1, "validateRightsXML() Fallbeispiel-08a-undef.xml"); +is(SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_input_path, "Fallbeispiel-09.xml"), 1, "validateRightsXML() Fallbeispiel-09.xml"); +is(SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_input_path, "Fallbeispiel-10.xml"), 1, "validateRightsXML() Fallbeispiel-10.xml"); +is(SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_input_path, "Fallbeispiel-11.xml"), 1, "validateRightsXML() Fallbeispiel-11.xml"); +is(SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_input_path, "Fallbeispiel-12.xml"), 1, "validateRightsXML() Fallbeispiel-12.xml"); +is(SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_input_path, "Fallbeispiel-13.xml"), 1, "validateRightsXML() Fallbeispiel-13.xml"); +is(SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_input_path, "Fallbeispiel-14.xml"), 1, "validateRightsXML() Fallbeispiel-14.xml"); +is(SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_input_path, "Fallbeispiel-15.xml"), 1, "validateRightsXML() Fallbeispiel-15.xml"); +is(SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_input_path, "Fallbeispiel-16.xml"), 1, "validateRightsXML() Fallbeispiel-16.xml"); +throws_ok{ SLUB::LZA::SIPBuilderBagIt::validateRightsXML(undef, "rights.xml"); } qr/ie_path to rights.xsd not defined/, "validateRightsXML(\$ie_path, \$rightsName), ie_path undef"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_input_path, undef); } qr/file name not defined/, "validateRightsXML(\$ie_path, \$rightsName), rightsName undef"; +throws_ok{ SLUB::LZA::SIPBuilderBagIt::validateRightsXML($ie_input_path, "mods.xml"); } qr/failed validation/, "validateRightsXML(\$ie_path, \$rightsName), not valid rights.xml"; + + +1; diff --git a/tmp/PPN-457035137_2020-02-19_13-42-04/bag-info.txt b/tmp/PPN-457035137_2020-02-19_13-42-04/bag-info.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5561b0681c0daa0d0bda53985585865e1d5ff52 --- /dev/null +++ b/tmp/PPN-457035137_2020-02-19_13-42-04/bag-info.txt @@ -0,0 +1,15 @@ +SLUBArchiv-sipVersion: v2020.1 +SLUBArchiv-externalWorkflow: kitodo +SLUBArchiv-externalId: 10008 +SLUBArchiv-externalIsilId: DE-14 +SLUBArchiv-exportToArchiveDate: 2020-02-19T13:42:04 +SLUBArchiv-hasConservationReason: false +SLUBArchiv-archivalValueDescription: Gesetzlicher Auftrag +SLUBArchiv-rightsVersion: 1.0 +Author: Lew Nikolajewitsch Tolstoi +Titel: Krieg und Frieden +Genre: Roman +Bagging-Date: 2020-02-19 +Bag-Software-Agent: Archive::BagIt <https://metacpan.org/pod/Archive::BagIt> +Payload-Oxum: 2368584.3 +Bag-Size: 2.3 MB diff --git a/tmp/PPN-457035137_2020-02-19_13-42-04/bagit.txt b/tmp/PPN-457035137_2020-02-19_13-42-04/bagit.txt new file mode 100644 index 0000000000000000000000000000000000000000..33835cda70940cd823354cea5a1776c925221934 --- /dev/null +++ b/tmp/PPN-457035137_2020-02-19_13-42-04/bagit.txt @@ -0,0 +1,2 @@ +BagIt-Version: 1.0 +Tag-File-Character-Encoding: UTF-8 \ No newline at end of file diff --git a/tmp/PPN-457035137_2020-02-19_13-42-04/data/scans_tif/00000001.tif b/tmp/PPN-457035137_2020-02-19_13-42-04/data/scans_tif/00000001.tif new file mode 100644 index 0000000000000000000000000000000000000000..53ff885628eac6799fed0d9729f80c009eee8b3d Binary files /dev/null and b/tmp/PPN-457035137_2020-02-19_13-42-04/data/scans_tif/00000001.tif differ diff --git a/tmp/PPN-457035137_2020-02-19_13-42-04/data/scans_tif/00000002.tif b/tmp/PPN-457035137_2020-02-19_13-42-04/data/scans_tif/00000002.tif new file mode 100644 index 0000000000000000000000000000000000000000..b25d4e6c3f41f5a0dac1acd0c7bc8ed476c40820 Binary files /dev/null and b/tmp/PPN-457035137_2020-02-19_13-42-04/data/scans_tif/00000002.tif differ diff --git a/tmp/PPN-457035137_2020-02-19_13-42-04/data/test.txt b/tmp/PPN-457035137_2020-02-19_13-42-04/data/test.txt new file mode 100644 index 0000000000000000000000000000000000000000..1897e90346c2a60226554696f6b39c665ea9b589 --- /dev/null +++ b/tmp/PPN-457035137_2020-02-19_13-42-04/data/test.txt @@ -0,0 +1 @@ +test file for payload. diff --git a/tmp/PPN-457035137_2020-02-19_13-42-04/manifest-md5.txt b/tmp/PPN-457035137_2020-02-19_13-42-04/manifest-md5.txt new file mode 100644 index 0000000000000000000000000000000000000000..323dd28790bef5cfd8d8116617b2c8d1d4c71221 --- /dev/null +++ b/tmp/PPN-457035137_2020-02-19_13-42-04/manifest-md5.txt @@ -0,0 +1,3 @@ +55ccc1b630cc66150487a047b5a7b39a data/test.txt +de5dd1e1699302aeb8d24784052a5944 data/scans_tif/00000002.tif +622d089a3fb914d8311f0e4fe30cab2f data/scans_tif/00000001.tif diff --git a/tmp/PPN-457035137_2020-02-19_13-42-04/manifest-sha512.txt b/tmp/PPN-457035137_2020-02-19_13-42-04/manifest-sha512.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccb0bae26921ccbb6c3e99c48598de856a1d33b5 --- /dev/null +++ b/tmp/PPN-457035137_2020-02-19_13-42-04/manifest-sha512.txt @@ -0,0 +1,3 @@ +b1944d6dac6be6c56eedb453b8b3d6c12f2c213e2d179d244dbbe9ffa00dfdc858f3429a4529eee85b86a228d16448657d6e3c7e534fa8d57bcfb31269fc43cf data/test.txt +eb2a08499b77c6d4a0590ac7736309e1ffc50d1eed33954ff913dd6e7feda87093eea15ce4c5ecef568896c5fa25aedb315fcf69c684fcabc46c1210fe594a47 data/scans_tif/00000002.tif +fe0349a065f7e04b7445d318b05021450a114617924e9cba05b99c4e665912b05881a1ad89a9639832c6fd0317babd94d14799e33756d46e6164742e2bbe36ce data/scans_tif/00000001.tif diff --git a/tmp/PPN-457035137_2020-02-19_13-42-04/meta/1.xml b/tmp/PPN-457035137_2020-02-19_13-42-04/meta/1.xml new file mode 100644 index 0000000000000000000000000000000000000000..ab512e26c7d17e941357c4e439a6fd31d85dc568 --- /dev/null +++ b/tmp/PPN-457035137_2020-02-19_13-42-04/meta/1.xml @@ -0,0 +1,38 @@ +<mods:mods xmlns:mods="http://www.loc.gov/mods/v3"> +<mods:location> +<mods:physicalLocation authority="marcorg" displayLabel="Saxon State Library, Dresden, +Germany">DE-14</mods:physicalLocation> +<mods:shelfLocator>Hist.Sax.M.37.t,120</mods:shelfLocator> +</mods:location> +<mods:relatedItem type="series"> +<mods:titleInfo> +<mods:title>Saxonica</mods:title> +</mods:titleInfo> +</mods:relatedItem> +<mods:recordInfo> +<mods:recordIdentifier source="http://digital.slub-dresden.de/oai/">oai:de:slub-dresden:db:id- +319037843</mods:recordIdentifier> +</mods:recordInfo> +<mods:physicalDescription> +<mods:digitalOrigin>reformatted digital</mods:digitalOrigin> +<mods:extent>[1] Bl.</mods:extent> +</mods:physicalDescription> +<mods:identifier type="urn">urn:nbn:de:bsz:14-db-id3190378431</mods:identifier> +<mods:titleInfo> +<mods:title>Eingabe der Handelskammer zu Leipzig den Entwurf eines Tabak-Steuer-Gesetzes +betr.</mods:title> +<mods:subTitle>an den Reichstag zu Berlin</mods:subTitle> +</mods:titleInfo> +<mods:language> +<mods:languageTerm authority="rfc3066" type="code">de</mods:languageTerm> +</mods:language> +<mods:originInfo> +<mods:place> +<mods:placeTerm type="text">[Leipzig]</mods:placeTerm> +</mods:place> +<mods:dateIssued keyDate="yes">1893</mods:dateIssued> +</mods:originInfo> +<mods:subject authority="slub"> +<mods:topic>eingdehaz</mods:topic> +</mods:subject> +</mods:mods> diff --git a/tmp/PPN-457035137_2020-02-19_13-42-04/meta/lido.xml b/tmp/PPN-457035137_2020-02-19_13-42-04/meta/lido.xml new file mode 100644 index 0000000000000000000000000000000000000000..19b16cc72c67d3a63e9545d4ad01635e85e4c8d9 --- /dev/null +++ b/tmp/PPN-457035137_2020-02-19_13-42-04/meta/lido.xml @@ -0,0 +1 @@ +<xml></xml> \ No newline at end of file diff --git a/tmp/PPN-457035137_2020-02-19_13-42-04/meta/mods.xml b/tmp/PPN-457035137_2020-02-19_13-42-04/meta/mods.xml new file mode 100644 index 0000000000000000000000000000000000000000..444f8c53abe7c3af7ffe0837a4927307a0de9882 --- /dev/null +++ b/tmp/PPN-457035137_2020-02-19_13-42-04/meta/mods.xml @@ -0,0 +1,70 @@ +<!-- removed xml header from mods part --> +<mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/mods/v3" version="3.6" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-6.xsd"> + <titleInfo> + <nonSort xml:space="preserve">Der </nonSort> + <title>Fichtelberg</title> + <subTitle>Berg der unbekannten Rekorde</subTitle> + </titleInfo> + <titleInfo type="alternative"> + <title>Der Osten - entdecke wo du lebst</title> + </titleInfo> + <name type="personal"> + <namePart>Schneider, Dirk</namePart> + <role> + <roleTerm type="text">FilmemacherIn</roleTerm> + </role> + <role> + <roleTerm authority="marcrelator" type="code">fmk</roleTerm> + </role> + <nameIdentifier>(DE-627)1235502279 (DE-576)165502274</nameIdentifier> + </name> + <typeOfResource>moving image</typeOfResource> + <genre authority="marcgt">government publication</genre> + <genre authority="rdacontent">zweidimensionales bewegtes Bild</genre> + <genre authority="gnd-content">Film</genre> + <originInfo> + <place> + <placeTerm type="code" authority="marccountry">xx</placeTerm> + </place> + <dateIssued encoding="marc">2014</dateIssued> + <issuance>monographic</issuance> + </originInfo> + <originInfo eventType="publication"> + <place> + <placeTerm type="text">[Leipzig]</placeTerm> + </place> + <publisher>top ten tv</publisher> + <dateIssued>[2014]</dateIssued> + </originInfo> + <language> + <languageTerm authority="iso639-2b" type="code">ger</languageTerm> + </language> + <physicalDescription> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">remote</form> + <extent>1 Online-Ressource (1 Videodatei, 29:49) farbig</extent> + <form type="media" authority="rdamedia">Computermedien</form> + <form type="carrier" authority="rdacarrier">Online-Ressource</form> + </physicalDescription> + <note type="statement of responsibility" altRepGroup="00">ein Film von Dirk Schneider</note> + <note>Dokumentarfilm. Deutschland. 2014</note> + <classification authority="rvk">RH 65862</classification> + <relatedItem type="series"> + <titleInfo> + <title>MDR</title> + </titleInfo> + </relatedItem> + <identifier type="oclc">946544758</identifier> + <recordInfo> + <descriptionStandard>rda</descriptionStandard> + <recordContentSource authority="marcorg">DE-576</recordContentSource> + <recordCreationDate encoding="marc">160304</recordCreationDate> + <recordChangeDate encoding="iso8601">20200124082033.0</recordChangeDate> + <recordIdentifier source="DE-576">457035137</recordIdentifier> + <recordOrigin>Converted from MARCXML to MODS version 3.6 using MARC21slim2MODS3-6.xsl + (Revision 1.119 2018/06/21)</recordOrigin> + <languageOfCataloging> + <languageTerm authority="iso639-2b" type="code">ger</languageTerm> + </languageOfCataloging> + </recordInfo> +</mods> diff --git a/tmp/PPN-457035137_2020-02-19_13-42-04/meta/rights.xml b/tmp/PPN-457035137_2020-02-19_13-42-04/meta/rights.xml new file mode 100644 index 0000000000000000000000000000000000000000..afc2677f84e2b7aeafeac8952251a514e5f461c5 --- /dev/null +++ b/tmp/PPN-457035137_2020-02-19_13-42-04/meta/rights.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>publicdomain</slubarchiv:copyrightStatus> +</slubarchiv:rightsRecord> diff --git a/tmp/PPN-457035137_2020-02-19_13-42-04/tagmanifest-md5.txt b/tmp/PPN-457035137_2020-02-19_13-42-04/tagmanifest-md5.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca5963ef8c73b9cdf44340d43c5b001b8f177bc4 --- /dev/null +++ b/tmp/PPN-457035137_2020-02-19_13-42-04/tagmanifest-md5.txt @@ -0,0 +1,8 @@ +fa4de6f6f9ec444a6586f6c430b0dc19 manifest-sha512.txt +c9718cc533798841a9906406b74ed5d8 bag-info.txt +7cb0edfcba877a10170214f4f97d0319 bagit.txt +1015cbe0b8834a58dd23cca8b04b6f42 manifest-md5.txt +8eb41527a8f53e5d673771fa2159edac meta/lido.xml +b546f354e3a76f49849289d842de3b39 meta/1.xml +2f2988b28d80b8724c6fc610d9c5e7bd meta/mods.xml +6b989c27ffc4b5f6bdc4f19004218d63 meta/rights.xml diff --git a/tmp/PPN-457035137_2020-02-19_13-42-04/tagmanifest-sha512.txt b/tmp/PPN-457035137_2020-02-19_13-42-04/tagmanifest-sha512.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1331aad1f5bf1d5e4edbb2d97b9c95acc29a873 --- /dev/null +++ b/tmp/PPN-457035137_2020-02-19_13-42-04/tagmanifest-sha512.txt @@ -0,0 +1,8 @@ +c3ed118aed03c2e4915ee376d9301fbc129ec6f2abdc7d499b9d0f5846631ffef5fac2ab0a881bcd4dfc82e74256462843272d3556bc3ffd54fe29dc00010a18 manifest-sha512.txt +4a94a71a3fb96a5831b6a0d9a98d58d85eb5a997623baaef498e6821962b4198310cc787bff8e8d51c246ec3a162ca2c4f34c7a26603e6a50f59f55556f8a0ba bag-info.txt +da429ec4f5ca60aebd25aa4c26ccf51ae87609129ae76f09683c810da4af4414277250ecc0253bf7871c7a3f9c5b3ed6918a5d5c092a7dc394051601eb8bb3ab bagit.txt +fbb2cf67a1c2ebcf3477d6839492c35edda2f9a99d025ddf2d8bb503a465610ee24a20ef7299255ef93c98f710e1d9ea38b497a4f074e060e456d74a20a1e671 manifest-md5.txt +f2df67529acb78b080b1fed3ff488851ebc881d9a782240bd1c70a3c8cb2c4ea22c95d0f1646de9626ff2d1ad51c236d7d092badbbc55e4d8c15c1562f72576d meta/lido.xml +b637642ada4336d2048ba4d62585577158cdf2ecf54bf9b2f64887b5747f665e81035ff752be810d7b04468de9415f39d61c5d4cf0426c9c5f52de1b9a272ba4 meta/1.xml +d9c4288fc5122d79bdf913ad2b801655660b9e0736f85bc254cf0f75c2d2c98978cfd058060eb8eb1a908729c57a864f0cc04386892b0a3865f699d8f0d6844d meta/mods.xml +742653e079c1d95821afa65ce45d367ccc3d14d5e2512fce54d8a1c56bc02d020190308347cfca49326a8cef2f897cfc00261fb519b31714599ae771f062066b meta/rights.xml diff --git a/tmp/bagit/test/bag-info.txt b/tmp/bagit/test/bag-info.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9061fe7b9b579f881cc7a206c177cedce2aa191 --- /dev/null +++ b/tmp/bagit/test/bag-info.txt @@ -0,0 +1,6 @@ +SLUBArchiv-sipVersion: v2020.1 +Author: Taras Schevchenko +Bagging-Date: 2020-02-19 +Bag-Software-Agent: Archive::BagIt <https://metacpan.org/pod/Archive::BagIt> +Payload-Oxum: 23.1 +Bag-Size: 23 B diff --git a/tmp/bagit/test/bagit.txt b/tmp/bagit/test/bagit.txt new file mode 100644 index 0000000000000000000000000000000000000000..33835cda70940cd823354cea5a1776c925221934 --- /dev/null +++ b/tmp/bagit/test/bagit.txt @@ -0,0 +1,2 @@ +BagIt-Version: 1.0 +Tag-File-Character-Encoding: UTF-8 \ No newline at end of file diff --git a/tmp/bagit/test/data/test.txt b/tmp/bagit/test/data/test.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f3f31b13b1726146f8777621ec363583bbea240 --- /dev/null +++ b/tmp/bagit/test/data/test.txt @@ -0,0 +1 @@ +test file for payload. diff --git a/tmp/bagit/test/manifest-md5.txt b/tmp/bagit/test/manifest-md5.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc8b2b1b74d3f90976eac71ffcf04d6d74446fa0 --- /dev/null +++ b/tmp/bagit/test/manifest-md5.txt @@ -0,0 +1 @@ +0f371d83cd19d8a20cc6c4ff66bf1d1b data/test.txt diff --git a/tmp/bagit/test/manifest-sha512.txt b/tmp/bagit/test/manifest-sha512.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ac5937e23d7064973bb333c79f43121312bbd47 --- /dev/null +++ b/tmp/bagit/test/manifest-sha512.txt @@ -0,0 +1 @@ +a9236acde7945d0848ae76233017caed4dc0dfab68f58a8a38fa1052c0e215a72a760b0b0c11ab4fd4b3656504f4f2d8e6daf1652d38c106c65d24f88cf97c72 data/test.txt diff --git a/tmp/bagit/test/meta/Fallbeispiel-01.xml b/tmp/bagit/test/meta/Fallbeispiel-01.xml new file mode 100644 index 0000000000000000000000000000000000000000..afc2677f84e2b7aeafeac8952251a514e5f461c5 --- /dev/null +++ b/tmp/bagit/test/meta/Fallbeispiel-01.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>publicdomain</slubarchiv:copyrightStatus> +</slubarchiv:rightsRecord> diff --git a/tmp/bagit/test/meta/Fallbeispiel-02.xml b/tmp/bagit/test/meta/Fallbeispiel-02.xml new file mode 100644 index 0000000000000000000000000000000000000000..54dd8318ee558560daae4ee320cec8b2742a5f0a --- /dev/null +++ b/tmp/bagit/test/meta/Fallbeispiel-02.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2017-10-10">Vertrag zw. Herrn Mustermann und SLUB</slubarchiv:contract> + </slubarchiv:permissions> + <slubarchiv:legalRestrictions> + <slubarchiv:personalRight>Gerichtsurteil Amtsgericht Dresden, AZ: 2993/3829002A</slubarchiv:personalRight> + </slubarchiv:legalRestrictions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/tmp/bagit/test/meta/Fallbeispiel-03.xml b/tmp/bagit/test/meta/Fallbeispiel-03.xml new file mode 100644 index 0000000000000000000000000000000000000000..562ad72c0cd1384291d2b4c5ed798a16eb1ce99f --- /dev/null +++ b/tmp/bagit/test/meta/Fallbeispiel-03.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:license url="https://creativecommons.org/publicdomain/zero/1.0/">CC0 1.0</slubarchiv:license> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/tmp/bagit/test/meta/Fallbeispiel-04.xml b/tmp/bagit/test/meta/Fallbeispiel-04.xml new file mode 100644 index 0000000000000000000000000000000000000000..d3d85e0d1a33e808b25e4cc9fa1d94c930061e4e --- /dev/null +++ b/tmp/bagit/test/meta/Fallbeispiel-04.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2017-01-01">Vereinbarung zur Digitalisierung und zur digitalen Präsentation von Beständen im Rahmen des Landesdigitalisierungsprogramms für Wissenschaft und Kultur zwischen Einrichtung X und der Sächsische Landesbibliothek – Staats- und Universitätsbibliothek Dresden (SLUB)</slubarchiv:contract> + <slubarchiv:license url="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</slubarchiv:license> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/tmp/bagit/test/meta/Fallbeispiel-05.xml b/tmp/bagit/test/meta/Fallbeispiel-05.xml new file mode 100644 index 0000000000000000000000000000000000000000..be18aee422a57d2b2106d4831f1ad7c71f8edfa8 --- /dev/null +++ b/tmp/bagit/test/meta/Fallbeispiel-05.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:orphanedWork/> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/tmp/bagit/test/meta/Fallbeispiel-06.xml b/tmp/bagit/test/meta/Fallbeispiel-06.xml new file mode 100644 index 0000000000000000000000000000000000000000..7edf44ca576d5d8dfb78fb03273ba46d2c3e2040 --- /dev/null +++ b/tmp/bagit/test/meta/Fallbeispiel-06.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2015-01-01">Rahmenvertrag zur Nutzung von vergriffenen Werken in Büchern zwischen Bund, Ländern, Verwertungsgesellschaft WORT und Verwertungsgesellschaft Bild-Kunst</slubarchiv:contract> + <slubarchiv:outOfPrintWork/> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/tmp/bagit/test/meta/Fallbeispiel-07.xml b/tmp/bagit/test/meta/Fallbeispiel-07.xml new file mode 100644 index 0000000000000000000000000000000000000000..5070a2b84fb4228c573aa7459fe726460cfb5e07 --- /dev/null +++ b/tmp/bagit/test/meta/Fallbeispiel-07.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2019-01-31">Vertrag zur Digitalisierung der Klemperer-Tagebücher zwischen dem Aufbau-Verlag und der SLUB</slubarchiv:contract> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/tmp/bagit/test/meta/Fallbeispiel-08a-undef.xml b/tmp/bagit/test/meta/Fallbeispiel-08a-undef.xml new file mode 100644 index 0000000000000000000000000000000000000000..75d2e3313cc9dec509857787ef41fff1f9ba80cd --- /dev/null +++ b/tmp/bagit/test/meta/Fallbeispiel-08a-undef.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-1.xsd"> + <slubarchiv:copyrightStatus>undefined</slubarchiv:copyrightStatus> + <slubarchiv:legalRestrictions> + <slubarchiv:childProtection>Nationalsozialistischer Inhalt</slubarchiv:childProtection> + </slubarchiv:legalRestrictions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/tmp/bagit/test/meta/Fallbeispiel-09.xml b/tmp/bagit/test/meta/Fallbeispiel-09.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e1f1373e688d698ce2902f17053af2d9d1291ac --- /dev/null +++ b/tmp/bagit/test/meta/Fallbeispiel-09.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2016-12-09">Kooperationsvereinbarung zwischen dem Freistaat Sachsen, vertreten durch das Landesamt für Umwelt, Landwirtschaft und Geologie (LfULG) und der Sächsischen Landesbibliothek - Staats- und Universitätsbibliothek Dresden (SLUB)</slubarchiv:contract> + </slubarchiv:permissions> + <slubarchiv:legalRestrictions> + <slubarchiv:confidentialContent>Dieses Dokument enthält Betriebs- und Geschäftsgeheimnisse.</slubarchiv:confidentialContent> + </slubarchiv:legalRestrictions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/tmp/bagit/test/meta/Fallbeispiel-10.xml b/tmp/bagit/test/meta/Fallbeispiel-10.xml new file mode 100644 index 0000000000000000000000000000000000000000..01fed1166c4ae81d1df0639fbc115e159421090c --- /dev/null +++ b/tmp/bagit/test/meta/Fallbeispiel-10.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2016-12-09">Kooperationsvereinbarung zwischen dem Freistaat Sachsen, vertreten durch das Landesamt für Umwelt, Landwirtschaft und Geologie (LfULG) und der Sächsischen Landesbibliothek - Staats- und Universitätsbibliothek Dresden (SLUB)</slubarchiv:contract> + </slubarchiv:permissions> + <slubarchiv:legalRestrictions> + <slubarchiv:confidentialContent>Dieses Dokument enthält Daten über sensible Einrichtungen.</slubarchiv:confidentialContent> + </slubarchiv:legalRestrictions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/tmp/bagit/test/meta/Fallbeispiel-11.xml b/tmp/bagit/test/meta/Fallbeispiel-11.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e97ef2f4c8309e5a0eef2c85214347313c7d418 --- /dev/null +++ b/tmp/bagit/test/meta/Fallbeispiel-11.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2016-12-09">Kooperationsvereinbarung zwischen dem Freistaat Sachsen, vertreten durch das Landesamt für Umwelt, Landwirtschaft und Geologie (LfULG) und der Sächsischen Landesbibliothek - Staats- und Universitätsbibliothek Dresden (SLUB)</slubarchiv:contract> + </slubarchiv:permissions> + <slubarchiv:legalRestrictions> + <slubarchiv:personalRight>Das Dokument enthält persönliche Daten, präzise Wohnorte oder andere Informationen mit Personenbezug.</slubarchiv:personalRight> + </slubarchiv:legalRestrictions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/tmp/bagit/test/meta/Fallbeispiel-12.xml b/tmp/bagit/test/meta/Fallbeispiel-12.xml new file mode 100644 index 0000000000000000000000000000000000000000..dd6aea1c55bfaa492d6b56aa276070509522aac2 --- /dev/null +++ b/tmp/bagit/test/meta/Fallbeispiel-12.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2016-12-09">Kooperationsvereinbarung zwischen dem Freistaat Sachsen, vertreten durch das Landesamt für Umwelt, Landwirtschaft und Geologie (LfULG) und der Sächsischen Landesbibliothek - Staats- und Universitätsbibliothek Dresden (SLUB)</slubarchiv:contract> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/tmp/bagit/test/meta/Fallbeispiel-13.xml b/tmp/bagit/test/meta/Fallbeispiel-13.xml new file mode 100644 index 0000000000000000000000000000000000000000..4b9b0dbaa786a0b27ce999db6d157791d41e32af --- /dev/null +++ b/tmp/bagit/test/meta/Fallbeispiel-13.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>publicdomain</slubarchiv:copyrightStatus> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/tmp/bagit/test/meta/Fallbeispiel-14.xml b/tmp/bagit/test/meta/Fallbeispiel-14.xml new file mode 100644 index 0000000000000000000000000000000000000000..d67bbe08e4579803dc08fc03c256707fa2bcac9d --- /dev/null +++ b/tmp/bagit/test/meta/Fallbeispiel-14.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2012-03-13">Lizenzvertrag zwischen der Sächsischen Landesbibliothek - Staats- und Universitätsbibliothek Dresden (SLUB) und dem Dresdner Geschichtsverein e.V., Redaktion Dresdner Hefte</slubarchiv:contract> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/tmp/bagit/test/meta/Fallbeispiel-15.xml b/tmp/bagit/test/meta/Fallbeispiel-15.xml new file mode 100644 index 0000000000000000000000000000000000000000..b0bd80dad0238ec384f7899342071b50493f6d92 --- /dev/null +++ b/tmp/bagit/test/meta/Fallbeispiel-15.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> + <slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:contract date="2017-07-18">Einverständniserklärung für das elektronische Publizieren in den Digitalen Sammlungen der SLUB. Autor oder sonstige Rechteinhaber: Rat für Formgebung</slubarchiv:contract> + <slubarchiv:license url="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</slubarchiv:license> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/tmp/bagit/test/meta/Fallbeispiel-16.xml b/tmp/bagit/test/meta/Fallbeispiel-16.xml new file mode 100644 index 0000000000000000000000000000000000000000..8d9bddae032fcf5a266fb70e424f918b3485832f --- /dev/null +++ b/tmp/bagit/test/meta/Fallbeispiel-16.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-2.xsd"> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> + <slubarchiv:permissions> + <slubarchiv:license url="https://www.govdata.de/dl-de/by-2-0">DL-DE BY 2.0</slubarchiv:license> + </slubarchiv:permissions> +</slubarchiv:rightsRecord> diff --git a/tmp/bagit/test/meta/bubble.xml b/tmp/bagit/test/meta/bubble.xml new file mode 100644 index 0000000000000000000000000000000000000000..3713df5e6c931dce354bb643d687460931e91de9 --- /dev/null +++ b/tmp/bagit/test/meta/bubble.xml @@ -0,0 +1 @@ +this is my rights.xml \ No newline at end of file diff --git a/tmp/bagit/test/meta/lido.xml b/tmp/bagit/test/meta/lido.xml new file mode 100644 index 0000000000000000000000000000000000000000..19b16cc72c67d3a63e9545d4ad01635e85e4c8d9 --- /dev/null +++ b/tmp/bagit/test/meta/lido.xml @@ -0,0 +1 @@ +<xml></xml> \ No newline at end of file diff --git a/tmp/bagit/test/meta/mods.xml b/tmp/bagit/test/meta/mods.xml new file mode 100644 index 0000000000000000000000000000000000000000..ab512e26c7d17e941357c4e439a6fd31d85dc568 --- /dev/null +++ b/tmp/bagit/test/meta/mods.xml @@ -0,0 +1,38 @@ +<mods:mods xmlns:mods="http://www.loc.gov/mods/v3"> +<mods:location> +<mods:physicalLocation authority="marcorg" displayLabel="Saxon State Library, Dresden, +Germany">DE-14</mods:physicalLocation> +<mods:shelfLocator>Hist.Sax.M.37.t,120</mods:shelfLocator> +</mods:location> +<mods:relatedItem type="series"> +<mods:titleInfo> +<mods:title>Saxonica</mods:title> +</mods:titleInfo> +</mods:relatedItem> +<mods:recordInfo> +<mods:recordIdentifier source="http://digital.slub-dresden.de/oai/">oai:de:slub-dresden:db:id- +319037843</mods:recordIdentifier> +</mods:recordInfo> +<mods:physicalDescription> +<mods:digitalOrigin>reformatted digital</mods:digitalOrigin> +<mods:extent>[1] Bl.</mods:extent> +</mods:physicalDescription> +<mods:identifier type="urn">urn:nbn:de:bsz:14-db-id3190378431</mods:identifier> +<mods:titleInfo> +<mods:title>Eingabe der Handelskammer zu Leipzig den Entwurf eines Tabak-Steuer-Gesetzes +betr.</mods:title> +<mods:subTitle>an den Reichstag zu Berlin</mods:subTitle> +</mods:titleInfo> +<mods:language> +<mods:languageTerm authority="rfc3066" type="code">de</mods:languageTerm> +</mods:language> +<mods:originInfo> +<mods:place> +<mods:placeTerm type="text">[Leipzig]</mods:placeTerm> +</mods:place> +<mods:dateIssued keyDate="yes">1893</mods:dateIssued> +</mods:originInfo> +<mods:subject authority="slub"> +<mods:topic>eingdehaz</mods:topic> +</mods:subject> +</mods:mods> diff --git a/tmp/bagit/test/meta/rights.xml b/tmp/bagit/test/meta/rights.xml new file mode 100644 index 0000000000000000000000000000000000000000..3201b82290c78afdb5e85650061cae25fe930e26 --- /dev/null +++ b/tmp/bagit/test/meta/rights.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<slubarchiv:rightsRecord xmlns:slubarchiv="http://slubarchiv.slub-dresden.de/rights1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://slubarchiv.slub-dresden.de/rights1 https://slubarchiv.slub-dresden.de/slubarchiv/standards/rights/slub-rr-v09-1.xsd"> + <slubarchiv:copyrightStatus>publicdomain</slubarchiv:copyrightStatus> + <slubarchiv:copyrightStatus>copyrighted</slubarchiv:copyrightStatus> +</slubarchiv:rightsRecord> \ No newline at end of file diff --git a/tmp/bagit/test/tagmanifest-md5.txt b/tmp/bagit/test/tagmanifest-md5.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3a1add237a1e8248cb42b172bc81dbd7f2a86cd --- /dev/null +++ b/tmp/bagit/test/tagmanifest-md5.txt @@ -0,0 +1,24 @@ +78bfb3f0189a50e8652f8fcfffebeb12 manifest-sha512.txt +06a9a0a42aa2cc4fa3a14f297332a910 bag-info.txt +7cb0edfcba877a10170214f4f97d0319 bagit.txt +4aa497234e99e2f9302d10bed31db634 manifest-md5.txt +f740bc44043ec253db9769cb0c9a8d19 meta/Fallbeispiel-13.xml +cdf02f02ae37d205a8001620f7c21c3a meta/Fallbeispiel-11.xml +02f6b1490d80267353665fee28e25ed3 meta/Fallbeispiel-09.xml +8eb41527a8f53e5d673771fa2159edac meta/lido.xml +743fa286c3b9c844692cd1f2d3f915a5 meta/Fallbeispiel-15.xml +ec3d3814ac0abaa8db5a17e13340f2de meta/Fallbeispiel-10.xml +7a2072e4a274eab696e1bb61875a5e02 meta/Fallbeispiel-08a-undef.xml +46dd9d5d932491ba90a4343c453a5af6 meta/Fallbeispiel-02.xml +f9e28bc32b24e40dddb9b6b3f987ec0d meta/Fallbeispiel-12.xml +6b989c27ffc4b5f6bdc4f19004218d63 meta/Fallbeispiel-01.xml +83a428c1dbfb0d533ece93ba1ceb9299 meta/Fallbeispiel-14.xml +b546f354e3a76f49849289d842de3b39 meta/mods.xml +43891602828342b90fe94da9b9f7120c meta/bubble.xml +298ce32d1f803e6ad29c44ef976336cc meta/Fallbeispiel-05.xml +507478ce77b84c2b0a7629b2068ca719 meta/Fallbeispiel-16.xml +8f0a95392ddf10c6a3a1f1d9c702d932 meta/Fallbeispiel-07.xml +cf3f8d57a1c40802a68ca77cb33a698a meta/Fallbeispiel-03.xml +bd82c36224a282d3d8f160b08aea9b1c meta/rights.xml +c4f2b6fd35095bdd5f6978c25a6786b0 meta/Fallbeispiel-04.xml +17298c34a10cdb41a11e38012de116f2 meta/Fallbeispiel-06.xml diff --git a/tmp/bagit/test/tagmanifest-sha512.txt b/tmp/bagit/test/tagmanifest-sha512.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccfff1cd1627f96b5dcb115670aa1174f7457066 --- /dev/null +++ b/tmp/bagit/test/tagmanifest-sha512.txt @@ -0,0 +1,24 @@ +b1c9a4bc23f472db7fff27884e69567fd62ee2dc17b36909a373b80fda9b0bcf84491ce0bc163e00ce43e4f02e085a3d5315556604cf23f40e81a25d3c0a57a8 manifest-sha512.txt +9d6d9564dcc56625afb0435ef27906023f5df6e0f834c4e5b5e715c2ae58cd9722d1c9215502a1661d7eaec251ecd51f53cc945997dd9f51c65c5a62b10eb9ca bag-info.txt +da429ec4f5ca60aebd25aa4c26ccf51ae87609129ae76f09683c810da4af4414277250ecc0253bf7871c7a3f9c5b3ed6918a5d5c092a7dc394051601eb8bb3ab bagit.txt +0e892c5219c5b1153f6cdbdcdc4c08d5fb7d0eeb63725d4ec19110ccc28ed59d0129ccdb29117d8094f5e8f04924db6dc55b8a0416216a60df46047d4ede4114 manifest-md5.txt +0e536576d7a4942c4ce0c7f7916c184f39e28ef84a74fc43f5c9120105cb5a0e5ac0f5d005714f8c2bd6fe172ab325a89cfcbf2438f26152152f8ab8b0b92da4 meta/Fallbeispiel-13.xml +fb6d50d6f2cfbb3393e86933d69f5064cb43efc99b0e7378cc76d235f94dd6050dd63d8f6cea9502ceead2d12333980a612f7c105a0423bb1e535d436bbf73cf meta/Fallbeispiel-11.xml +b7f296480e351afd40a2704721022daa918a1468c153e221474eabaf9f58e3c2143f79a1f872dba4caf39e5d8cdcb85950ec90b7f2748664df3735d702f7e11f meta/Fallbeispiel-09.xml +f2df67529acb78b080b1fed3ff488851ebc881d9a782240bd1c70a3c8cb2c4ea22c95d0f1646de9626ff2d1ad51c236d7d092badbbc55e4d8c15c1562f72576d meta/lido.xml +3b98b3735eccca29868cdafcc0f4af13ad5e99cee31c9d25da918bab35b72d787bedd5d51fdb9574d2b1759b5fb0d3d21568c91a4befa88fd154465622490537 meta/Fallbeispiel-15.xml +d30ced0c9d8c30125a42c69f0a4328c30ea5d0468d6a343947f5bc7a5e32b3ae726f8d74ce94df1c294786ba42facd61b82bf7d7f6d3d40ad6cbb79f99967297 meta/Fallbeispiel-10.xml +515e5aeb9c4460fe5a11c6bdbd0dde75a62a08ed5c8f3e97afba47ec854f6de5c902e061478caf5798e2f70092713b855dbee83713407f9c0722e7bfcf2e9708 meta/Fallbeispiel-08a-undef.xml +29e837f2b59dfe9bda33abe448e262d9b8d33a159812b2eb3841d3cb190866a654dfd479f2f0d8b7af436c3a757ba1f474c655397688d55f6375dd87d8bcd9c9 meta/Fallbeispiel-02.xml +6a5bd8bdeddc61c8221448d5e6a73c36dd8aac7d275ab0461464a7f5bcbde585f6c7494bff671b7ab1485864df3c79eadb3e686cd258d9f9bda0aeb7b0d735b2 meta/Fallbeispiel-12.xml +742653e079c1d95821afa65ce45d367ccc3d14d5e2512fce54d8a1c56bc02d020190308347cfca49326a8cef2f897cfc00261fb519b31714599ae771f062066b meta/Fallbeispiel-01.xml +f834973edc63c41c0b579082867c79a264e9d18c6bf68e3a2bcd59acf57857b7d9b6eb19f963a7d733238f0b72fdf2103e3f7b4ab7b7e41bfbdf498d3523bf85 meta/Fallbeispiel-14.xml +b637642ada4336d2048ba4d62585577158cdf2ecf54bf9b2f64887b5747f665e81035ff752be810d7b04468de9415f39d61c5d4cf0426c9c5f52de1b9a272ba4 meta/mods.xml +ad8312d611dfe1b053a222b7c2f789fd0f6e4af20002ec3cea5e6e2a6bbf7bdeee0d06f1cb098b168f136245f34933ed4333c70ff3465881be13dbb14ca633dd meta/bubble.xml +46dd3646a29493637c1c53e95bdc0ef4ebab02779531927b1ce7312ecb3d85399ec017ebb12cf5fd26691dae4f1565bc8a3aef1941b26692057f50f119de999f meta/Fallbeispiel-05.xml +76f23f267a00fc17f862878acbd22811f25161c592cb88940df4915ffd6781feb85376faf72173859ba0059601f1c3f8bee692bb415b5fbc11991b433cd4069b meta/Fallbeispiel-16.xml +fee687a2b7075da983e02a05c7fc7feebabb57e6ae4e3a4b1861868a2bccb75bbeaaeb2efb26e5c5d3bdcdf7b50ee77e2129c7e22301e9295b98e8e68016223f meta/Fallbeispiel-07.xml +91b54fc590eb1ad01adfdd948bb476765611ac923ded7ead9e51eada62c64272ac9c822d73ba082a0f0455a6e3a38db4cbe257733813d5b1f8071ff236a3827e meta/Fallbeispiel-03.xml +56ea1ad45cd66672c40272fd0603f978d69f81433f327ddfd3058fa612ccd13bc18bd71a554f8bd18e71c41ed9e6917575367c2db14dfa4cea9a75d0c23ffe26 meta/rights.xml +3d8161db1019c82a117043c36e8c96d7bec8af6b0cacbc0716e1422cdce1317d9f5d0dbb129a908aafd2645784314cf7112c1b57edd145755fca13c8c34a4d28 meta/Fallbeispiel-04.xml +659cc2b2901b77570f78b99cce9333e479aef93cd72ab322694b3b99604318c6aa54832ce63a43a7622200873b38f52aa3fee8cd94d9fc90708fe0692f4e72d9 meta/Fallbeispiel-06.xml diff --git a/xsd/archive.xsd b/xsd/archive.xsd deleted file mode 100644 index 15d034a11877d937a19c3d5eea17397bfecf0d07..0000000000000000000000000000000000000000 --- a/xsd/archive.xsd +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://slub-dresden.de/slubarchiv" xmlns:archive="http://slub-dresden.de/slubarchiv"> - <xs:element name="record" type="archive:record"/> - <xs:complexType name="record"> - <xs:all> - <xs:element name="archivalValueDescription" type="archive:NonEmptyString" minOccurs="1" maxOccurs="1"/> - <xs:element name="exportToArchiveDate" type="xs:dateTime" minOccurs="1" maxOccurs="1"/> - <xs:element name="externalId" type="archive:LzaIdSubstring" minOccurs="1" maxOccurs="1"/> - <xs:element name="externalIsilId" type="archive:NonEmptyString" minOccurs="0" maxOccurs="1"/> - <xs:element name="externalWorkflow" type="archive:LzaIdSubstring" minOccurs="1" maxOccurs="1"/> - <xs:element name="hasConservationReason" type="xs:boolean" minOccurs="1" maxOccurs="1"/> - </xs:all> - <xs:attribute name="version" type="archive:SipVersionString" use="required"/> - </xs:complexType> - <xs:simpleType name="NonEmptyString"> - <xs:restriction base="xs:string"> - <xs:pattern value="[\s\S]*[^ ][\s\S]*"/> - </xs:restriction> - </xs:simpleType> - <xs:simpleType name="LzaIdSubstring"> - <xs:restriction base="xs:string"> - <xs:pattern value="[a-z0-9]+"/> - </xs:restriction> - </xs:simpleType> - <xs:simpleType name="SipVersionString"> - <xs:restriction base="xs:string"> - <xs:enumeration value="v2017.1"/> - </xs:restriction> - </xs:simpleType> -</xs:schema> diff --git a/xsd/rights1.xsd b/xsd/rights1.xsd new file mode 100644 index 0000000000000000000000000000000000000000..95237503a10786714ebb22f5762dfee4d4611df5 --- /dev/null +++ b/xsd/rights1.xsd @@ -0,0 +1,274 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- SLUB Archiv Rechteschema --> +<!-- 2019-12-18: Version 1.0 --> + +<xs:schema + targetNamespace="http://slubarchiv.slub-dresden.de/rights1" + xmlns="http://slubarchiv.slub-dresden.de/rights1" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + elementFormDefault="qualified" + version="1.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Schema zur Beschreibung von Rechten</xs:documentation> + </xs:annotation> + <xs:element name="rightsRecord" type="typeRightsRecord"> + <xs:annotation> + <xs:documentation xml:lang="de">Rechteinformationen</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="typeRightsRecord"> + <xs:sequence> + <xs:element name="copyrightStatus" minOccurs="1" maxOccurs="1" type="typeCopyrightStatus"> + <xs:annotation> + <xs:documentation xml:lang="de">Aussage zum Urheberrecht des Materials.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="permissions" minOccurs="0" maxOccurs="1" type="typePermissions"> + <xs:annotation> + <xs:documentation xml:lang="de">Aussage(n) zu rechtskräftigen Erlaubnissen oder Genehmigungen des Materials</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="legalRestrictions" minOccurs="0" maxOccurs="1" type="typeLegalRestrictions"> + <xs:annotation> + <xs:documentation xml:lang="de">Aussage(n) zu gesetzlichen Einschränkungen des Materials</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:complexType name="typePermissions"> + <xs:sequence> + <xs:element name="contract" minOccurs="0" maxOccurs="unbounded" type="typeContract"> + <xs:annotation> + <xs:documentation xml:lang="de">Eine kurze Beschreibung des Vertrags inklusive Vertragspartner.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="license" minOccurs="0" maxOccurs="unbounded" type="typeLicense"> + <xs:annotation> + <xs:documentation xml:lang="de">Lizenz</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="orphanedWork" minOccurs="0" maxOccurs="1" type="typeStringWithOptionalLanguageDeclaration"> + <xs:annotation> + <xs:documentation xml:lang="de">Das Material ist ein verwaistes Werk nach Urheberrechtsgesetz §61 (Fassung vom 01.01.2014). Optionale Aussagen sind möglich, haben aber nur informativen Charakter.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="outOfPrintWork" minOccurs="0" maxOccurs="1" type="typeStringWithOptionalLanguageDeclaration"> + <xs:annotation> + <xs:documentation xml:lang="de">Das Material ist ein vergriffenes Werk nach Verwertungsgesellschaftengesetz §51 (Fassung vom 01.06.2016). Optionale Aussagen sind möglich, haben aber nur informativen Charakter.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:complexType name="typeLegalRestrictions"> + <xs:sequence> + <xs:element name="childProtection" type="typeStringWithOptionalLanguageDeclaration" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="de">Material mit Jugendschutz-relevanten Inhalten</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="confidentialContent" type="typeStringWithOptionalLanguageDeclaration" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="de">Material mit vertraulichen oder sicherheitsrelevanten Inhalten</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="other" type="typeStringWithOptionalLanguageDeclaration" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="de">Eine sonstige Beschränkung, die aktuell nicht abbildbar ist.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="personalRight" type="typeStringWithOptionalLanguageDeclaration" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="de">Material mit persönlichen Rechten</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="pornographicContent" type="typeStringWithOptionalLanguageDeclaration" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="de">pornografisches Material mit sittenwidrigen oder strafrechtlich verfolgten Inhalten</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="trademark" type="typeStringWithOptionalLanguageDeclaration" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="de">Material mit Markenrecht-relevanten Inhalten</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="unconstitutionalContent" type="typeStringWithOptionalLanguageDeclaration" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="de">Material mit verfassungswidrigen Inhalten</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:complexType name="typeContract"> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute name="date" use="required" type="xs:date"> + <xs:annotation> + <xs:documentation xml:lang="de">Datum des Vertrags</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="fileNumber" use="optional" type="typeNonEmptyString"> + <xs:annotation> + <xs:documentation xml:lang="de">Vertragsnummer oder Aktenzeichen</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + <xs:complexType name="typeLicense" mixed="true"> + <xs:simpleContent> + <xs:extension base="typeLicenseStrings"> + <xs:attribute name="url" use="optional" type="xs:anyURI"> + <xs:annotation> + <xs:documentation xml:lang="de">URL zum Lizenztext</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + <xs:complexType name="typeStringWithOptionalLanguageDeclaration"> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute name="lang" use="optional" type="xs:language" default="de"> + <xs:annotation> + <xs:documentation xml:lang="de">Sprache der Beschreibung</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + <xs:complexType name="typeNonEmptyStringWithOptionalLanguageDeclaration"> + <xs:simpleContent> + <xs:extension base="typeNonEmptyString"> + <xs:attribute name="lang" use="optional" type="xs:language" default="de"> + <xs:annotation> + <xs:documentation xml:lang="de">Sprache der Beschreibung</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + <xs:simpleType name="typeCopyrightStatus"> + <xs:restriction base="xs:string"> + <xs:enumeration value="publicdomain"> + <xs:annotation> + <xs:documentation xml:lang="de">Das Material ist gemeinfrei und nicht urheberrechtsbehaftet nach deutschem Recht.</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="copyrighted"> + <xs:annotation> + <xs:documentation xml:lang="de">Das Material ist urheberrechtsbehaftet nach deutschem Recht. Es gilt das Urheberrechtsgesetz (in der Fassung vom 01.01.2019).</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="undefined"> + <xs:annotation> + <xs:documentation xml:lang="de">Die Urheberrechte des Materials sind ungeklärt. Eine Prüfung läuft gerade oder hat noch nicht stattgefunden.</xs:documentation> + </xs:annotation> + </xs:enumeration> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="typeLicenseStrings"> + <xs:restriction base="xs:string"> + <xs:enumeration value="CC0 1.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: CC0 1.0 Universell - Public Domain Dedication</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY 3.0 DE"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung 3.0 Deutschland</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY 4.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung 4.0 International</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-SA 3.0 DE"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Weitergabe unter gleichen Bedingungen 3.0 Deutschland</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-SA 4.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Weitergabe unter gleichen Bedingungen 4.0 International</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-ND 3.0 DE"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Keine Bearbeitung 3.0 Deutschland</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-ND 4.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Keine Bearbeitung 4.0 International</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-NC 3.0 DE"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Nicht kommerziell 3.0 Deutschland</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-NC 4.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Nicht kommerziell 4.0 International</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-NC-SA 3.0 DE"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Nicht kommerziell - Weitergabe unter gleichen Bedingungen 3.0 Deutschland</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-NC-SA 4.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Nicht kommerziell - Weitergabe unter gleichen Bedingungen 4.0 International</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-NC-ND 3.0 DE"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Nicht kommerziell - Keine Bearbeitung 3.0 Deutschland</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-NC-ND 4.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Nicht kommerziell - Keine Bearbeitung 4.0 International</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="DL-DE BY 1.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Datenlizenz Deutschland - Namensnennung - Version 1.0</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="DL-DE BY-NC 1.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Datenlizenz Deutschland - Namensnennung - nicht kommerziell - Version 1.0</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="DL-DE BY 2.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Datenlizenz Deutschland - Namensnennung - Version 2.0</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="DL-DE Zero 2.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Datenlizenz Deutschland - Zero - Version 2.0</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="GNU FDL 1.3"> + <xs:annotation> + <xs:documentation xml:lang="de">GNU Free Documentation License 1.3</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="other"> + <xs:annotation> + <xs:documentation xml:lang="de">Eine sonstige Lizenz, die aktuell nicht abbildbar ist.</xs:documentation> + </xs:annotation> + </xs:enumeration> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="typeNonEmptyString"> + <xs:restriction base="xs:string"> + <xs:minLength value="1"></xs:minLength> + </xs:restriction> + </xs:simpleType> +</xs:schema> diff --git a/xsd/slub-rr-v09-2.xsd b/xsd/slub-rr-v09-2.xsd new file mode 100644 index 0000000000000000000000000000000000000000..96922463a76e6d393415e5c0b4ccef998a6ce511 --- /dev/null +++ b/xsd/slub-rr-v09-2.xsd @@ -0,0 +1,274 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- SLUB Archiv Rechteschema --> +<!-- 2019-12-18: Version 0.9.2 --> + +<xs:schema + targetNamespace="http://slubarchiv.slub-dresden.de/rights1" + xmlns="http://slubarchiv.slub-dresden.de/rights1" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + elementFormDefault="qualified" + version="0.9.2"> + <xs:annotation> + <xs:documentation xml:lang="de">Schema zur Beschreibung von Rechten</xs:documentation> + </xs:annotation> + <xs:element name="rightsRecord" type="typeRightsRecord"> + <xs:annotation> + <xs:documentation xml:lang="de">Rechteinformationen</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="typeRightsRecord"> + <xs:sequence> + <xs:element name="copyrightStatus" minOccurs="1" maxOccurs="1" type="typeCopyrightStatus"> + <xs:annotation> + <xs:documentation xml:lang="de">Aussage zum Urheberrecht des Materials.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="permissions" minOccurs="0" maxOccurs="1" type="typePermissions"> + <xs:annotation> + <xs:documentation xml:lang="de">Aussage(n) zu rechtskräftigen Erlaubnissen oder Genehmigungen des Materials</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="legalRestrictions" minOccurs="0" maxOccurs="1" type="typeLegalRestrictions"> + <xs:annotation> + <xs:documentation xml:lang="de">Aussage(n) zu gesetzlichen Einschränkungen des Materials</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:complexType name="typePermissions"> + <xs:sequence> + <xs:element name="contract" minOccurs="0" maxOccurs="unbounded" type="typeContract"> + <xs:annotation> + <xs:documentation xml:lang="de">Eine kurze Beschreibung des Vertrags inklusive Vertragspartner.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="license" minOccurs="0" maxOccurs="unbounded" type="typeLicense"> + <xs:annotation> + <xs:documentation xml:lang="de">Lizenz</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="orphanedWork" minOccurs="0" maxOccurs="1" type="typeStringWithOptionalLanguageDeclaration"> + <xs:annotation> + <xs:documentation xml:lang="de">Das Material ist ein verwaistes Werk nach Urheberrechtsgesetz §61 (Fassung vom 01.01.2014). Optionale Aussagen sind möglich, haben aber nur informativen Charakter.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="outOfPrintWork" minOccurs="0" maxOccurs="1" type="typeStringWithOptionalLanguageDeclaration"> + <xs:annotation> + <xs:documentation xml:lang="de">Das Material ist ein vergriffenes Werk nach Verwertungsgesellschaftengesetz §51 (Fassung vom 01.06.2016). Optionale Aussagen sind möglich, haben aber nur informativen Charakter.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:complexType name="typeLegalRestrictions"> + <xs:sequence> + <xs:element name="childProtection" type="typeStringWithOptionalLanguageDeclaration" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="de">Material mit Jugendschutz-relevanten Inhalten</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="confidentialContent" type="typeStringWithOptionalLanguageDeclaration" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="de">Material mit vertraulichen oder sicherheitsrelevanten Inhalten</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="other" type="typeStringWithOptionalLanguageDeclaration" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="de">Eine sonstige Beschränkung, die aktuell nicht abbildbar ist.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="personalRight" type="typeStringWithOptionalLanguageDeclaration" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="de">Material mit persönlichen Rechten</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="pornographicContent" type="typeStringWithOptionalLanguageDeclaration" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="de">pornografisches Material mit sittenwidrigen oder strafrechtlich verfolgten Inhalten</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="trademark" type="typeStringWithOptionalLanguageDeclaration" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="de">Material mit Markenrecht-relevanten Inhalten</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="unconstitutionalContent" type="typeStringWithOptionalLanguageDeclaration" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="de">Material mit verfassungswidrigen Inhalten</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:complexType name="typeContract"> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute name="date" use="required" type="xs:date"> + <xs:annotation> + <xs:documentation xml:lang="de">Datum des Vertrags</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="fileNumber" use="optional" type="typeNonEmptyString"> + <xs:annotation> + <xs:documentation xml:lang="de">Vertragsnummer oder Aktenzeichen</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + <xs:complexType name="typeLicense" mixed="true"> + <xs:simpleContent> + <xs:extension base="typeLicenseStrings"> + <xs:attribute name="url" use="optional" type="xs:anyURI"> + <xs:annotation> + <xs:documentation xml:lang="de">URL zum Lizenztext</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + <xs:complexType name="typeStringWithOptionalLanguageDeclaration"> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute name="lang" use="optional" type="xs:language" default="de"> + <xs:annotation> + <xs:documentation xml:lang="de">Sprache der Beschreibung</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + <xs:complexType name="typeNonEmptyStringWithOptionalLanguageDeclaration"> + <xs:simpleContent> + <xs:extension base="typeNonEmptyString"> + <xs:attribute name="lang" use="optional" type="xs:language" default="de"> + <xs:annotation> + <xs:documentation xml:lang="de">Sprache der Beschreibung</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + <xs:simpleType name="typeCopyrightStatus"> + <xs:restriction base="xs:string"> + <xs:enumeration value="publicdomain"> + <xs:annotation> + <xs:documentation xml:lang="de">Das Material ist gemeinfrei und nicht urheberrechtsbehaftet nach deutschem Recht.</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="copyrighted"> + <xs:annotation> + <xs:documentation xml:lang="de">Das Material ist urheberrechtsbehaftet nach deutschem Recht. Es gilt das Urheberrechtsgesetz (in der Fassung vom 01.01.2019).</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="undefined"> + <xs:annotation> + <xs:documentation xml:lang="de">Die Urheberrechte des Materials sind ungeklärt. Eine Prüfung läuft gerade oder hat noch nicht stattgefunden.</xs:documentation> + </xs:annotation> + </xs:enumeration> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="typeLicenseStrings"> + <xs:restriction base="xs:string"> + <xs:enumeration value="CC0 1.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: CC0 1.0 Universell - Public Domain Dedication</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY 3.0 DE"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung 3.0 Deutschland</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY 4.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung 4.0 International</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-SA 3.0 DE"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Weitergabe unter gleichen Bedingungen 3.0 Deutschland</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-SA 4.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Weitergabe unter gleichen Bedingungen 4.0 International</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-ND 3.0 DE"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Keine Bearbeitung 3.0 Deutschland</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-ND 4.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Keine Bearbeitung 4.0 International</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-NC 3.0 DE"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Nicht kommerziell 3.0 Deutschland</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-NC 4.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Nicht kommerziell 4.0 International</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-NC-SA 3.0 DE"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Nicht kommerziell - Weitergabe unter gleichen Bedingungen 3.0 Deutschland</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-NC-SA 4.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Nicht kommerziell - Weitergabe unter gleichen Bedingungen 4.0 International</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-NC-ND 3.0 DE"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Nicht kommerziell - Keine Bearbeitung 3.0 Deutschland</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="CC BY-NC-ND 4.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Creative Commons: Namensnennung - Nicht kommerziell - Keine Bearbeitung 4.0 International</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="DL-DE BY 1.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Datenlizenz Deutschland - Namensnennung - Version 1.0</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="DL-DE BY-NC 1.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Datenlizenz Deutschland - Namensnennung - nicht kommerziell - Version 1.0</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="DL-DE BY 2.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Datenlizenz Deutschland - Namensnennung - Version 2.0</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="DL-DE Zero 2.0"> + <xs:annotation> + <xs:documentation xml:lang="de">Datenlizenz Deutschland - Zero - Version 2.0</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="GNU FDL 1.3"> + <xs:annotation> + <xs:documentation xml:lang="de">GNU Free Documentation License 1.3</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="other"> + <xs:annotation> + <xs:documentation xml:lang="de">Eine sonstige Lizenz, die aktuell nicht abbildbar ist.</xs:documentation> + </xs:annotation> + </xs:enumeration> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="typeNonEmptyString"> + <xs:restriction base="xs:string"> + <xs:minLength value="1"></xs:minLength> + </xs:restriction> + </xs:simpleType> +</xs:schema> diff --git a/xsl/MARC21slim2MODS3-6.patched.xsl b/xsl/MARC21slim2MODS3-6.patched.xsl new file mode 100644 index 0000000000000000000000000000000000000000..b2014b30f14f099d82da48a6cf71802ebb0bfe56 --- /dev/null +++ b/xsl/MARC21slim2MODS3-6.patched.xsl @@ -0,0 +1,5714 @@ +<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"> + <xsl:include href="/home/bolkun/git/SLUB_SIP_Builder/xsl/MARC21slimUtils.xsl"/> + <xsl:output encoding="UTF-8" indent="yes" method="xml"/> + <xsl:strip-space elements="*"/> + + <!-- Maintenance note: For each revision, change the content of <recordInfo><recordOrigin> to reflect the new revision number. + MARC21slim2MODS3-6 + + MODS 3.6 (Revision 1.119) 20180621 + + Revision 1.119 - Fixed 700 ind1=0 to transform - tmee 2018/06/21 + Revision 1.118 - Fixed namePart termsOfAddress subelement order - 2018/01/31 tmee + Revision 1.117 - Fixed name type="corporate" RE: MODS 3.6 - 2017/2/14 ntra + Revision 1.116 - Added nameIdentifier to 700/710/711/100/110/111 $0 RE: MODS 3.6 - 2016/3/15 ws + Revision 1.115 - Added @otherType for 7xx RE: MODS 3.6 - 2016/3/15 ws + Revision 1.114 - Added <itemIdentifier> for 852$p and <itemIdentifier > with type="copy number" for 852$t RE: MODS 3.6 - 2016/3/15 ws + Revision 1.113 - Added @valueURI="contents of $0" for 752/662 RE: MODS 3.6 - 2016/3/15 ws + Revision 1.112 - Added @xml:space="preserve" to title/nonSort on 245 and 242 RE: MODS 3.6 - 2016/3/15 ws + + Revision 1.111 - Added test to prevent empty authority attribute for 047 with no subfield 2. - ws 2016/03/24 + Revision 1.110 - Added test to prevent empty authority attribute for 336 with no subfield 2. - ws 2016/03/24 + Revision 1.109 - Added test to prevent empty authority attribute for 655 and use if ind2 if no subfield 2 is available. - ws 2016/03/24 + Revision 1.108 - Added filter to name templates to exclude names with title subfields. - ws 2016/03/24 + + Revision 1.107 - Added support for 024/@ind1=7 - ws 2016/1/7 + Revision 1.106 - Added a xsl:when to deal with '#' and ' ' in $leader19 and $controlField008-18 - ws 2014/12/19 + Revision 1.105 - Add @unit to extent - ws 2014/11/20 + Revision 1.104 - Fixed 111$n and 711$n to reflect mapping to <namePart> tmee 20141112 + Revision 1.103 - Fixed 008/28 to reflect revised mapping for government publication tmee 20141104 + Revision 1.102 - Fixed 240$s duplication tmee 20140812 + Revision 1.101 - Fixed 130 tmee 20140806 + Revision 1.100 - Fixed 245c tmee 20140804 + Revision 1.99 - Fixed 240 issue tmee 20140804 + Revision 1.98 - Fixed 336 mapping tmee 20140522 + Revision 1.97 - Fixed 264 mapping tmee 20140521 + Revision 1.96 - Fixed 310 and 321 and 008 frequency authority for marcfrequency tmee 2014/04/22 + Revision 1.95 - Modified 035 to include identifier type (WlCaITV) tmee 2014/04/21 + Revision 1.94 - Leader 07 b changed mapping from continuing to serial tmee 2014/02/21 + + MODS 3.5 + Revision 1.93 - Fixed personal name transform for ind1=0 tmee 2014/01/31 + Revision 1.92 - Removed duplicate code for 856 1.51 tmee 2014/01/31 + Revision 1.91 - Fixed createnameFrom720 duplication tmee 2014/01/31 + Revision 1.90 - Fixed 520 displayLabel tmee tmee 2014/01/31 + Revision 1.89 - Fixed 008-06 when value = 's' for cartographics tmee tmee 2014/01/31 + Revision 1.88 - Fixed 510c mapping - tmee 2013/08/29 + Revision 1.87 - Fixed expressions of <accessCondition> type values - tmee 2013/08/29 + Revision 1.86 - Fixed 008 <frequency> subfield to occur w/i <originiInfo> - tmee 2013/08/29 + Revision 1.85 - Fixed 245$c - tmee 2013/03/07 + Revision 1.84 - Fixed 1.35 and 1.36 date mapping for 008 when 008/06=e,p,r,s,t so only 008/07-10 displays, rather than 008/07-14 - tmee 2013/02/01 + Revision 1.83 - Deleted mapping for 534 to note - tmee 2013/01/18 + Revision 1.82 - Added mapping for 264 ind 0,1,2,3 to originInfo - 2013/01/15 tmee + Revision 1.81 - Added mapping for 336$a$2, 337$a$2, 338$a$2 - 2012/12/03 tmee + Revision 1.80 - Added 100/700 mapping for "family" - 2012/09/10 tmee + Revision 1.79 - Added 245 $s mapping - 2012/07/11 tmee + Revision 1.78 - Fixed 852 mapping <shelfLocation> was changed to <shelfLocator> - 2012/05/07 tmee + Revision 1.77 - Fixed 008-06 when value = 's' - 2012/04/19 tmee + Revision 1.76 - Fixed 242 - 2012/02/01 tmee + Revision 1.75 - Fixed 653 - 2012/01/31 tmee + Revision 1.74 - Fixed 510 note - 2011/07/15 tmee + Revision 1.73 - Fixed 506 540 - 2011/07/11 tmee + Revision 1.72 - Fixed frequency error - 2011/07/07 and 2011/07/14 tmee + Revision 1.71 - Fixed subject titles for subfields t - 2011/04/26 tmee + Revision 1.70 - Added mapping for OCLC numbers in 035s to go into <identifier type="oclc"> 2011/02/27 - tmee + Revision 1.69 - Added mapping for untyped identifiers for 024 - 2011/02/27 tmee + Revision 1.68 - Added <subject><titleInfo> mapping for 600/610/611 subfields t,p,n - 2010/12/22 tmee + Revision 1.67 - Added frequency values and authority="marcfrequency" for 008/18 - 2010/12/09 tmee + Revision 1.66 - Fixed 008/06=c,d,i,m,k,u, from dateCreated to dateIssued - 2010/12/06 tmee + Revision 1.65 - Added back marcsmd and marccategory for 007 cr- 2010/12/06 tmee + Revision 1.64 - Fixed identifiers - removed isInvalid template - 2010/12/06 tmee + Revision 1.63 - Fixed descriptiveStandard value from aacr2 to aacr - 2010/12/06 tmee + Revision 1.62 - Fixed date mapping for 008/06=e,p,r,s,t - 2010/12/01 tmee + Revision 1.61 - Added 007 mappings for marccategory - 2010/11/12 tmee + Revision 1.60 - Added altRepGroups and 880 linkages for relevant fields, see mapping - 2010/11/26 tmee + Revision 1.59 - Added scriptTerm type=text to language for 546b and 066c - 2010/09/23 tmee + Revision 1.58 - Expanded script template to include code conversions for extended scripts - 2010/09/22 tmee + Revision 1.57 - Added Ldr/07 and Ldr/19 mappings - 2010/09/17 tmee + Revision 1.56 - Mapped 1xx usage="primary" - 2010/09/17 tmee + Revision 1.55 - Mapped UT 240/1xx nameTitleGroup - 2010/09/17 tmee + MODS 3.4 + Revision 1.54 - Fixed 086 redundancy - 2010/07/27 tmee + Revision 1.53 - Added direct href for MARC21slimUtils - 2010/07/27 tmee + Revision 1.52 - Mapped 046 subfields c,e,k,l - 2010/04/09 tmee + Revision 1.51 - Corrected 856 transform - 2010/01/29 tmee + Revision 1.50 - Added 210 $2 authority attribute in <titleInfo type=”abbreviated”> 2009/11/23 tmee + Revision 1.49 - Aquifer revision 1.14 - Added 240s (version) data to <titleInfo type="uniform"><title> 2009/11/23 tmee + Revision 1.48 - Aquifer revision 1.27 - Added mapping of 242 second indicator (for nonfiling characters) to <titleInfo><nonSort > subelement 2007/08/08 tmee/dlf + Revision 1.47 - Aquifer revision 1.26 - Mapped 300 subfield f (type of unit) - and g (size of unit) 2009 ntra + Revision 1.46 - Aquifer revision 1.25 - Changed mapping of 767 so that <type="otherVersion> 2009/11/20 tmee + Revision 1.45 - Aquifer revision 1.24 - Changed mapping of 765 so that <type="otherVersion> 2009/11/20 tmee + Revision 1.44 - Added <recordInfo><recordOrigin> canned text about the version of this stylesheet 2009 ntra + Revision 1.43 - Mapped 351 subfields a,b,c 2009/11/20 tmee + Revision 1.42 - Changed 856 second indicator=1 to go to <location><url displayLabel=”electronic resource”> instead of to <relatedItem type=”otherVersion”><url> 2009/11/20 tmee + Revision 1.41 - Aquifer revision 1.9 Added variable and choice protocol for adding usage=”primary display” 2009/11/19 tmee + Revision 1.40 - Dropped <note> for 510 and added <relatedItem type="isReferencedBy"> for 510 2009/11/19 tmee + Revision 1.39 - Aquifer revision 1.23 Changed mapping for 762 (Subseries Entry) from <relatedItem type="series"> to <relatedItem type="constituent"> 2009/11/19 tmee + Revision 1.38 - Aquifer revision 1.29 Dropped 007s for electronic versions 2009/11/18 tmee + Revision 1.37 - Fixed date redundancy in output (with questionable dates) 2009/11/16 tmee + Revision 1.36 - If mss material (Ldr/06=d,p,f,t) map 008 dates and 260$c/$g dates to dateCreated 2009/11/24, otherwise map 008 and 260$c/$g to dateIssued 2010/01/08 tmee + Revision 1.35 - Mapped appended detailed dates from 008/07-10 and 008/11-14 to dateIssued or DateCreated w/encoding="marc" 2010/01/12 tmee + Revision 1.34 - Mapped 045b B.C. and C.E. date range info to iso8601-compliant dates in <subject><temporal> 2009/01/08 ntra + Revision 1.33 - Mapped Ldr/06 "o" to <typeOfResource>kit 2009/11/16 tmee + Revision 1.32 - Mapped specific note types from the MODS Note Type list <http://www.loc.gov/standards/mods/mods-notes.html> tmee 2009/11/17 + Revision 1.31 - Mapped 540 to <accessCondition type="use and reproduction"> and 506 to <accessCondition type="restriction on access"> and delete mappings of 540 and 506 to <note> + Revision 1.30 - Mapped 037c to <identifier displayLabel=""> 2009/11/13 tmee + Revision 1.29 - Corrected schemaLocation to 3.3 2009/11/13 tmee + Revision 1.28 - Changed mapping from 752,662 g going to mods:hierarchicalGeographic/area instead of "region" 2009/07/30 ntra + Revision 1.27 - Mapped 648 to <subject> 2009/03/13 tmee + Revision 1.26 - Added subfield $s mapping for 130/240/730 2008/10/16 tmee + Revision 1.25 - Mapped 040e to <descriptiveStandard> and Leader/18 to <descriptive standard>aacr2 2008/09/18 tmee + 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 + 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 + 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 + Revision 1.21 - Mapped 856 ind2=1 or ind2=2 to <relatedItem><location><url> 2008/07/03 tmee + Revision 1.20 - Added genre w/@auth="contents of 2" and type= "musical composition" 2008/07/01 tmee + Revision 1.19 - Added genre offprint for 008/24+ BK code 2 2008/07/01 tmee + Revision 1.18 - Added xlink/uri for subfield 0 for 130/240/730, 100/700, 110/710, 111/711 2008/06/26 tmee + Revision 1.17 - Added mapping of 662 2008/05/14 tmee + Revision 1.16 - Changed @authority from "marc" to "marcgt" for 007 and 008 codes mapped to a term in <genre> 2007/07/10 tmee + Revision 1.15 - For field 630, moved call to part template outside title element 2007/07/10 tmee + 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 + Revision 1.13 - Changed order of output under cartographics to reflect schema 2006/11/28 tmee + Revision 1.12 - Updated to reflect MODS 3.2 Mapping 2006/10/11 tmee + Revision 1.11 - The attribute objectPart moved from <languageTerm> to <language> 2006/04/08 jrad + 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 + Revision 1.09 - Subfield $y was added to field 242 2004/09/02 10:57 jrad + Revision 1.08 - Subject chopPunctuation expanded and attribute fixes 2004/08/12 jrad + Revision 1.07 - 2004/03/25 08:29 jrad + Revision 1.06 - Various validation fixes 2004/02/20 ntra + Revision 1.05 - MODS2 to MODS3 updates, language unstacking and de-duping, chopPunctuation expanded 2003/10/02 16:18:58 ntra + Revision 1.03 - Additional Changes not related to MODS Version 2.0 by ntra + Revision 1.02 - Added Log Comment 2003/03/24 19:37:42 ckeith + --> + + <xsl:template match="/"> + <xsl:choose> + <xsl:when test="//marc:collection"> + <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-6.xsd"> + <xsl:for-each select="//marc:collection/marc:record"> + <mods version="3.6"> + <xsl:call-template name="marcRecord"/> + </mods> + </xsl:for-each> + </modsCollection> + </xsl:when> + <xsl:otherwise> + <mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.6" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-6.xsd"> + <xsl:for-each select="//marc:record"> + <xsl:call-template name="marcRecord"/> + </xsl:for-each> + </mods> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="marcRecord"> + <xsl:variable name="leader" select="marc:leader"/> + <xsl:variable name="leader6" select="substring($leader,7,1)"/> + <xsl:variable name="leader7" select="substring($leader,8,1)"/> + <xsl:variable name="leader19" select="substring($leader,20,1)"/> + <xsl:variable name="controlField008" select="marc:controlfield[@tag='008']"/> + <xsl:variable name="typeOf008"> + <xsl:choose> + <xsl:when test="$leader6='a'"> + <xsl:choose> + <xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when> + <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">SE</xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test="$leader6='t'">BK</xsl:when> + <xsl:when test="$leader6='p'">MM</xsl:when> + <xsl:when test="$leader6='m'">CF</xsl:when> + <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when> + <xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">VM</xsl:when> + <xsl:when test="$leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'">MU</xsl:when> + </xsl:choose> + </xsl:variable> + + <!-- titleInfo --> + + <xsl:for-each select="marc:datafield[@tag='245']"> + <xsl:call-template name="createTitleInfoFrom245"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='210']"> + <xsl:call-template name="createTitleInfoFrom210"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='246']"> + <xsl:call-template name="createTitleInfoFrom246"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='240']"> + <xsl:call-template name="createTitleInfoFrom240"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='740']"> + <xsl:call-template name="createTitleInfoFrom740"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='130']"> + <xsl:call-template name="createTitleInfoFrom130"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='730']"> + <xsl:call-template name="createTitleInfoFrom730"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='242']"> + <titleInfo type="translated"> + <!--09/01/04 Added subfield $y--> + <xsl:for-each select="marc:subfield[@code='y']"> + <xsl:attribute name="lang"> + <xsl:value-of select="text()"/> + </xsl:attribute> + </xsl:for-each> + + <!-- AQ1.27 tmee/dlf --> + <xsl:variable name="title"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <!-- 1/04 removed $h, b --> + <xsl:with-param name="codes">a</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="titleChop"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="$title"/> + </xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="@ind2>0"> + <!-- 1.112 --> + <nonSort xml:space="preserve"><xsl:value-of select="substring($titleChop,1,@ind2)"/> </nonSort> + <title> + <xsl:value-of select="substring($titleChop,@ind2+1)"/> + </title> + </xsl:when> + <xsl:otherwise> + <title> + <xsl:value-of select="$titleChop"/> + </title> + </xsl:otherwise> + </xsl:choose> + + <!-- 1/04 fix --> + <xsl:call-template name="subtitle"/> + <xsl:call-template name="part"/> + </titleInfo> + </xsl:for-each> + + <!-- name --> + <!-- 1.108 --> + <xsl:for-each select="marc:datafield[@tag='100'][not(marc:subfield[@code='t'])]"> + <xsl:call-template name="createNameFrom100"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='110'][not(marc:subfield[@code='t'])]"> + <xsl:call-template name="createNameFrom110"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='111'][not(marc:subfield[@code='t'])]"> + <xsl:call-template name="createNameFrom111"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='700'][not(marc:subfield[@code='t'])]"> + <xsl:call-template name="createNameFrom700"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='710'][not(marc:subfield[@code='t'])]"> + <xsl:call-template name="createNameFrom710"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='711'][not(marc:subfield[@code='t'])]"> + <xsl:call-template name="createNameFrom711"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='720'][not(marc:subfield[@code='t'])]"> + <xsl:call-template name="createNameFrom720"/> + </xsl:for-each> + + <!--old 7XXs + <xsl:for-each select="marc:datafield[@tag='700'][not(marc:subfield[@code='t'])]"> + <name type="personal"> + <xsl:call-template name="nameABCDQ"/> + <xsl:call-template name="affiliation"/> + <xsl:call-template name="role"/> + </name> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='710'][not(marc:subfield[@code='t'])]"> + <name type="corporate"> + <xsl:call-template name="nameABCDN"/> + <xsl:call-template name="role"/> + </name> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='711'][not(marc:subfield[@code='t'])]"> + <name type="conference"> + <xsl:call-template name="nameACDEQ"/> + <xsl:call-template name="role"/> + </name> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='720'][not(marc:subfield[@code='t'])]"> + <name> + <xsl:if test="@ind1=1"> + <xsl:attribute name="type"> + <xsl:text>personal</xsl:text> + </xsl:attribute> + </xsl:if> + <namePart> + <xsl:value-of select="marc:subfield[@code='a']"/> + </namePart> + <xsl:call-template name="role"/> + </name> + </xsl:for-each> +--> + + <typeOfResource> + <xsl:if test="$leader7='c'"> + <xsl:attribute name="collection">yes</xsl:attribute> + </xsl:if> + <xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'"> + <xsl:attribute name="manuscript">yes</xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="$leader6='a' or $leader6='t'">text</xsl:when> + <xsl:when test="$leader6='e' or $leader6='f'">cartographic</xsl:when> + <xsl:when test="$leader6='c' or $leader6='d'">notated music</xsl:when> + <xsl:when test="$leader6='i'">sound recording-nonmusical</xsl:when> + <xsl:when test="$leader6='j'">sound recording-musical</xsl:when> + <xsl:when test="$leader6='k'">still image</xsl:when> + <xsl:when test="$leader6='g'">moving image</xsl:when> + <xsl:when test="$leader6='r'">three dimensional object</xsl:when> + <xsl:when test="$leader6='m'">software, multimedia</xsl:when> + <xsl:when test="$leader6='p'">mixed material</xsl:when> + </xsl:choose> + </typeOfResource> + <xsl:if test="substring($controlField008,26,1)='d'"> + <genre authority="marcgt">globe</genre> + </xsl:if> + <xsl:if test="marc:controlfield[@tag='007'][substring(text(),1,1)='a'][substring(text(),2,1)='r']"> + <genre authority="marcgt">remote-sensing image</genre> + </xsl:if> + <xsl:if test="$typeOf008='MP'"> + <xsl:variable name="controlField008-25" select="substring($controlField008,26,1)"/> + <xsl:choose> + <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']"> + <genre authority="marcgt">map</genre> + </xsl:when> + <xsl:when test="$controlField008-25='e' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']"> + <genre authority="marcgt">atlas</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$typeOf008='SE'"> + <xsl:variable name="controlField008-21" select="substring($controlField008,22,1)"/> + <xsl:choose> + <xsl:when test="$controlField008-21='d'"> + <genre authority="marcgt">database</genre> + </xsl:when> + <xsl:when test="$controlField008-21='l'"> + <genre authority="marcgt">loose-leaf</genre> + </xsl:when> + <xsl:when test="$controlField008-21='m'"> + <genre authority="marcgt">series</genre> + </xsl:when> + <xsl:when test="$controlField008-21='n'"> + <genre authority="marcgt">newspaper</genre> + </xsl:when> + <xsl:when test="$controlField008-21='p'"> + <genre authority="marcgt">periodical</genre> + </xsl:when> + <xsl:when test="$controlField008-21='w'"> + <genre authority="marcgt">web site</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$typeOf008='BK' or $typeOf008='SE'"> + <xsl:variable name="controlField008-24" select="substring($controlField008,25,4)"/> + <xsl:choose> + <xsl:when test="contains($controlField008-24,'a')"> + <genre authority="marcgt">abstract or summary</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'b')"> + <genre authority="marcgt">bibliography</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'c')"> + <genre authority="marcgt">catalog</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'d')"> + <genre authority="marcgt">dictionary</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'e')"> + <genre authority="marcgt">encyclopedia</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'f')"> + <genre authority="marcgt">handbook</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'g')"> + <genre authority="marcgt">legal article</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'i')"> + <genre authority="marcgt">index</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'k')"> + <genre authority="marcgt">discography</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'l')"> + <genre authority="marcgt">legislation</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'m')"> + <genre authority="marcgt">theses</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'n')"> + <genre authority="marcgt">survey of literature</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'o')"> + <genre authority="marcgt">review</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'p')"> + <genre authority="marcgt">programmed text</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'q')"> + <genre authority="marcgt">filmography</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'r')"> + <genre authority="marcgt">directory</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'s')"> + <genre authority="marcgt">statistics</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'t')"> + <genre authority="marcgt">technical report</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'v')"> + <genre authority="marcgt">legal case and case notes</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'w')"> + <genre authority="marcgt">law report or digest</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'z')"> + <genre authority="marcgt">treaty</genre> + </xsl:when> + </xsl:choose> + <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/> + <xsl:choose> + <xsl:when test="$controlField008-29='1'"> + <genre authority="marcgt">conference publication</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$typeOf008='CF'"> + <xsl:variable name="controlField008-26" select="substring($controlField008,27,1)"/> + <xsl:choose> + <xsl:when test="$controlField008-26='a'"> + <genre authority="marcgt">numeric data</genre> + </xsl:when> + <xsl:when test="$controlField008-26='e'"> + <genre authority="marcgt">database</genre> + </xsl:when> + <xsl:when test="$controlField008-26='f'"> + <genre authority="marcgt">font</genre> + </xsl:when> + <xsl:when test="$controlField008-26='g'"> + <genre authority="marcgt">game</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$typeOf008='BK'"> + <xsl:if test="substring($controlField008,25,1)='j'"> + <genre authority="marcgt">patent</genre> + </xsl:if> + <xsl:if test="substring($controlField008,25,1)='2'"> + <genre authority="marcgt">offprint</genre> + </xsl:if> + <xsl:if test="substring($controlField008,31,1)='1'"> + <genre authority="marcgt">festschrift</genre> + </xsl:if> + <xsl:variable name="controlField008-34" select="substring($controlField008,35,1)"/> + <xsl:if test="$controlField008-34='a' or $controlField008-34='b' or $controlField008-34='c' or $controlField008-34='d'"> + <genre authority="marcgt">biography</genre> + </xsl:if> + <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/> + <xsl:choose> + <xsl:when test="$controlField008-33='e'"> + <genre authority="marcgt">essay</genre> + </xsl:when> + <xsl:when test="$controlField008-33='d'"> + <genre authority="marcgt">drama</genre> + </xsl:when> + <xsl:when test="$controlField008-33='c'"> + <genre authority="marcgt">comic strip</genre> + </xsl:when> + <xsl:when test="$controlField008-33='l'"> + <genre authority="marcgt">fiction</genre> + </xsl:when> + <xsl:when test="$controlField008-33='h'"> + <genre authority="marcgt">humor, satire</genre> + </xsl:when> + <xsl:when test="$controlField008-33='i'"> + <genre authority="marcgt">letter</genre> + </xsl:when> + <xsl:when test="$controlField008-33='f'"> + <genre authority="marcgt">novel</genre> + </xsl:when> + <xsl:when test="$controlField008-33='j'"> + <genre authority="marcgt">short story</genre> + </xsl:when> + <xsl:when test="$controlField008-33='s'"> + <genre authority="marcgt">speech</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$typeOf008='MU'"> + <xsl:variable name="controlField008-30-31" select="substring($controlField008,31,2)"/> + <xsl:if test="contains($controlField008-30-31,'b')"> + <genre authority="marcgt">biography</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'c')"> + <genre authority="marcgt">conference publication</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'d')"> + <genre authority="marcgt">drama</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'e')"> + <genre authority="marcgt">essay</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'f')"> + <genre authority="marcgt">fiction</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'o')"> + <genre authority="marcgt">folktale</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'h')"> + <genre authority="marcgt">history</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'k')"> + <genre authority="marcgt">humor, satire</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'m')"> + <genre authority="marcgt">memoir</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'p')"> + <genre authority="marcgt">poetry</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'r')"> + <genre authority="marcgt">rehearsal</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'g')"> + <genre authority="marcgt">reporting</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'s')"> + <genre authority="marcgt">sound</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'l')"> + <genre authority="marcgt">speech</genre> + </xsl:if> + </xsl:if> + <xsl:if test="$typeOf008='VM'"> + <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/> + <xsl:choose> + <xsl:when test="$controlField008-33='a'"> + <genre authority="marcgt">art original</genre> + </xsl:when> + <xsl:when test="$controlField008-33='b'"> + <genre authority="marcgt">kit</genre> + </xsl:when> + <xsl:when test="$controlField008-33='c'"> + <genre authority="marcgt">art reproduction</genre> + </xsl:when> + <xsl:when test="$controlField008-33='d'"> + <genre authority="marcgt">diorama</genre> + </xsl:when> + <xsl:when test="$controlField008-33='f'"> + <genre authority="marcgt">filmstrip</genre> + </xsl:when> + <xsl:when test="$controlField008-33='g'"> + <genre authority="marcgt">legal article</genre> + </xsl:when> + <xsl:when test="$controlField008-33='i'"> + <genre authority="marcgt">picture</genre> + </xsl:when> + <xsl:when test="$controlField008-33='k'"> + <genre authority="marcgt">graphic</genre> + </xsl:when> + <xsl:when test="$controlField008-33='l'"> + <genre authority="marcgt">technical drawing</genre> + </xsl:when> + <xsl:when test="$controlField008-33='m'"> + <genre authority="marcgt">motion picture</genre> + </xsl:when> + <xsl:when test="$controlField008-33='n'"> + <genre authority="marcgt">chart</genre> + </xsl:when> + <xsl:when test="$controlField008-33='o'"> + <genre authority="marcgt">flash card</genre> + </xsl:when> + <xsl:when test="$controlField008-33='p'"> + <genre authority="marcgt">microscope slide</genre> + </xsl:when> + <xsl:when test="$controlField008-33='q' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']"> + <genre authority="marcgt">model</genre> + </xsl:when> + <xsl:when test="$controlField008-33='r'"> + <genre authority="marcgt">realia</genre> + </xsl:when> + <xsl:when test="$controlField008-33='s'"> + <genre authority="marcgt">slide</genre> + </xsl:when> + <xsl:when test="$controlField008-33='t'"> + <genre authority="marcgt">transparency</genre> + </xsl:when> + <xsl:when test="$controlField008-33='v'"> + <genre authority="marcgt">videorecording</genre> + </xsl:when> + <xsl:when test="$controlField008-33='w'"> + <genre authority="marcgt">toy</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + +<!-- 111$n, 711$n 1.103 --> + + <xsl:if test="$typeOf008='BK'"> + <xsl:variable name="controlField008-28" select="substring($controlField008,29,1)"/> + <xsl:choose> + <xsl:when test="contains($controlField008-28,'a')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'c')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'f')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'i')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'l')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'o')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'s')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'u')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'z')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'|')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$typeOf008='CF'"> + <xsl:variable name="controlField008-28" select="substring($controlField008,29,1)"/> + <xsl:choose> + <xsl:when test="contains($controlField008-28,'a')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'c')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'f')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'i')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'l')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'o')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'s')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'u')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'z')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'|')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$typeOf008='CR'"> + <xsl:variable name="controlField008-28" select="substring($controlField008,29,1)"/> + <xsl:choose> + <xsl:when test="contains($controlField008-28,'a')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'c')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'f')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'i')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'l')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'o')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'s')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'u')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'z')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'|')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$typeOf008='MP'"> + <xsl:variable name="controlField008-28" select="substring($controlField008,29,1)"/> + <xsl:choose> + <xsl:when test="contains($controlField008-28,'a')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'c')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'f')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'i')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'l')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'o')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'s')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'u')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'z')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'|')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$typeOf008='VM'"> + <xsl:variable name="controlField008-28" select="substring($controlField008,29,1)"/> + <xsl:choose> + <xsl:when test="contains($controlField008-28,'a')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'c')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'f')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'i')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'l')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'o')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'s')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'u')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'z')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'|')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + + + <!-- genre --> + + <xsl:for-each select="marc:datafield[@tag=047]"> + <xsl:call-template name="createGenreFrom047"/> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=336]"> + <xsl:call-template name="createGenreFrom336"/> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=655]"> + <xsl:call-template name="createGenreFrom655"/> + </xsl:for-each> + + <!-- originInfo 250 and 260 --> + + <originInfo> + <xsl:call-template name="scriptCode"/> + <xsl:for-each select="marc:datafield[(@tag=260 or @tag=250) and marc:subfield[@code='a' or code='b' or @code='c' or code='g']]"> + <xsl:call-template name="z2xx880"/> + </xsl:for-each> + + <xsl:variable name="MARCpublicationCode" select="normalize-space(substring($controlField008,16,3))"/> + <xsl:if test="translate($MARCpublicationCode,'|','')"> + <place> + <placeTerm> + <xsl:attribute name="type">code</xsl:attribute> + <xsl:attribute name="authority">marccountry</xsl:attribute> + <xsl:value-of select="$MARCpublicationCode"/> + </placeTerm> + </place> + </xsl:if> + <xsl:for-each select="marc:datafield[@tag=044]/marc:subfield[@code='c']"> + <place> + <placeTerm> + <xsl:attribute name="type">code</xsl:attribute> + <xsl:attribute name="authority">iso3166</xsl:attribute> + <xsl:value-of select="."/> + </placeTerm> + </place> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='a']"> + <place> + <placeTerm> + <xsl:attribute name="type">text</xsl:attribute> + <xsl:call-template name="chopPunctuationFront"> + <xsl:with-param name="chopString"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </placeTerm> + </place> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='m']"> + <dateValid point="start"> + <xsl:value-of select="."/> + </dateValid> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='n']"> + <dateValid point="end"> + <xsl:value-of select="."/> + </dateValid> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='j']"> + <dateModified> + <xsl:value-of select="."/> + </dateModified> + </xsl:for-each> + + <!-- tmee 1.52 --> + + <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='c']"> + <dateIssued encoding="marc" point="start"> + <xsl:value-of select="."/> + </dateIssued> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='e']"> + <dateIssued encoding="marc" point="end"> + <xsl:value-of select="."/> + </dateIssued> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='k']"> + <dateCreated encoding="marc" point="start"> + <xsl:value-of select="."/> + </dateCreated> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='l']"> + <dateCreated encoding="marc" point="end"> + <xsl:value-of select="."/> + </dateCreated> + </xsl:for-each> + + <!-- tmee 1.35 1.36 dateIssued/nonMSS vs dateCreated/MSS --> + <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='b' or @code='c' or @code='g']"> + <xsl:choose> + <xsl:when test="@code='b'"> + <publisher> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + <xsl:with-param name="punctuation"> + <xsl:text>:,;/ </xsl:text> + </xsl:with-param> + </xsl:call-template> + </publisher> + </xsl:when> + <xsl:when test="(@code='c')"> + <xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'"> + <dateCreated> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </dateCreated> + </xsl:if> + + <xsl:if test="not($leader6='d' or $leader6='f' or $leader6='p' or $leader6='t')"> + <dateIssued> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </dateIssued> + </xsl:if> + </xsl:when> + <xsl:when test="@code='g'"> + <xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'"> + <dateCreated> + <xsl:value-of select="."/> + </dateCreated> + </xsl:if> + <xsl:if test="not($leader6='d' or $leader6='f' or $leader6='p' or $leader6='t')"> + <dateCreated> + <xsl:value-of select="."/> + </dateCreated> + </xsl:if> + </xsl:when> + </xsl:choose> + </xsl:for-each> + <xsl:variable name="dataField260c"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="marc:datafield[@tag=260]/marc:subfield[@code='c']"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="controlField008-7-10" select="normalize-space(substring($controlField008, 8, 4))"/> + <xsl:variable name="controlField008-11-14" select="normalize-space(substring($controlField008, 12, 4))"/> + <xsl:variable name="controlField008-6" select="normalize-space(substring($controlField008, 7, 1))"/> + + + + <!-- tmee 1.35 and 1.36 and 1.84--> + + <xsl:if test="($controlField008-6='e' or $controlField008-6='p' or $controlField008-6='r' or $controlField008-6='s' or $controlField008-6='t') and ($leader6='d' or $leader6='f' or $leader6='p' or $leader6='t')"> + <xsl:if test="$controlField008-7-10 and ($controlField008-7-10 != $dataField260c)"> + <dateCreated encoding="marc"> + <xsl:value-of select="$controlField008-7-10"/> + </dateCreated> + </xsl:if> + </xsl:if> + + <xsl:if test="($controlField008-6='e' or $controlField008-6='p' or $controlField008-6='r' or $controlField008-6='s' or $controlField008-6='t') and not($leader6='d' or $leader6='f' or $leader6='p' or $leader6='t')"> + <xsl:if test="$controlField008-7-10 and ($controlField008-7-10 != $dataField260c)"> + <dateIssued encoding="marc"> + <xsl:value-of select="$controlField008-7-10"/></dateIssued> + </xsl:if> + </xsl:if> + + <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='u'"> + <xsl:if test="$controlField008-7-10"> + <dateIssued encoding="marc" point="start"> + <xsl:value-of select="$controlField008-7-10"/> + </dateIssued> + </xsl:if> + </xsl:if> + + <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='u'"> + <xsl:if test="$controlField008-11-14"> + <dateIssued encoding="marc" point="end"> + <xsl:value-of select="$controlField008-11-14"/> + </dateIssued> + </xsl:if> + </xsl:if> + + <xsl:if test="$controlField008-6='q'"> + <xsl:if test="$controlField008-7-10"> + <dateIssued encoding="marc" point="start" qualifier="questionable"> + <xsl:value-of select="$controlField008-7-10"/> + </dateIssued> + </xsl:if> + </xsl:if> + <xsl:if test="$controlField008-6='q'"> + <xsl:if test="$controlField008-11-14"> + <dateIssued encoding="marc" point="end" qualifier="questionable"> + <xsl:value-of select="$controlField008-11-14"/> + </dateIssued> + </xsl:if> + </xsl:if> + + + <!-- tmee 1.77 008-06 dateIssued for value 's' 1.89 removed 20130920 + <xsl:if test="$controlField008-6='s'"> + <xsl:if test="$controlField008-7-10"> + <dateIssued encoding="marc"> + <xsl:value-of select="$controlField008-7-10"/> + </dateIssued> + </xsl:if> + </xsl:if> + --> + + <xsl:if test="$controlField008-6='t'"> + <xsl:if test="$controlField008-11-14"> + <copyrightDate encoding="marc"> + <xsl:value-of select="$controlField008-11-14"/> + </copyrightDate> + </xsl:if> + </xsl:if> + <xsl:for-each select="marc:datafield[@tag=033][@ind1=0 or @ind1=1]/marc:subfield[@code='a']"> + <dateCaptured encoding="iso8601"> + <xsl:value-of select="."/> + </dateCaptured> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][1]"> + <dateCaptured encoding="iso8601" point="start"> + <xsl:value-of select="."/> + </dateCaptured> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][2]"> + <dateCaptured encoding="iso8601" point="end"> + <xsl:value-of select="."/> + </dateCaptured> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=250]/marc:subfield[@code='a']"> + <edition> + <xsl:value-of select="."/> + </edition> + </xsl:for-each> + <xsl:for-each select="marc:leader"> + <issuance> + <xsl:choose> + <xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">monographic</xsl:when> + <xsl:when test="$leader7='m' and ($leader19='a' or $leader19='b' or $leader19='c')">multipart monograph</xsl:when> + <!-- 1.106 20141218 --> + <xsl:when test="$leader7='m' and ($leader19=' ')">single unit</xsl:when> + <xsl:when test="$leader7='m' and ($leader19='#')">single unit</xsl:when> + <xsl:when test="$leader7='i'">integrating resource</xsl:when> + <xsl:when test="$leader7='b' or $leader7='s'">serial</xsl:when> + </xsl:choose> + </issuance> + </xsl:for-each> + + <!-- 1.96 20140422 --> + <xsl:for-each select="marc:datafield[@tag=310]|marc:datafield[@tag=321]"> + <frequency> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ab</xsl:with-param> + </xsl:call-template> + </frequency> + </xsl:for-each> + + <!-- 1.67 1.72 updated fixed location issue 201308 1.86 --> + + <xsl:if test="$typeOf008='SE'"> + <xsl:for-each select="marc:controlfield[@tag=008]"> + <xsl:variable name="controlField008-18" select="substring($controlField008,19,1)"/> + <xsl:variable name="frequency"> + <frequency> + <xsl:choose> + <xsl:when test="$controlField008-18='a'">Annual</xsl:when> + <xsl:when test="$controlField008-18='b'">Bimonthly</xsl:when> + <xsl:when test="$controlField008-18='c'">Semiweekly</xsl:when> + <xsl:when test="$controlField008-18='d'">Daily</xsl:when> + <xsl:when test="$controlField008-18='e'">Biweekly</xsl:when> + <xsl:when test="$controlField008-18='f'">Semiannual</xsl:when> + <xsl:when test="$controlField008-18='g'">Biennial</xsl:when> + <xsl:when test="$controlField008-18='h'">Triennial</xsl:when> + <xsl:when test="$controlField008-18='i'">Three times a week</xsl:when> + <xsl:when test="$controlField008-18='j'">Three times a month</xsl:when> + <xsl:when test="$controlField008-18='k'">Continuously updated</xsl:when> + <xsl:when test="$controlField008-18='m'">Monthly</xsl:when> + <xsl:when test="$controlField008-18='q'">Quarterly</xsl:when> + <xsl:when test="$controlField008-18='s'">Semimonthly</xsl:when> + <xsl:when test="$controlField008-18='t'">Three times a year</xsl:when> + <xsl:when test="$controlField008-18='u'">Unknown</xsl:when> + <xsl:when test="$controlField008-18='w'">Weekly</xsl:when> + <!-- 1.106 20141218 --> + <xsl:when test="$controlField008-18=' '">Completely irregular</xsl:when> + <xsl:when test="$controlField008-18='#'">Completely irregular</xsl:when> + <xsl:otherwise/> + </xsl:choose> + </frequency> + </xsl:variable> + <xsl:if test="$frequency!=''"> + <frequency authority="marcfrequency"> + <xsl:value-of select="$frequency"/> + </frequency> + </xsl:if> + </xsl:for-each> + </xsl:if> + </originInfo> + + + <!-- originInfo - 264 --> + + <xsl:for-each select="marc:datafield[@tag=264][@ind2=0]"> + <originInfo eventType="production"> + <!-- Template checks for altRepGroup - 880 $6 --> + <xsl:call-template name="xxx880"/> + <place> + <placeTerm type="text"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </placeTerm> + </place> + <publisher> + <xsl:value-of select="marc:subfield[@code='b']"/> + </publisher> + <dateOther type="production"> + <xsl:value-of select="marc:subfield[@code='c']"/> + </dateOther> + </originInfo> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=264][@ind2=1]"> + <originInfo eventType="publication"> + <!-- Template checks for altRepGroup - 880 $6 1.88 20130829 added chopPunc--> + <xsl:call-template name="xxx880"/> + <place> + <placeTerm type="text"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </placeTerm> + </place> + <publisher> + <xsl:value-of select="marc:subfield[@code='b']"/> + </publisher> + <dateIssued> + <xsl:value-of select="marc:subfield[@code='c']"/> + </dateIssued> + </originInfo> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=264][@ind2=2]"> + <originInfo eventType="distribution"> + <!-- Template checks for altRepGroup - 880 $6 --> + <xsl:call-template name="xxx880"/> + <place> + <placeTerm type="text"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </placeTerm> + </place> + <publisher> + <xsl:value-of select="marc:subfield[@code='b']"/> + </publisher> + <dateOther type="distribution"> + <xsl:value-of select="marc:subfield[@code='c']"/> + </dateOther> + </originInfo> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=264][@ind2=3]"> + <originInfo eventType="manufacture"> + <!-- Template checks for altRepGroup - 880 $6 --> + <xsl:call-template name="xxx880"/> + <place> + <placeTerm type="text"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </placeTerm> + </place> + <publisher> + <xsl:value-of select="marc:subfield[@code='b']"/> + </publisher> + <dateOther type="manufacture"> + <xsl:value-of select="marc:subfield[@code='c']"/> + </dateOther> + </originInfo> + </xsl:for-each> + + + <xsl:for-each select="marc:datafield[@tag=880]"> + <xsl:variable name="related_datafield" select="substring-before(marc:subfield[@code='6'],'-')"/> + <xsl:variable name="occurence_number" select="substring( substring-after(marc:subfield[@code='6'],'-') , 1 , 2 )"/> + <xsl:variable name="hit" select="../marc:datafield[@tag=$related_datafield and contains(marc:subfield[@code='6'] , concat('880-' , $occurence_number))]/@tag"/> + + <xsl:choose> + <xsl:when test="$hit='260'"> + <originInfo> + <xsl:call-template name="scriptCode"/> + <xsl:for-each select="../marc:datafield[@tag=260 and marc:subfield[@code='a' or code='b' or @code='c' or code='g']]"> + <xsl:call-template name="z2xx880"/> + </xsl:for-each> + <xsl:if test="marc:subfield[@code='a']"> + <place> + <placeTerm type="text"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </placeTerm> + </place> + </xsl:if> + <xsl:if test="marc:subfield[@code='b']"> + <publisher> + <xsl:value-of select="marc:subfield[@code='b']"/> + </publisher> + </xsl:if> + <xsl:if test="marc:subfield[@code='c']"> + <dateIssued> + <xsl:value-of select="marc:subfield[@code='c']"/> + </dateIssued> + </xsl:if> + <xsl:if test="marc:subfield[@code='g']"> + <dateCreated> + <xsl:value-of select="marc:subfield[@code='g']"/> + </dateCreated> + </xsl:if> + <xsl:for-each select="../marc:datafield[@tag=880]/marc:subfield[@code=6][contains(text(),'250')]"> + <edition> + <xsl:value-of select="following-sibling::marc:subfield"/> + </edition> + </xsl:for-each> + </originInfo> + </xsl:when> + <xsl:when test="$hit='300'"> + <physicalDescription> + <xsl:for-each select="../marc:datafield[@tag=300]"> + <xsl:call-template name="z3xx880"/> + </xsl:for-each> + <extent> + <xsl:for-each select="marc:subfield"> + <xsl:if test="@code='a' or @code='3' or @code='b' or @code='c'"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + </extent> + <!-- form 337 338 --> + <form> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:attribute> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">a</xsl:with-param> + </xsl:call-template> + </form> + </physicalDescription> + </xsl:when> + </xsl:choose> + </xsl:for-each> + + <!-- language 041 --> + <xsl:variable name="controlField008-35-37" select="normalize-space(translate(substring($controlField008,36,3),'|#',''))"/> + <xsl:if test="$controlField008-35-37"> + <language> + <languageTerm authority="iso639-2b" type="code"> + <xsl:value-of select="substring($controlField008,36,3)"/> + </languageTerm> + </language> + </xsl:if> + <xsl:for-each select="marc:datafield[@tag=041]"> + <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']"> + <xsl:variable name="langCodes" select="."/> + <xsl:choose> + <xsl:when test="../marc:subfield[@code='2']='rfc3066'"> + <!-- not stacked but could be repeated --> + <xsl:call-template name="rfcLanguages"> + <xsl:with-param name="nodeNum"> + <xsl:value-of select="1"/> + </xsl:with-param> + <xsl:with-param name="usedLanguages"> + <xsl:text/> + </xsl:with-param> + <xsl:with-param name="controlField008-35-37"> + <xsl:value-of select="$controlField008-35-37"/> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- iso --> + <xsl:variable name="allLanguages"> + <xsl:copy-of select="$langCodes"/> + </xsl:variable> + <xsl:variable name="currentLanguage"> + <xsl:value-of select="substring($allLanguages,1,3)"/> + </xsl:variable> + <xsl:call-template name="isoLanguage"> + <xsl:with-param name="currentLanguage"> + <xsl:value-of select="substring($allLanguages,1,3)"/> + </xsl:with-param> + <xsl:with-param name="remainingLanguages"> + <xsl:value-of select="substring($allLanguages,4,string-length($allLanguages)-3)"/> + </xsl:with-param> + <xsl:with-param name="usedLanguages"> + <xsl:if test="$controlField008-35-37"> + <xsl:value-of select="$controlField008-35-37"/> + </xsl:if> + </xsl:with-param> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:for-each> + + <!-- physicalDescription --> + + <xsl:variable name="physicalDescription"> + <!--3.2 change tmee 007/11 --> + <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='a']"> + <digitalOrigin>reformatted digital</digitalOrigin> + </xsl:if> + <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='b']"> + <digitalOrigin>digitized microfilm</digitalOrigin> + </xsl:if> + <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='d']"> + <digitalOrigin>digitized other analog</digitalOrigin> + </xsl:if> + <xsl:variable name="controlField008-23" select="substring($controlField008,24,1)"/> + <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/> + <xsl:variable name="check008-23"> + <xsl:if test="$typeOf008='BK' or $typeOf008='MU' or $typeOf008='SE' or $typeOf008='MM'"> + <xsl:value-of select="true()"/> + </xsl:if> + </xsl:variable> + <xsl:variable name="check008-29"> + <xsl:if test="$typeOf008='MP' or $typeOf008='VM'"> + <xsl:value-of select="true()"/> + </xsl:if> + </xsl:variable> + <xsl:choose> + <xsl:when test="($check008-23 and $controlField008-23='f') or ($check008-29 and $controlField008-29='f')"> + <form authority="marcform">braille</form> + </xsl:when> + <xsl:when test="($controlField008-23=' ' and ($leader6='c' or $leader6='d')) or (($typeOf008='BK' or $typeOf008='SE') and ($controlField008-23=' ' or $controlField008='r'))"> + <form authority="marcform">print</form> + </xsl:when> + <xsl:when test="$leader6 = 'm' or ($check008-23 and $controlField008-23='s') or ($check008-29 and $controlField008-29='s')"> + <form authority="marcform">electronic</form> + </xsl:when> + <!-- 1.33 --> + <xsl:when test="$leader6 = 'o'"> + <form authority="marcform">kit</form> + </xsl:when> + <xsl:when test="($check008-23 and $controlField008-23='b') or ($check008-29 and $controlField008-29='b')"> + <form authority="marcform">microfiche</form> + </xsl:when> + <xsl:when test="($check008-23 and $controlField008-23='a') or ($check008-29 and $controlField008-29='a')"> + <form authority="marcform">microfilm</form> + </xsl:when> + </xsl:choose> + + <!-- 1/04 fix --> + <xsl:if test="marc:datafield[@tag=130]/marc:subfield[@code='h']"> + <form authority="gmd"> + <xsl:call-template name="chopBrackets"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:datafield[@tag=130]/marc:subfield[@code='h']"/> + </xsl:with-param> + </xsl:call-template> + </form> + </xsl:if> + <xsl:if test="marc:datafield[@tag=240]/marc:subfield[@code='h']"> + <form authority="gmd"> + <xsl:call-template name="chopBrackets"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:datafield[@tag=240]/marc:subfield[@code='h']"/> + </xsl:with-param> + </xsl:call-template> + </form> + </xsl:if> + <xsl:if test="marc:datafield[@tag=242]/marc:subfield[@code='h']"> + <form authority="gmd"> + <xsl:call-template name="chopBrackets"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:datafield[@tag=242]/marc:subfield[@code='h']"/> + </xsl:with-param> + </xsl:call-template> + </form> + </xsl:if> + <xsl:if test="marc:datafield[@tag=245]/marc:subfield[@code='h']"> + <form authority="gmd"> + <xsl:call-template name="chopBrackets"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:datafield[@tag=245]/marc:subfield[@code='h']"/> + </xsl:with-param> + </xsl:call-template> + </form> + </xsl:if> + <xsl:if test="marc:datafield[@tag=246]/marc:subfield[@code='h']"> + <form authority="gmd"> + <xsl:call-template name="chopBrackets"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:datafield[@tag=246]/marc:subfield[@code='h']"/> + </xsl:with-param> + </xsl:call-template> + </form> + </xsl:if> + <xsl:if test="marc:datafield[@tag=730]/marc:subfield[@code='h']"> + <form authority="gmd"> + <xsl:call-template name="chopBrackets"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:datafield[@tag=730]/marc:subfield[@code='h']"/> + </xsl:with-param> + </xsl:call-template> + </form> + </xsl:if> + <xsl:for-each select="marc:datafield[@tag=256]/marc:subfield[@code='a']"> + <form> + <xsl:value-of select="."/> + </form> + </xsl:for-each> + <xsl:for-each select="marc:controlfield[@tag=007][substring(text(),1,1)='c']"> + <xsl:choose> + <xsl:when test="substring(text(),14,1)='a'"> + <reformattingQuality>access</reformattingQuality> + </xsl:when> + <xsl:when test="substring(text(),14,1)='p'"> + <reformattingQuality>preservation</reformattingQuality> + </xsl:when> + <xsl:when test="substring(text(),14,1)='r'"> + <reformattingQuality>replacement</reformattingQuality> + </xsl:when> + </xsl:choose> + </xsl:for-each> + <!--3.2 change tmee 007/01 --> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='b']"> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">chip cartridge</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='c']"> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">computer optical disc cartridge</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='j']"> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">magnetic disc</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='m']"> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">magneto-optical disc</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='o']"> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">optical disc</form> + </xsl:if> + + <!-- 1.38 AQ 1.29 tmee 1.66 added marccategory and marcsmd as part of 3.4 --> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='r']"> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">remote</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='a']"> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">tape cartridge</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='f']"> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">tape cassette</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='h']"> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">tape reel</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='a']"> + <form authority="marccategory">globe</form> + <form authority="marcsmd">celestial globe</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='e']"> + <form authority="marccategory">globe</form> + <form authority="marcsmd">earth moon globe</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='b']"> + <form authority="marccategory">globe</form> + <form authority="marcsmd">planetary or lunar globe</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='c']"> + <form authority="marccategory">globe</form> + <form authority="marcsmd">terrestrial globe</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='o'][substring(text(),2,1)='o']"> + <form authority="marccategory">kit</form> + <form authority="marcsmd">kit</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']"> + <form authority="marccategory">map</form> + <form authority="marcsmd">atlas</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='g']"> + <form authority="marccategory">map</form> + <form authority="marcsmd">diagram</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='j']"> + <form authority="marccategory">map</form> + <form authority="marcsmd">map</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']"> + <form authority="marccategory">map</form> + <form authority="marcsmd">model</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='k']"> + <form authority="marccategory">map</form> + <form authority="marcsmd">profile</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='r']"> + <form authority="marcsmd">remote-sensing image</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='s']"> + <form authority="marccategory">map</form> + <form authority="marcsmd">section</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='y']"> + <form authority="marccategory">map</form> + <form authority="marcsmd">view</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='a']"> + <form authority="marccategory">microform</form> + <form authority="marcsmd">aperture card</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='e']"> + <form authority="marccategory">microform</form> + <form authority="marcsmd">microfiche</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='f']"> + <form authority="marccategory">microform</form> + <form authority="marcsmd">microfiche cassette</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='b']"> + <form authority="marccategory">microform</form> + <form authority="marcsmd">microfilm cartridge</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='c']"> + <form authority="marccategory">microform</form> + <form authority="marcsmd">microfilm cassette</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='d']"> + <form authority="marccategory">microform</form> + <form authority="marcsmd">microfilm reel</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='g']"> + <form authority="marccategory">microform</form> + <form authority="marcsmd">microopaque</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='c']"> + <form authority="marccategory">motion picture</form> + <form authority="marcsmd">film cartridge</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='f']"> + <form authority="marccategory">motion picture</form> + <form authority="marcsmd">film cassette</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='r']"> + <form authority="marccategory">motion picture</form> + <form authority="marcsmd">film reel</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='n']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">chart</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='c']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">collage</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='d']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">drawing</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='o']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">flash card</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='e']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">painting</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='f']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">photomechanical print</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='g']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">photonegative</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='h']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">photoprint</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='i']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">picture</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='j']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">print</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='l']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">technical drawing</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='q'][substring(text(),2,1)='q']"> + <form authority="marccategory">notated music</form> + <form authority="marcsmd">notated music</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='d']"> + <form authority="marccategory">projected graphic</form> + <form authority="marcsmd">filmslip</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='c']"> + <form authority="marccategory">projected graphic</form> + <form authority="marcsmd">filmstrip cartridge</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='o']"> + <form authority="marccategory">projected graphic</form> + <form authority="marcsmd">filmstrip roll</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='f']"> + <form authority="marccategory">projected graphic</form> + <form authority="marcsmd">other filmstrip type</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='s']"> + <form authority="marccategory">projected graphic</form> + <form authority="marcsmd">slide</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='t']"> + <form authority="marccategory">projected graphic</form> + <form authority="marcsmd">transparency</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='r'][substring(text(),2,1)='r']"> + <form authority="marccategory">remote-sensing image</form> + <form authority="marcsmd">remote-sensing image</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='e']"> + <form authority="marccategory">sound recording</form> + <form authority="marcsmd">cylinder</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='q']"> + <form authority="marccategory">sound recording</form> + <form authority="marcsmd">roll</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='g']"> + <form authority="marccategory">sound recording</form> + <form authority="marcsmd">sound cartridge</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='s']"> + <form authority="marccategory">sound recording</form> + <form authority="marcsmd">sound cassette</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='d']"> + <form authority="marccategory">sound recording</form> + <form authority="marcsmd">sound disc</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='t']"> + <form authority="marccategory">sound recording</form> + <form authority="marcsmd">sound-tape reel</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='i']"> + <form authority="marccategory">sound recording</form> + <form authority="marcsmd">sound-track film</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='w']"> + <form authority="marccategory">sound recording</form> + <form authority="marcsmd">wire recording</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='c']"> + <form authority="marccategory">tactile material</form> + <form authority="marcsmd">braille</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='b']"> + <form authority="marccategory">tactile material</form> + <form authority="marcsmd">combination</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='a']"> + <form authority="marccategory">tactile material</form> + <form authority="marcsmd">moon</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='d']"> + <form authority="marccategory">tactile material</form> + <form authority="marcsmd">tactile, with no writing system</form> + </xsl:if> + + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='c']"> + <form authority="marccategory">text</form> + <form authority="marcsmd">braille</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='b']"> + <form authority="marccategory">text</form> + <form authority="marcsmd">large print</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='a']"> + <form authority="marccategory">text</form> + <form authority="marcsmd">regular print</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='d']"> + <form authority="marccategory">text</form> + <form authority="marcsmd">text in looseleaf binder</form> + </xsl:if> + + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='c']"> + <form authority="marccategory">videorecording</form> + <form authority="marcsmd">videocartridge</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='f']"> + <form authority="marccategory">videorecording</form> + <form authority="marcsmd">videocassette</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='d']"> + <form authority="marccategory">videorecording</form> + <form authority="marcsmd">videodisc</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='r']"> + <form authority="marccategory">videorecording</form> + <form authority="marcsmd">videoreel</form> + </xsl:if> + + <xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='q'][string-length(.)>1]"> + <internetMediaType> + <xsl:value-of select="."/> + </internetMediaType> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=300]"> + <extent> + <xsl:if test="marc:subfield[@code='f']"> + <xsl:attribute name="unit"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">f</xsl:with-param> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abce3g</xsl:with-param> + </xsl:call-template> + </extent> + </xsl:for-each> + + + <xsl:for-each select="marc:datafield[@tag=337]"> + <form type="media"> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code=2]"/> + </xsl:attribute> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">a</xsl:with-param> + </xsl:call-template> + </form> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=338]"> + <form type="carrier"> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code=2]"/> + </xsl:attribute> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">a</xsl:with-param> + </xsl:call-template> + </form> + </xsl:for-each> + + + <!-- 1.43 tmee 351 $3$a$b$c--> + <xsl:for-each select="marc:datafield[@tag=351]"> + <note type="arrangement"> + <xsl:for-each select="marc:subfield[@code='3']"> + <xsl:value-of select="."/> + <xsl:text>: </xsl:text> + </xsl:for-each> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abc</xsl:with-param> + </xsl:call-template> + </note> + </xsl:for-each> + + </xsl:variable> + + + <xsl:if test="string-length(normalize-space($physicalDescription))"> + <physicalDescription> + <xsl:for-each select="marc:datafield[@tag=300]"> + <!-- Template checks for altRepGroup - 880 $6 --> + <xsl:call-template name="z3xx880"/> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=337]"> + <!-- Template checks for altRepGroup - 880 $6 --> + <xsl:call-template name="xxx880"/> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=338]"> + <!-- Template checks for altRepGroup - 880 $6 --> + <xsl:call-template name="xxx880"/> + </xsl:for-each> + + <xsl:copy-of select="$physicalDescription"/> + </physicalDescription> + </xsl:if> + + + <xsl:for-each select="marc:datafield[@tag=520]"> + <xsl:call-template name="createAbstractFrom520"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=505]"> + <xsl:call-template name="createTOCFrom505"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=521]"> + <xsl:call-template name="createTargetAudienceFrom521"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=506]"> + <xsl:call-template name="createAccessConditionFrom506"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=540]"> + <xsl:call-template name="createAccessConditionFrom540"/> + </xsl:for-each> + + + <xsl:if test="$typeOf008='BK' or $typeOf008='CF' or $typeOf008='MU' or $typeOf008='VM'"> + <xsl:variable name="controlField008-22" select="substring($controlField008,23,1)"/> + <xsl:choose> + <!-- 01/04 fix --> + <xsl:when test="$controlField008-22='d'"> + <targetAudience authority="marctarget">adolescent</targetAudience> + </xsl:when> + <xsl:when test="$controlField008-22='e'"> + <targetAudience authority="marctarget">adult</targetAudience> + </xsl:when> + <xsl:when test="$controlField008-22='g'"> + <targetAudience authority="marctarget">general</targetAudience> + </xsl:when> + <xsl:when test="$controlField008-22='b' or $controlField008-22='c' or $controlField008-22='j'"> + <targetAudience authority="marctarget">juvenile</targetAudience> + </xsl:when> + <xsl:when test="$controlField008-22='a'"> + <targetAudience authority="marctarget">preschool</targetAudience> + </xsl:when> + <xsl:when test="$controlField008-22='f'"> + <targetAudience authority="marctarget">specialized</targetAudience> + </xsl:when> + </xsl:choose> + </xsl:if> + + <!-- 1.32 tmee Drop note mapping for 510 and map only to <relatedItem> + <xsl:for-each select="marc:datafield[@tag=510]"> + <note type="citation/reference"> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:for-each> + --> + + <!-- 245c 362az 502-585 5XX--> + + <xsl:for-each select="marc:datafield[@tag=245]"> + <xsl:call-template name="createNoteFrom245c"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=362]"> + <xsl:call-template name="createNoteFrom362"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=500]"> + <xsl:call-template name="createNoteFrom500"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=502]"> + <xsl:call-template name="createNoteFrom502"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=504]"> + <xsl:call-template name="createNoteFrom504"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=508]"> + <xsl:call-template name="createNoteFrom508"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=511]"> + <xsl:call-template name="createNoteFrom511"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=515]"> + <xsl:call-template name="createNoteFrom515"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=518]"> + <xsl:call-template name="createNoteFrom518"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=524]"> + <xsl:call-template name="createNoteFrom524"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=530]"> + <xsl:call-template name="createNoteFrom530"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=533]"> + <xsl:call-template name="createNoteFrom533"/> + </xsl:for-each> + <!-- + <xsl:for-each select="marc:datafield[@tag=534]"> + <xsl:call-template name="createNoteFrom534"/> + </xsl:for-each> +--> + + <xsl:for-each select="marc:datafield[@tag=535]"> + <xsl:call-template name="createNoteFrom535"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=536]"> + <xsl:call-template name="createNoteFrom536"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=538]"> + <xsl:call-template name="createNoteFrom538"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=541]"> + <xsl:call-template name="createNoteFrom541"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=545]"> + <xsl:call-template name="createNoteFrom545"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=546]"> + <xsl:call-template name="createNoteFrom546"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=561]"> + <xsl:call-template name="createNoteFrom561"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=562]"> + <xsl:call-template name="createNoteFrom562"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=581]"> + <xsl:call-template name="createNoteFrom581"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=583]"> + <xsl:call-template name="createNoteFrom583"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=585]"> + <xsl:call-template name="createNoteFrom585"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=501 or @tag=507 or @tag=513 or @tag=514 or @tag=516 or @tag=522 or @tag=525 or @tag=526 or @tag=544 or @tag=547 or @tag=550 or @tag=552 or @tag=555 or @tag=556 or @tag=565 or @tag=567 or @tag=580 or @tag=584 or @tag=586]"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=034]"> + <xsl:call-template name="createSubGeoFrom034"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=043]"> + <xsl:call-template name="createSubGeoFrom043"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=045]"> + <xsl:call-template name="createSubTemFrom045"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=255]"> + <xsl:call-template name="createSubGeoFrom255"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=600]"> + <xsl:call-template name="createSubNameFrom600"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=610]"> + <xsl:call-template name="createSubNameFrom610"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=611]"> + <xsl:call-template name="createSubNameFrom611"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=630]"> + <xsl:call-template name="createSubTitleFrom630"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=648]"> + <xsl:call-template name="createSubChronFrom648"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=650]"> + <xsl:call-template name="createSubTopFrom650"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=651]"> + <xsl:call-template name="createSubGeoFrom651"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=653]"> + <xsl:call-template name="createSubFrom653"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=656]"> + <xsl:call-template name="createSubFrom656"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=662]"> + <xsl:call-template name="createSubGeoFrom662752"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=752]"> + <xsl:call-template name="createSubGeoFrom662752"/> + </xsl:for-each> + + <!-- createClassificationFrom 0XX--> + <xsl:for-each select="marc:datafield[@tag='050']"> + <xsl:call-template name="createClassificationFrom050"/> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='060']"> + <xsl:call-template name="createClassificationFrom060"/> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='080']"> + <xsl:call-template name="createClassificationFrom080"/> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='082']"> + <xsl:call-template name="createClassificationFrom082"/> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='084']"> + <xsl:call-template name="createClassificationFrom084"/> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='086']"> + <xsl:call-template name="createClassificationFrom086"/> + </xsl:for-each> + + <!-- location --> + + <xsl:for-each select="marc:datafield[@tag=852]"> + <xsl:call-template name="createLocationFrom852"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=856]"> + <xsl:call-template name="createLocationFrom856"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=490][@ind1=0]"> + <xsl:call-template name="createRelatedItemFrom490"/> + </xsl:for-each> + + + <xsl:for-each select="marc:datafield[@tag=440]"> + <relatedItem type="series"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">av</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + </relatedItem> + </xsl:for-each> + + <!-- tmee 1.40 1.74 1.88 fixed 510c mapping 20130829--> + + <xsl:for-each select="marc:datafield[@tag=510]"> + <relatedItem type="isReferencedBy"> + <xsl:for-each select="marc:subfield[@code='a']"> + <titleInfo> + <title> + <xsl:value-of select="."/> + </title> + </titleInfo> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='b']"> + <originInfo> + <dateOther type="coverage"> + <xsl:value-of select="."/> + </dateOther> + </originInfo> + </xsl:for-each> + + <part> + <detail type="part"> + <number> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">c</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </number> + </detail> + </part> + </relatedItem> + </xsl:for-each> + + + <xsl:for-each select="marc:datafield[@tag=534]"> + <relatedItem type="original"> + <xsl:call-template name="relatedTitle"/> + <xsl:call-template name="relatedName"/> + <xsl:if test="marc:subfield[@code='b' or @code='c']"> + <originInfo> + <xsl:for-each select="marc:subfield[@code='c']"> + <publisher> + <xsl:value-of select="."/> + </publisher> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='b']"> + <edition> + <xsl:value-of select="."/> + </edition> + </xsl:for-each> + </originInfo> + </xsl:if> + <xsl:call-template name="relatedIdentifierISSN"/> + <xsl:for-each select="marc:subfield[@code='z']"> + <identifier type="isbn"> + <xsl:value-of select="."/> + </identifier> + </xsl:for-each> + <xsl:call-template name="relatedNote"/> + </relatedItem> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=700][marc:subfield[@code='t']]"> + <relatedItem> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="constituentOrRelatedType"/> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="afterCodes">g</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + <name type="personal"> + <namePart> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">aq</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="beforeCodes">g</xsl:with-param> + </xsl:call-template> + </namePart> + <xsl:call-template name="termsOfAddress"/> + <xsl:call-template name="nameDate"/> + <xsl:call-template name="role"/> + </name> + <xsl:call-template name="relatedForm"/> + <xsl:call-template name="relatedIdentifierISSN"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=710][marc:subfield[@code='t']]"> + <relatedItem> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="constituentOrRelatedType"/> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="afterCodes">dg</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="relatedPartNumName"/> + </titleInfo> + <name type="corporate"> + <xsl:for-each select="marc:subfield[@code='a']"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='b']"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </xsl:for-each> + <xsl:variable name="tempNamePart"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">c</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="beforeCodes">dgn</xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:if test="normalize-space($tempNamePart)"> + <namePart> + <xsl:value-of select="$tempNamePart"/> + </namePart> + </xsl:if> + <xsl:call-template name="role"/> + </name> + <xsl:call-template name="relatedForm"/> + <xsl:call-template name="relatedIdentifierISSN"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=711][marc:subfield[@code='t']]"> + <relatedItem> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="constituentOrRelatedType"/> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">tfklsv</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="afterCodes">g</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="relatedPartNumName"/> + </titleInfo> + <name type="conference"> + <namePart> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">aqdc</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="beforeCodes">gn</xsl:with-param> + </xsl:call-template> + </namePart> + </name> + <xsl:call-template name="relatedForm"/> + <xsl:call-template name="relatedIdentifierISSN"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=730][@ind2=2]"> + <relatedItem> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="constituentOrRelatedType"/> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">adfgklmorsv</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + <xsl:call-template name="relatedForm"/> + <xsl:call-template name="relatedIdentifierISSN"/> + </relatedItem> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=740][@ind2=2]"> + <relatedItem> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="constituentOrRelatedType"/> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + <xsl:call-template name="relatedForm"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=760]"> + <relatedItem type="series"> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="relatedItem76X-78X"/> + </relatedItem> + </xsl:for-each> + + <!--AQ1.23 tmee/dlf --> + <xsl:for-each select="marc:datafield[@tag=762]"> + <relatedItem type="constituent"> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="relatedItem76X-78X"/> + </relatedItem> + </xsl:for-each> + + <!-- AQ1.5, AQ1.7 deleted tags 777 and 787 from the following select for relatedItem mapping --> + <!-- 1.45 and 1.46 - AQ1.24 and 1.25 tmee--> + <xsl:for-each select="marc:datafield[@tag=765]|marc:datafield[@tag=767]|marc:datafield[@tag=775]"> + <relatedItem type="otherVersion"> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="relatedItem76X-78X"/> + </relatedItem> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=770]|marc:datafield[@tag=774]"> + <relatedItem type="constituent"> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="relatedItem76X-78X"/> + </relatedItem> + </xsl:for-each> + + + <xsl:for-each select="marc:datafield[@tag=772]|marc:datafield[@tag=773]"> + <relatedItem type="host"> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="relatedItem76X-78X"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=776]"> + <relatedItem type="otherFormat"> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="relatedItem76X-78X"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=780]"> + <relatedItem type="preceding"> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="relatedItem76X-78X"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=785]"> + <relatedItem type="succeeding"> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="relatedItem76X-78X"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=786]"> + <relatedItem type="original"> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="relatedItem76X-78X"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=800]"> + <relatedItem type="series"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="afterCodes">g</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + <name type="personal"> + <namePart> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">aq</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="beforeCodes">g</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </namePart> + <xsl:call-template name="termsOfAddress"/> + <xsl:call-template name="nameDate"/> + <xsl:call-template name="role"/> + </name> + <xsl:call-template name="relatedForm"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=810]"> + <relatedItem type="series"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="afterCodes">dg</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="relatedPartNumName"/> + </titleInfo> + <name type="corporate"> + <xsl:for-each select="marc:subfield[@code='a']"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='b']"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </xsl:for-each> + <namePart> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">c</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="beforeCodes">dgn</xsl:with-param> + </xsl:call-template> + </namePart> + <xsl:call-template name="role"/> + </name> + <xsl:call-template name="relatedForm"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=811]"> + <relatedItem type="series"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">tfklsv</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="afterCodes">g</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="relatedPartNumName"/> + </titleInfo> + <name type="conference"> + <namePart> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">aqdc</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="beforeCodes">gn</xsl:with-param> + </xsl:call-template> + </namePart> + <xsl:call-template name="role"/> + </name> + <xsl:call-template name="relatedForm"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='830']"> + <relatedItem type="series"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">adfgklmorsv</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + <xsl:call-template name="relatedForm"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='856'][@ind2='2']/marc:subfield[@code='q']"> + <relatedItem> + <internetMediaType> + <xsl:value-of select="."/> + </internetMediaType> + </relatedItem> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='880']"> + <xsl:apply-templates select="self::*" mode="trans880"/> + </xsl:for-each> + + + <!-- 856, 020, 024, 022, 028, 010, 035, 037 --> + + <xsl:for-each select="marc:datafield[@tag='020']"> + <xsl:if test="marc:subfield[@code='a']"> + <identifier type="isbn"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </identifier> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='020']"> + <xsl:if test="marc:subfield[@code='z']"> + <identifier type="isbn" invalid="yes"> + <xsl:value-of select="marc:subfield[@code='z']"/> + </identifier> + </xsl:if> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='024'][@ind1='0']"> + <xsl:if test="marc:subfield[@code='a']"> + <identifier type="isrc"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </identifier> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='024'][@ind1='2']"> + <xsl:if test="marc:subfield[@code='a']"> + <identifier type="ismn"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </identifier> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='024'][@ind1='4']"> + <identifier type="sici"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ab</xsl:with-param> + </xsl:call-template> + </identifier> + </xsl:for-each> + + <!-- 1.107 WS --> + <xsl:for-each select="marc:datafield[@tag='024'][@ind1='7']"> + <identifier> + <xsl:if test="marc:subfield[@code='2']"> + <xsl:attribute name="type"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="marc:subfield[@code='a']"/> + </identifier> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='024'][@ind1='8']"> + <identifier> + <xsl:value-of select="marc:subfield[@code='a']"/> + </identifier> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='022'][marc:subfield[@code='a']]"> + <xsl:if test="marc:subfield[@code='a']"> + <identifier type="issn"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </identifier> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='022'][marc:subfield[@code='z']]"> + <xsl:if test="marc:subfield[@code='z']"> + <identifier type="issn" invalid="yes"> + <xsl:value-of select="marc:subfield[@code='z']"/> + </identifier> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='022'][marc:subfield[@code='y']]"> + <xsl:if test="marc:subfield[@code='y']"> + <identifier type="issn" invalid="yes"> + <xsl:value-of select="marc:subfield[@code='y']"/> + </identifier> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='022'][marc:subfield[@code='l']]"> + <xsl:if test="marc:subfield[@code='l']"> + <identifier type="issn-l"> + <xsl:value-of select="marc:subfield[@code='l']"/> + </identifier> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='022'][marc:subfield[@code='m']]"> + <xsl:if test="marc:subfield[@code='m']"> + <identifier type="issn-l" invalid="yes"> + <xsl:value-of select="marc:subfield[@code='m']"/> + </identifier> + </xsl:if> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='010'][marc:subfield[@code='a']]"> + <identifier type="lccn"> + <xsl:value-of select="normalize-space(marc:subfield[@code='a'])"/> + </identifier> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='010'][marc:subfield[@code='z']]"> + <identifier type="lccn" invalid="yes"> + <xsl:value-of select="normalize-space(marc:subfield[@code='z'])"/> + </identifier> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='028']"> + <identifier> + <xsl:attribute name="type"> + <xsl:choose> + <xsl:when test="@ind1='0'">issue number</xsl:when> + <xsl:when test="@ind1='1'">matrix number</xsl:when> + <xsl:when test="@ind1='2'">music plate</xsl:when> + <xsl:when test="@ind1='3'">music publisher</xsl:when> + <xsl:when test="@ind1='4'">videorecording identifier</xsl:when> + </xsl:choose> + </xsl:attribute> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes"> + <xsl:choose> + <xsl:when test="@ind1='0'">ba</xsl:when> + <xsl:otherwise>ab</xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </identifier> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='035'][marc:subfield[@code='a'][contains(text(), '(OCoLC)')]]"> + <identifier type="oclc"> + <xsl:value-of select="normalize-space(substring-after(marc:subfield[@code='a'], '(OCoLC)'))"/> + </identifier> + </xsl:for-each> + + + <!-- 3.5 1.95 20140421 --> + <xsl:for-each select="marc:datafield[@tag='035'][marc:subfield[@code='a'][contains(text(), '(WlCaITV)')]]"> + <identifier type="WlCaITV"> + <xsl:value-of select="normalize-space(substring-after(marc:subfield[@code='a'], '(WlCaITV)'))"/> + </identifier> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='037']"> + <identifier type="stock number"> + <xsl:if test="marc:subfield[@code='c']"> + <xsl:attribute name="displayLabel"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">c</xsl:with-param> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ab</xsl:with-param> + </xsl:call-template> + </identifier> + </xsl:for-each> + + + <!-- 1.51 tmee 20100129--> + <xsl:for-each select="marc:datafield[@tag='856'][marc:subfield[@code='u']]"> + <xsl:if 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') "> + <identifier> + <xsl:attribute name="type"> + <xsl:if test="starts-with(marc:subfield[@code='u'],'urn:doi') or starts-with(marc:subfield[@code='u'],'doi')">doi</xsl:if> + <xsl:if 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:if> + </xsl:attribute> + <xsl:value-of select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))"/> + </identifier> + </xsl:if> + <xsl:if test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl')"> + <identifier type="hdl"> + <xsl:if test="marc:subfield[@code='y' or @code='3' or @code='z']"> + <xsl:attribute name="displayLabel"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">y3z</xsl:with-param> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))"/> + </identifier> + </xsl:if> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=024][@ind1=1]"> + <identifier type="upc"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </identifier> + </xsl:for-each> + + + <!-- 1.51 tmee 20100129 removed duplicate code 20131217 + <xsl:for-each select="marc:datafield[@tag='856'][marc:subfield[@code='u']]"> + <xsl:if + 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') "> + <identifier> + <xsl:attribute name="type"> + <xsl:if + test="starts-with(marc:subfield[@code='u'],'urn:doi') or starts-with(marc:subfield[@code='u'],'doi')" + >doi</xsl:if> + <xsl:if + 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:if> + </xsl:attribute> + <xsl:value-of + select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))" + /> + </identifier> + </xsl:if> + + <xsl:if + test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl')"> + <identifier type="hdl"> + <xsl:if test="marc:subfield[@code='y' or @code='3' or @code='z']"> + <xsl:attribute name="displayLabel"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">y3z</xsl:with-param> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:value-of + select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))" + /> + </identifier> + </xsl:if> + </xsl:for-each> + --> + + + <xsl:for-each select="marc:datafield[@tag=856][@ind2=2][marc:subfield[@code='u']]"> + <relatedItem> + <location> + <url> + <xsl:if test="marc:subfield[@code='y' or @code='3']"> + <xsl:attribute name="displayLabel"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">y3</xsl:with-param> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="marc:subfield[@code='z']"> + <xsl:attribute name="note"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">z</xsl:with-param> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="marc:subfield[@code='u']"/> + </url> + </location> + </relatedItem> + </xsl:for-each> + + <recordInfo> + <xsl:for-each select="marc:leader[substring($leader,19,1)='a']"> + <descriptionStandard>aacr</descriptionStandard> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=040]"> + <xsl:if test="marc:subfield[@code='e']"> + <descriptionStandard> + <xsl:value-of select="marc:subfield[@code='e']"/> + </descriptionStandard> + </xsl:if> + <recordContentSource authority="marcorg"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </recordContentSource> + </xsl:for-each> + <xsl:for-each select="marc:controlfield[@tag=008]"> + <recordCreationDate encoding="marc"> + <xsl:value-of select="substring(.,1,6)"/> + </recordCreationDate> + </xsl:for-each> + + <xsl:for-each select="marc:controlfield[@tag=005]"> + <recordChangeDate encoding="iso8601"> + <xsl:value-of select="."/> + </recordChangeDate> + </xsl:for-each> + <xsl:for-each select="marc:controlfield[@tag=001]"> + <recordIdentifier> + <xsl:if test="../marc:controlfield[@tag=003]"> + <xsl:attribute name="source"> + <xsl:value-of select="../marc:controlfield[@tag=003]"/> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="."/> + </recordIdentifier> + </xsl:for-each> + + <recordOrigin>Converted from MARCXML to MODS version 3.6 using MARC21slim2MODS3-6.xsl + (Revision 1.119 2018/06/21)</recordOrigin> + + <xsl:for-each select="marc:datafield[@tag=040]/marc:subfield[@code='b']"> + <languageOfCataloging> + <languageTerm authority="iso639-2b" type="code"> + <xsl:value-of select="."/> + </languageTerm> + </languageOfCataloging> + </xsl:for-each> + </recordInfo> + </xsl:template> + + <xsl:template name="displayForm"> + <xsl:for-each select="marc:subfield[@code='c']"> + <displayForm> + <xsl:value-of select="."/> + </displayForm> + </xsl:for-each> + </xsl:template> + <xsl:template name="affiliation"> + <xsl:for-each select="marc:subfield[@code='u']"> + <affiliation> + <xsl:value-of select="."/> + </affiliation> + </xsl:for-each> + </xsl:template> + <xsl:template name="uri"> + <xsl:for-each select="marc:subfield[@code='u']|marc:subfield[@code='0']"> + <xsl:attribute name="xlink:href"> + <xsl:value-of select="."/> + </xsl:attribute> + </xsl:for-each> + </xsl:template> + <xsl:template name="role"> + <xsl:for-each select="marc:subfield[@code='e']"> + <role> + <roleTerm type="text"> + <xsl:value-of select="."/> + </roleTerm> + </role> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='4']"> + <role> + <roleTerm authority="marcrelator" type="code"> + <xsl:value-of select="."/> + </roleTerm> + </role> + </xsl:for-each> + </xsl:template> + <xsl:template name="part"> + <xsl:variable name="partNumber"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="axis">n</xsl:with-param> + <xsl:with-param name="anyCodes">n</xsl:with-param> + <xsl:with-param name="afterCodes">fgkdlmor</xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="partName"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="axis">p</xsl:with-param> + <xsl:with-param name="anyCodes">p</xsl:with-param> + <xsl:with-param name="afterCodes">fgkdlmor</xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:if test="string-length(normalize-space($partNumber))"> + <partNumber> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="$partNumber"/> + </xsl:call-template> + </partNumber> + </xsl:if> + <xsl:if test="string-length(normalize-space($partName))"> + <partName> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="$partName"/> + </xsl:call-template> + </partName> + </xsl:if> + </xsl:template> + <xsl:template name="relatedPart"> + <xsl:if test="@tag=773"> + <xsl:for-each select="marc:subfield[@code='g']"> + <part> + <text> + <xsl:value-of select="."/> + </text> + </part> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='q']"> + <part> + <xsl:call-template name="parsePart"/> + </part> + </xsl:for-each> + </xsl:if> + </xsl:template> + <xsl:template name="relatedPartNumName"> + <xsl:variable name="partNumber"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="axis">g</xsl:with-param> + <xsl:with-param name="anyCodes">g</xsl:with-param> + <xsl:with-param name="afterCodes">pst</xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="partName"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="axis">p</xsl:with-param> + <xsl:with-param name="anyCodes">p</xsl:with-param> + <xsl:with-param name="afterCodes">fgkdlmor</xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:if test="string-length(normalize-space($partNumber))"> + <partNumber> + <xsl:value-of select="$partNumber"/> + </partNumber> + </xsl:if> + <xsl:if test="string-length(normalize-space($partName))"> + <partName> + <xsl:value-of select="$partName"/> + </partName> + </xsl:if> + </xsl:template> + <xsl:template name="relatedName"> + <xsl:for-each select="marc:subfield[@code='a']"> + <name> + <namePart> + <xsl:value-of select="."/> + </namePart> + </name> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedForm"> + <xsl:for-each select="marc:subfield[@code='h']"> + <physicalDescription> + <form> + <xsl:value-of select="."/> + </form> + </physicalDescription> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedExtent"> + <xsl:for-each select="marc:subfield[@code='h']"> + <physicalDescription> + <extent> + <xsl:value-of select="."/> + </extent> + </physicalDescription> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedNote"> + <xsl:for-each select="marc:subfield[@code='n']"> + <note> + <xsl:value-of select="."/> + </note> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedSubject"> + <xsl:for-each select="marc:subfield[@code='j']"> + <subject> + <temporal encoding="iso8601"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </temporal> + </subject> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedIdentifierISSN"> + <xsl:for-each select="marc:subfield[@code='x']"> + <identifier type="issn"> + <xsl:value-of select="."/> + </identifier> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedIdentifierLocal"> + <xsl:for-each select="marc:subfield[@code='w']"> + <identifier type="local"> + <xsl:value-of select="."/> + </identifier> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedIdentifier"> + <xsl:for-each select="marc:subfield[@code='o']"> + <identifier> + <xsl:value-of select="."/> + </identifier> + </xsl:for-each> + </xsl:template> + + <!--tmee 1.40 510 isReferencedBy --> + <xsl:template name="relatedItem510"> + <xsl:call-template name="displayLabel"/> + <xsl:call-template name="relatedTitle76X-78X"/> + <xsl:call-template name="relatedName"/> + <xsl:call-template name="relatedOriginInfo510"/> + <xsl:call-template name="relatedLanguage"/> + <xsl:call-template name="relatedExtent"/> + <xsl:call-template name="relatedNote"/> + <xsl:call-template name="relatedSubject"/> + <xsl:call-template name="relatedIdentifier"/> + <xsl:call-template name="relatedIdentifierISSN"/> + <xsl:call-template name="relatedIdentifierLocal"/> + <xsl:call-template name="relatedPart"/> + </xsl:template> + <xsl:template name="relatedItem76X-78X"> + <xsl:call-template name="displayLabel"/> + <xsl:call-template name="relatedTitle76X-78X"/> + <xsl:call-template name="relatedName"/> + <xsl:call-template name="relatedOriginInfo"/> + <xsl:call-template name="relatedLanguage"/> + <xsl:call-template name="relatedExtent"/> + <xsl:call-template name="relatedNote"/> + <xsl:call-template name="relatedSubject"/> + <xsl:call-template name="relatedIdentifier"/> + <xsl:call-template name="relatedIdentifierISSN"/> + <xsl:call-template name="relatedIdentifierLocal"/> + <xsl:call-template name="relatedPart"/> + </xsl:template> + <xsl:template name="subjectGeographicZ"> + <geographic> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </geographic> + </xsl:template> + <xsl:template name="subjectTemporalY"> + <temporal> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </temporal> + </xsl:template> + <xsl:template name="subjectTopic"> + <topic> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </topic> + </xsl:template> + <!-- 3.2 change tmee 6xx $v genre --> + <xsl:template name="subjectGenre"> + <genre> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </genre> + </xsl:template> + + <xsl:template name="nameABCDN"> + <xsl:for-each select="marc:subfield[@code='a']"> + <namePart> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </namePart> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='b']"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </xsl:for-each> + <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']"> + <namePart> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">cdn</xsl:with-param> + </xsl:call-template> + </namePart> + </xsl:if> + </xsl:template> + <xsl:template name="nameABCDQ"> + <namePart> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">aq</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="punctuation"> + <xsl:text>:,;/ </xsl:text> + </xsl:with-param> + </xsl:call-template> + </namePart> + <xsl:call-template name="termsOfAddress"/> + <xsl:call-template name="nameDate"/> + </xsl:template> + <xsl:template name="nameACDEQ"> + <namePart> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">acdeq</xsl:with-param> + </xsl:call-template> + </namePart> + </xsl:template> + + <!--1.104 20141104--> + <xsl:template name="nameACDENQ"> + <namePart> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">acdenq</xsl:with-param> + </xsl:call-template> + </namePart> + </xsl:template> + + <!-- 1.116 --> + <xsl:template name="nameIdentifier"> + <xsl:if test="marc:subfield[@code='0']"> + <nameIdentifier> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">0</xsl:with-param> + </xsl:call-template> + </nameIdentifier> + </xsl:if> + </xsl:template> + + + <xsl:template name="constituentOrRelatedType"> + <xsl:if test="@ind2=2"> + <xsl:attribute name="type">constituent</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template name="relatedTitle"> + <xsl:for-each select="marc:subfield[@code='t']"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="."/> + </xsl:with-param> + </xsl:call-template> + </title> + </titleInfo> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedTitle76X-78X"> + <xsl:for-each select="marc:subfield[@code='t']"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="."/> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']"> + <xsl:call-template name="relatedPartNumName"/> + </xsl:if> + </titleInfo> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='p']"> + <titleInfo type="abbreviated"> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="."/> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']"> + <xsl:call-template name="relatedPartNumName"/> + </xsl:if> + </titleInfo> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='s']"> + <titleInfo type="uniform"> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="."/> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']"> + <xsl:call-template name="relatedPartNumName"/> + </xsl:if> + </titleInfo> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedOriginInfo"> + <xsl:if test="marc:subfield[@code='b' or @code='d'] or marc:subfield[@code='f']"> + <originInfo> + <xsl:if test="@tag=775"> + <xsl:for-each select="marc:subfield[@code='f']"> + <place> + <placeTerm> + <xsl:attribute name="type">code</xsl:attribute> + <xsl:attribute name="authority">marcgac</xsl:attribute> + <xsl:value-of select="."/> + </placeTerm> + </place> + </xsl:for-each> + </xsl:if> + <xsl:for-each select="marc:subfield[@code='d']"> + <publisher> + <xsl:value-of select="."/> + </publisher> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='b']"> + <edition> + <xsl:value-of select="."/> + </edition> + </xsl:for-each> + </originInfo> + </xsl:if> + </xsl:template> + + <!-- tmee 1.40 --> + + <xsl:template name="relatedOriginInfo510"> + <xsl:for-each select="marc:subfield[@code='b']"> + <originInfo> + <dateOther type="coverage"> + <xsl:value-of select="."/> + </dateOther> + </originInfo> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedLanguage"> + <xsl:for-each select="marc:subfield[@code='e']"> + <xsl:call-template name="getLanguage"> + <xsl:with-param name="langString"> + <xsl:value-of select="."/> + </xsl:with-param> + </xsl:call-template> + </xsl:for-each> + </xsl:template> + <xsl:template name="nameDate"> + <xsl:for-each select="marc:subfield[@code='d']"> + <namePart type="date"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </namePart> + </xsl:for-each> + </xsl:template> + <xsl:template name="subjectAuthority"> + <xsl:if test="@ind2!=4"> + <xsl:if test="@ind2!=' '"> + <xsl:if test="@ind2!=8"> + <xsl:if test="@ind2!=9"> + <xsl:attribute name="authority"> + <xsl:choose> + <xsl:when test="@ind2=0">lcsh</xsl:when> + <xsl:when test="@ind2=1">lcshac</xsl:when> + <xsl:when test="@ind2=2">mesh</xsl:when> + <!-- 1/04 fix --> + <xsl:when test="@ind2=3">nal</xsl:when> + <xsl:when test="@ind2=5">csh</xsl:when> + <xsl:when test="@ind2=6">rvm</xsl:when> + <xsl:when test="@ind2=7"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:when> + </xsl:choose> + </xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:if> + </xsl:if> + </xsl:template> + <!-- 1.75 + fix --> + <xsl:template name="subject653Type"> + <xsl:if test="@ind2!=' '"> + <xsl:if test="@ind2!='0'"> + <xsl:if test="@ind2!='4'"> + <xsl:if test="@ind2!='5'"> + <xsl:if test="@ind2!='6'"> + <xsl:if test="@ind2!='7'"> + <xsl:if test="@ind2!='8'"> + <xsl:if test="@ind2!='9'"> + <xsl:attribute name="type"> + <xsl:choose> + <xsl:when test="@ind2=1">personal</xsl:when> + <xsl:when test="@ind2=2">corporate</xsl:when> + <xsl:when test="@ind2=3">conference</xsl:when> + </xsl:choose> + </xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:if> + </xsl:if> + </xsl:if> + </xsl:if> + </xsl:if> + </xsl:if> + + + </xsl:template> + <xsl:template name="subjectAnyOrder"> + <xsl:for-each select="marc:subfield[@code='v' or @code='x' or @code='y' or @code='z']"> + <xsl:choose> + <xsl:when test="@code='v'"> + <xsl:call-template name="subjectGenre"/> + </xsl:when> + <xsl:when test="@code='x'"> + <xsl:call-template name="subjectTopic"/> + </xsl:when> + <xsl:when test="@code='y'"> + <xsl:call-template name="subjectTemporalY"/> + </xsl:when> + <xsl:when test="@code='z'"> + <xsl:call-template name="subjectGeographicZ"/> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template name="specialSubfieldSelect"> + <xsl:param name="anyCodes"/> + <xsl:param name="axis"/> + <xsl:param name="beforeCodes"/> + <xsl:param name="afterCodes"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield"> + <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])"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </xsl:template> + + + <xsl:template match="marc:datafield[@tag=656]"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:if test="marc:subfield[@code=2]"> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code=2]"/> + </xsl:attribute> + </xsl:if> + <occupation> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </xsl:with-param> + </xsl:call-template> + </occupation> + </subject> + </xsl:template> + <xsl:template name="termsOfAddress"> + <xsl:if test="marc:subfield[@code='b' or @code='c']"> + <namePart type="termsOfAddress"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">bc</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </namePart> + </xsl:if> + </xsl:template> + <xsl:template name="displayLabel"> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="displayLabel"> + <xsl:value-of select="marc:subfield[@code='i']"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="marc:subfield[@code='3']"> + <xsl:attribute name="displayLabel"> + <xsl:value-of select="marc:subfield[@code='3']"/> + </xsl:attribute> + </xsl:if> + </xsl:template> + + <!-- isInvalid + <xsl:template name="isInvalid"> + <xsl:param name="type"/> + <xsl:if + test="marc:subfield[@code='z'] or marc:subfield[@code='y'] or marc:subfield[@code='m']"> + <identifier> + <xsl:attribute name="type"> + <xsl:value-of select="$type"/> + </xsl:attribute> + <xsl:attribute name="invalid"> + <xsl:text>yes</xsl:text> + </xsl:attribute> + <xsl:if test="marc:subfield[@code='z']"> + <xsl:value-of select="marc:subfield[@code='z']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='y']"> + <xsl:value-of select="marc:subfield[@code='y']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='m']"> + <xsl:value-of select="marc:subfield[@code='m']"/> + </xsl:if> + </identifier> + </xsl:if> + </xsl:template> + --> + <xsl:template name="subtitle"> + <xsl:if test="marc:subfield[@code='b']"> + <subTitle> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:subfield[@code='b']"/> + <!--<xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">b</xsl:with-param> + </xsl:call-template>--> + </xsl:with-param> + </xsl:call-template> + </subTitle> + </xsl:if> + </xsl:template> + <xsl:template name="script"> + <xsl:param name="scriptCode"/> + <xsl:attribute name="script"> + <xsl:choose> + <!-- ISO 15924 and CJK is a local code 20101123--> + <xsl:when test="$scriptCode='(3'">Arab</xsl:when> + <xsl:when test="$scriptCode='(4'">Arab</xsl:when> + <xsl:when test="$scriptCode='(B'">Latn</xsl:when> + <xsl:when test="$scriptCode='!E'">Latn</xsl:when> + <xsl:when test="$scriptCode='$1'">CJK</xsl:when> + <xsl:when test="$scriptCode='(N'">Cyrl</xsl:when> + <xsl:when test="$scriptCode='(Q'">Cyrl</xsl:when> + <xsl:when test="$scriptCode='(2'">Hebr</xsl:when> + <xsl:when test="$scriptCode='(S'">Grek</xsl:when> + </xsl:choose> + </xsl:attribute> + </xsl:template> + <xsl:template name="parsePart"> + <!-- assumes 773$q= 1:2:3<4 + with up to 3 levels and one optional start page + --> + <xsl:variable name="level1"> + <xsl:choose> + <xsl:when test="contains(text(),':')"> + <!-- 1:2 --> + <xsl:value-of select="substring-before(text(),':')"/> + </xsl:when> + <xsl:when test="not(contains(text(),':'))"> + <!-- 1 or 1<3 --> + <xsl:if test="contains(text(),'<')"> + <!-- 1<3 --> + <xsl:value-of select="substring-before(text(),'<')"/> + </xsl:if> + <xsl:if test="not(contains(text(),'<'))"> + <!-- 1 --> + <xsl:value-of select="text()"/> + </xsl:if> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="sici2"> + <xsl:choose> + <xsl:when test="starts-with(substring-after(text(),$level1),':')"> + <xsl:value-of select="substring(substring-after(text(),$level1),2)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after(text(),$level1)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="level2"> + <xsl:choose> + <xsl:when test="contains($sici2,':')"> + <!-- 2:3<4 --> + <xsl:value-of select="substring-before($sici2,':')"/> + </xsl:when> + <xsl:when test="contains($sici2,'<')"> + <!-- 1: 2<4 --> + <xsl:value-of select="substring-before($sici2,'<')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$sici2"/> + <!-- 1:2 --> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="sici3"> + <xsl:choose> + <xsl:when test="starts-with(substring-after($sici2,$level2),':')"> + <xsl:value-of select="substring(substring-after($sici2,$level2),2)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after($sici2,$level2)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="level3"> + <xsl:choose> + <xsl:when test="contains($sici3,'<')"> + <!-- 2<4 --> + <xsl:value-of select="substring-before($sici3,'<')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$sici3"/> + <!-- 3 --> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="page"> + <xsl:if test="contains(text(),'<')"> + <xsl:value-of select="substring-after(text(),'<')"/> + </xsl:if> + </xsl:variable> + <xsl:if test="$level1"> + <detail level="1"> + <number> + <xsl:value-of select="$level1"/> + </number> + </detail> + </xsl:if> + <xsl:if test="$level2"> + <detail level="2"> + <number> + <xsl:value-of select="$level2"/> + </number> + </detail> + </xsl:if> + <xsl:if test="$level3"> + <detail level="3"> + <number> + <xsl:value-of select="$level3"/> + </number> + </detail> + </xsl:if> + <xsl:if test="$page"> + <extent unit="page"> + <start> + <xsl:value-of select="$page"/> + </start> + </extent> + </xsl:if> + </xsl:template> + <xsl:template name="getLanguage"> + <xsl:param name="langString"/> + <xsl:param name="controlField008-35-37"/> + <xsl:variable name="length" select="string-length($langString)"/> + <xsl:choose> + <xsl:when test="$length=0"/> + <xsl:when test="$controlField008-35-37=substring($langString,1,3)"> + <xsl:call-template name="getLanguage"> + <xsl:with-param name="langString" select="substring($langString,4,$length)"/> + <xsl:with-param name="controlField008-35-37" select="$controlField008-35-37"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <language> + <languageTerm authority="iso639-2b" type="code"> + <xsl:value-of select="substring($langString,1,3)"/> + </languageTerm> + </language> + <xsl:call-template name="getLanguage"> + <xsl:with-param name="langString" select="substring($langString,4,$length)"/> + <xsl:with-param name="controlField008-35-37" select="$controlField008-35-37"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="isoLanguage"> + <xsl:param name="currentLanguage"/> + <xsl:param name="usedLanguages"/> + <xsl:param name="remainingLanguages"/> + <xsl:choose> + <xsl:when test="string-length($currentLanguage)=0"/> + <xsl:when test="not(contains($usedLanguages, $currentLanguage))"> + <language> + <xsl:if test="@code!='a'"> + <xsl:attribute name="objectPart"> + <xsl:choose> + <xsl:when test="@code='b'">summary or subtitle</xsl:when> + <xsl:when test="@code='d'">sung or spoken text</xsl:when> + <xsl:when test="@code='e'">libretto</xsl:when> + <xsl:when test="@code='f'">table of contents</xsl:when> + <xsl:when test="@code='g'">accompanying material</xsl:when> + <xsl:when test="@code='h'">translation</xsl:when> + </xsl:choose> + </xsl:attribute> + </xsl:if> + <languageTerm authority="iso639-2b" type="code"> + <xsl:value-of select="$currentLanguage"/> + </languageTerm> + </language> + <xsl:call-template name="isoLanguage"> + <xsl:with-param name="currentLanguage"> + <xsl:value-of select="substring($remainingLanguages,1,3)"/> + </xsl:with-param> + <xsl:with-param name="usedLanguages"> + <xsl:value-of select="concat($usedLanguages,$currentLanguage)"/> + </xsl:with-param> + <xsl:with-param name="remainingLanguages"> + <xsl:value-of select="substring($remainingLanguages,4,string-length($remainingLanguages))"/> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="isoLanguage"> + <xsl:with-param name="currentLanguage"> + <xsl:value-of select="substring($remainingLanguages,1,3)"/> + </xsl:with-param> + <xsl:with-param name="usedLanguages"> + <xsl:value-of select="concat($usedLanguages,$currentLanguage)"/> + </xsl:with-param> + <xsl:with-param name="remainingLanguages"> + <xsl:value-of select="substring($remainingLanguages,4,string-length($remainingLanguages))"/> + </xsl:with-param> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="chopBrackets"> + <xsl:param name="chopString"/> + <xsl:variable name="string"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="$chopString"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="substring($string, 1,1)='['"> + <xsl:value-of select="substring($string,2, string-length($string)-2)"/> + </xsl:if> + <xsl:if test="substring($string, 1,1)!='['"> + <xsl:value-of select="$string"/> + </xsl:if> + </xsl:template> + <xsl:template name="rfcLanguages"> + <xsl:param name="nodeNum"/> + <xsl:param name="usedLanguages"/> + <xsl:param name="controlField008-35-37"/> + <xsl:variable name="currentLanguage" select="."/> + <xsl:choose> + <xsl:when test="not($currentLanguage)"/> + <xsl:when test="$currentLanguage!=$controlField008-35-37 and $currentLanguage!='rfc3066'"> + <xsl:if test="not(contains($usedLanguages,$currentLanguage))"> + <language> + <xsl:if test="@code!='a'"> + <xsl:attribute name="objectPart"> + <xsl:choose> + <xsl:when test="@code='b'">summary or subtitle</xsl:when> + <xsl:when test="@code='d'">sung or spoken text</xsl:when> + <xsl:when test="@code='e'">libretto</xsl:when> + <xsl:when test="@code='f'">table of contents</xsl:when> + <xsl:when test="@code='g'">accompanying material</xsl:when> + <xsl:when test="@code='h'">translation</xsl:when> + </xsl:choose> + </xsl:attribute> + </xsl:if> + <languageTerm authority="rfc3066" type="code"> + <xsl:value-of select="$currentLanguage"/> + </languageTerm> + </language> + </xsl:if> + </xsl:when> + <xsl:otherwise> </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- tmee added 20100106 for 045$b BC and CE date range info --> + <xsl:template name="dates045b"> + <xsl:param name="str"/> + <xsl:variable name="first-char" select="substring($str,1,1)"/> + <xsl:choose> + <xsl:when test="$first-char ='c'"> + <xsl:value-of select="concat ('-', substring($str, 2))"/> + </xsl:when> + <xsl:when test="$first-char ='d'"> + <xsl:value-of select="substring($str, 2)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$str"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="scriptCode"> + <xsl:variable name="sf06" select="normalize-space(child::marc:subfield[@code='6'])"/> + <xsl:variable name="sf06a" select="substring($sf06, 1, 3)"/> + <xsl:variable name="sf06b" select="substring($sf06, 5, 2)"/> + <xsl:variable name="sf06c" select="substring($sf06, 7)"/> + <xsl:variable name="scriptCode" select="substring($sf06, 8, 2)"/> + <xsl:if test="//marc:datafield/marc:subfield[@code='6']"> + <xsl:attribute name="script"> + <xsl:choose> + <xsl:when test="$scriptCode=''">Latn</xsl:when> + <xsl:when test="$scriptCode='(3'">Arab</xsl:when> + <xsl:when test="$scriptCode='(4'">Arab</xsl:when> + <xsl:when test="$scriptCode='(B'">Latn</xsl:when> + <xsl:when test="$scriptCode='!E'">Latn</xsl:when> + <xsl:when test="$scriptCode='$1'">CJK</xsl:when> + <xsl:when test="$scriptCode='(N'">Cyrl</xsl:when> + <xsl:when test="$scriptCode='(Q'">Cyrl</xsl:when> + <xsl:when test="$scriptCode='(2'">Hebr</xsl:when> + <xsl:when test="$scriptCode='(S'">Grek</xsl:when> + </xsl:choose> + </xsl:attribute> + </xsl:if> + </xsl:template> + + <!-- tmee 20100927 for 880s & corresponding fields 20101123 scriptCode --> + + <xsl:template name="xxx880"> + <xsl:if test="child::marc:subfield[@code='6']"> + <xsl:variable name="sf06" select="normalize-space(child::marc:subfield[@code='6'])"/> + <xsl:variable name="sf06a" select="substring($sf06, 1, 3)"/> + <xsl:variable name="sf06b" select="substring($sf06, 5, 2)"/> + <xsl:variable name="sf06c" select="substring($sf06, 7)"/> + <xsl:variable name="scriptCode" select="substring($sf06, 8, 2)"/> + <xsl:if test="//marc:datafield/marc:subfield[@code='6']"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="$sf06b"/> + </xsl:attribute> + <xsl:attribute name="script"> + <xsl:choose> + <xsl:when test="$scriptCode=''">Latn</xsl:when> + <xsl:when test="$scriptCode='(3'">Arab</xsl:when> + <xsl:when test="$scriptCode='(4'">Arab</xsl:when> + <xsl:when test="$scriptCode='(B'">Latn</xsl:when> + <xsl:when test="$scriptCode='!E'">Latn</xsl:when> + <xsl:when test="$scriptCode='$1'">CJK</xsl:when> + <xsl:when test="$scriptCode='(N'">Cyrl</xsl:when> + <xsl:when test="$scriptCode='(Q'">Cyrl</xsl:when> + <xsl:when test="$scriptCode='(2'">Hebr</xsl:when> + <xsl:when test="$scriptCode='(S'">Grek</xsl:when> + </xsl:choose> + </xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:template> + + <xsl:template name="yyy880"> + <xsl:if test="preceding-sibling::marc:subfield[@code='6']"> + <xsl:variable name="sf06" select="normalize-space(preceding-sibling::marc:subfield[@code='6'])"/> + <xsl:variable name="sf06a" select="substring($sf06, 1, 3)"/> + <xsl:variable name="sf06b" select="substring($sf06, 5, 2)"/> + <xsl:variable name="sf06c" select="substring($sf06, 7)"/> + <xsl:if test="//marc:datafield/marc:subfield[@code='6']"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="$sf06b"/> + </xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:template> + + <xsl:template name="z2xx880"> + <!-- Evaluating the 260 field --> + <xsl:variable name="x260"> + <xsl:choose> + <xsl:when test="@tag='260' and marc:subfield[@code='6']"> + <xsl:variable name="sf06260" select="normalize-space(child::marc:subfield[@code='6'])"/> + <xsl:variable name="sf06260a" select="substring($sf06260, 1, 3)"/> + <xsl:variable name="sf06260b" select="substring($sf06260, 5, 2)"/> + <xsl:variable name="sf06260c" select="substring($sf06260, 7)"/> + <xsl:value-of select="$sf06260b"/> + </xsl:when> + <xsl:when test="@tag='250' and ../marc:datafield[@tag='260']/marc:subfield[@code='6']"> + <xsl:variable name="sf06260" select="normalize-space(../marc:datafield[@tag='260']/marc:subfield[@code='6'])"/> + <xsl:variable name="sf06260a" select="substring($sf06260, 1, 3)"/> + <xsl:variable name="sf06260b" select="substring($sf06260, 5, 2)"/> + <xsl:variable name="sf06260c" select="substring($sf06260, 7)"/> + <xsl:value-of select="$sf06260b"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="x250"> + <xsl:choose> + <xsl:when test="@tag='250' and marc:subfield[@code='6']"> + <xsl:variable name="sf06250" select="normalize-space(../marc:datafield[@tag='250']/marc:subfield[@code='6'])"/> + <xsl:variable name="sf06250a" select="substring($sf06250, 1, 3)"/> + <xsl:variable name="sf06250b" select="substring($sf06250, 5, 2)"/> + <xsl:variable name="sf06250c" select="substring($sf06250, 7)"/> + <xsl:value-of select="$sf06250b"/> + </xsl:when> + <xsl:when test="@tag='260' and ../marc:datafield[@tag='250']/marc:subfield[@code='6']"> + <xsl:variable name="sf06250" select="normalize-space(../marc:datafield[@tag='250']/marc:subfield[@code='6'])"/> + <xsl:variable name="sf06250a" select="substring($sf06250, 1, 3)"/> + <xsl:variable name="sf06250b" select="substring($sf06250, 5, 2)"/> + <xsl:variable name="sf06250c" select="substring($sf06250, 7)"/> + <xsl:value-of select="$sf06250b"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:choose> + <xsl:when test="$x250!='' and $x260!=''"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="concat($x250, $x260)"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$x250!=''"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="$x250"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$x260!=''"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="$x260"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="//marc:datafield/marc:subfield[@code='6']"> </xsl:if> + </xsl:template> + + <xsl:template name="z3xx880"> + <!-- Evaluating the 300 field --> + <xsl:variable name="x300"> + <xsl:choose> + <xsl:when test="@tag='300' and marc:subfield[@code='6']"> + <xsl:variable name="sf06300" select="normalize-space(child::marc:subfield[@code='6'])"/> + <xsl:variable name="sf06300a" select="substring($sf06300, 1, 3)"/> + <xsl:variable name="sf06300b" select="substring($sf06300, 5, 2)"/> + <xsl:variable name="sf06300c" select="substring($sf06300, 7)"/> + <xsl:value-of select="$sf06300b"/> + </xsl:when> + <xsl:when test="@tag='351' and ../marc:datafield[@tag='300']/marc:subfield[@code='6']"> + <xsl:variable name="sf06300" select="normalize-space(../marc:datafield[@tag='300']/marc:subfield[@code='6'])"/> + <xsl:variable name="sf06300a" select="substring($sf06300, 1, 3)"/> + <xsl:variable name="sf06300b" select="substring($sf06300, 5, 2)"/> + <xsl:variable name="sf06300c" select="substring($sf06300, 7)"/> + <xsl:value-of select="$sf06300b"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="x351"> + <xsl:choose> + <xsl:when test="@tag='351' and marc:subfield[@code='6']"> + <xsl:variable name="sf06351" select="normalize-space(../marc:datafield[@tag='351']/marc:subfield[@code='6'])"/> + <xsl:variable name="sf06351a" select="substring($sf06351, 1, 3)"/> + <xsl:variable name="sf06351b" select="substring($sf06351, 5, 2)"/> + <xsl:variable name="sf06351c" select="substring($sf06351, 7)"/> + <xsl:value-of select="$sf06351b"/> + </xsl:when> + <xsl:when test="@tag='300' and ../marc:datafield[@tag='351']/marc:subfield[@code='6']"> + <xsl:variable name="sf06351" select="normalize-space(../marc:datafield[@tag='351']/marc:subfield[@code='6'])"/> + <xsl:variable name="sf06351a" select="substring($sf06351, 1, 3)"/> + <xsl:variable name="sf06351b" select="substring($sf06351, 5, 2)"/> + <xsl:variable name="sf06351c" select="substring($sf06351, 7)"/> + <xsl:value-of select="$sf06351b"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="x337"> + <xsl:if test="@tag='337' and marc:subfield[@code='6']"> + <xsl:variable name="sf06337" select="normalize-space(child::marc:subfield[@code='6'])"/> + <xsl:variable name="sf06337a" select="substring($sf06337, 1, 3)"/> + <xsl:variable name="sf06337b" select="substring($sf06337, 5, 2)"/> + <xsl:variable name="sf06337c" select="substring($sf06337, 7)"/> + <xsl:value-of select="$sf06337b"/> + </xsl:if> + </xsl:variable> + <xsl:variable name="x338"> + <xsl:if test="@tag='338' and marc:subfield[@code='6']"> + <xsl:variable name="sf06338" select="normalize-space(child::marc:subfield[@code='6'])"/> + <xsl:variable name="sf06338a" select="substring($sf06338, 1, 3)"/> + <xsl:variable name="sf06338b" select="substring($sf06338, 5, 2)"/> + <xsl:variable name="sf06338c" select="substring($sf06338, 7)"/> + <xsl:value-of select="$sf06338b"/> + </xsl:if> + </xsl:variable> + + <xsl:choose> + <xsl:when test="$x351!='' and $x300!=''"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="concat($x351, $x300, $x337, $x338)"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$x351!=''"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="$x351"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$x300!=''"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="$x300"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$x337!=''"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="$x351"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$x338!=''"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="$x300"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="//marc:datafield/marc:subfield[@code='6']"> </xsl:if> + </xsl:template> + + + + <xsl:template name="true880"> + <xsl:variable name="sf06" select="normalize-space(marc:subfield[@code='6'])"/> + <xsl:variable name="sf06a" select="substring($sf06, 1, 3)"/> + <xsl:variable name="sf06b" select="substring($sf06, 5, 2)"/> + <xsl:variable name="sf06c" select="substring($sf06, 7)"/> + <xsl:if test="//marc:datafield/marc:subfield[@code='6']"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="$sf06b"/> + </xsl:attribute> + </xsl:if> + </xsl:template> + + <xsl:template match="marc:datafield" mode="trans880"> + <xsl:variable name="dataField880" select="//marc:datafield"/> + <xsl:variable name="sf06" select="normalize-space(marc:subfield[@code='6'])"/> + <xsl:variable name="sf06a" select="substring($sf06, 1, 3)"/> + <xsl:variable name="sf06b" select="substring($sf06, 4)"/> + <xsl:choose> + + <!--tranforms 880 equiv--> + + <xsl:when test="$sf06a='047'"> + <xsl:call-template name="createGenreFrom047"/> + </xsl:when> + <xsl:when test="$sf06a='336'"> + <xsl:call-template name="createGenreFrom336"/> + </xsl:when> + <xsl:when test="$sf06a='655'"> + <xsl:call-template name="createGenreFrom655"/> + </xsl:when> + + <xsl:when test="$sf06a='050'"> + <xsl:call-template name="createClassificationFrom050"/> + </xsl:when> + <xsl:when test="$sf06a='060'"> + <xsl:call-template name="createClassificationFrom060"/> + </xsl:when> + <xsl:when test="$sf06a='080'"> + <xsl:call-template name="createClassificationFrom080"/> + </xsl:when> + <xsl:when test="$sf06a='082'"> + <xsl:call-template name="createClassificationFrom082"/> + </xsl:when> + <xsl:when test="$sf06a='084'"> + <xsl:call-template name="createClassificationFrom080"/> + </xsl:when> + <xsl:when test="$sf06a='086'"> + <xsl:call-template name="createClassificationFrom082"/> + </xsl:when> + <xsl:when test="$sf06a='100'"> + <xsl:call-template name="createNameFrom100"/> + </xsl:when> + <xsl:when test="$sf06a='110'"> + <xsl:call-template name="createNameFrom110"/> + </xsl:when> + <xsl:when test="$sf06a='111'"> + <xsl:call-template name="createNameFrom110"/> + </xsl:when> + <xsl:when test="$sf06a='700'"> + <xsl:call-template name="createNameFrom700"/> + </xsl:when> + <xsl:when test="$sf06a='710'"> + <xsl:call-template name="createNameFrom710"/> + </xsl:when> + <xsl:when test="$sf06a='711'"> + <xsl:call-template name="createNameFrom710"/> + </xsl:when> + <xsl:when test="$sf06a='210'"> + <xsl:call-template name="createTitleInfoFrom210"/> + </xsl:when> + <xsl:when test="$sf06a='245'"> + <xsl:call-template name="createTitleInfoFrom245"/> + <xsl:call-template name="createNoteFrom245c"/> + </xsl:when> + <xsl:when test="$sf06a='246'"> + <xsl:call-template name="createTitleInfoFrom246"/> + </xsl:when> + <xsl:when test="$sf06a='240'"> + <xsl:call-template name="createTitleInfoFrom240"/> + </xsl:when> + <xsl:when test="$sf06a='740'"> + <xsl:call-template name="createTitleInfoFrom740"/> + </xsl:when> + + <xsl:when test="$sf06a='130'"> + <xsl:call-template name="createTitleInfoFrom130"/> + </xsl:when> + <xsl:when test="$sf06a='730'"> + <xsl:call-template name="createTitleInfoFrom730"/> + </xsl:when> + + <xsl:when test="$sf06a='505'"> + <xsl:call-template name="createTOCFrom505"/> + </xsl:when> + <xsl:when test="$sf06a='520'"> + <xsl:call-template name="createAbstractFrom520"/> + </xsl:when> + <xsl:when test="$sf06a='521'"> + <xsl:call-template name="createTargetAudienceFrom521"/> + </xsl:when> + <xsl:when test="$sf06a='506'"> + <xsl:call-template name="createAccessConditionFrom506"/> + </xsl:when> + <xsl:when test="$sf06a='540'"> + <xsl:call-template name="createAccessConditionFrom540"/> + </xsl:when> + + <!-- note 245 362 etc --> + + <xsl:when test="$sf06a='245'"> + <xsl:call-template name="createNoteFrom245c"/> + </xsl:when> + <xsl:when test="$sf06a='362'"> + <xsl:call-template name="createNoteFrom362"/> + </xsl:when> + <xsl:when test="$sf06a='502'"> + <xsl:call-template name="createNoteFrom502"/> + </xsl:when> + <xsl:when test="$sf06a='504'"> + <xsl:call-template name="createNoteFrom504"/> + </xsl:when> + <xsl:when test="$sf06a='508'"> + <xsl:call-template name="createNoteFrom508"/> + </xsl:when> + <xsl:when test="$sf06a='511'"> + <xsl:call-template name="createNoteFrom511"/> + </xsl:when> + <xsl:when test="$sf06a='515'"> + <xsl:call-template name="createNoteFrom515"/> + </xsl:when> + <xsl:when test="$sf06a='518'"> + <xsl:call-template name="createNoteFrom518"/> + </xsl:when> + <xsl:when test="$sf06a='524'"> + <xsl:call-template name="createNoteFrom524"/> + </xsl:when> + <xsl:when test="$sf06a='530'"> + <xsl:call-template name="createNoteFrom530"/> + </xsl:when> + <xsl:when test="$sf06a='533'"> + <xsl:call-template name="createNoteFrom533"/> + </xsl:when> + <!-- + <xsl:when test="$sf06a='534'"> + <xsl:call-template name="createNoteFrom534"/> + </xsl:when> +--> + <xsl:when test="$sf06a='535'"> + <xsl:call-template name="createNoteFrom535"/> + </xsl:when> + <xsl:when test="$sf06a='536'"> + <xsl:call-template name="createNoteFrom536"/> + </xsl:when> + <xsl:when test="$sf06a='538'"> + <xsl:call-template name="createNoteFrom538"/> + </xsl:when> + <xsl:when test="$sf06a='541'"> + <xsl:call-template name="createNoteFrom541"/> + </xsl:when> + <xsl:when test="$sf06a='545'"> + <xsl:call-template name="createNoteFrom545"/> + </xsl:when> + <xsl:when test="$sf06a='546'"> + <xsl:call-template name="createNoteFrom546"/> + </xsl:when> + <xsl:when test="$sf06a='561'"> + <xsl:call-template name="createNoteFrom561"/> + </xsl:when> + <xsl:when test="$sf06a='562'"> + <xsl:call-template name="createNoteFrom562"/> + </xsl:when> + <xsl:when test="$sf06a='581'"> + <xsl:call-template name="createNoteFrom581"/> + </xsl:when> + <xsl:when test="$sf06a='583'"> + <xsl:call-template name="createNoteFrom583"/> + </xsl:when> + <xsl:when test="$sf06a='585'"> + <xsl:call-template name="createNoteFrom585"/> + </xsl:when> + + <!-- note 5XX --> + + <xsl:when test="$sf06a='501'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='507'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='513'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='514'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='516'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='522'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='525'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='526'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='544'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='552'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='555'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='556'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='565'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='567'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='580'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='584'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='586'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + + <!-- subject 034 043 045 255 656 662 752 --> + + <xsl:when test="$sf06a='034'"> + <xsl:call-template name="createSubGeoFrom034"/> + </xsl:when> + <xsl:when test="$sf06a='043'"> + <xsl:call-template name="createSubGeoFrom043"/> + </xsl:when> + <xsl:when test="$sf06a='045'"> + <xsl:call-template name="createSubTemFrom045"/> + </xsl:when> + <xsl:when test="$sf06a='255'"> + <xsl:call-template name="createSubGeoFrom255"/> + </xsl:when> + + <xsl:when test="$sf06a='600'"> + <xsl:call-template name="createSubNameFrom600"/> + </xsl:when> + <xsl:when test="$sf06a='610'"> + <xsl:call-template name="createSubNameFrom610"/> + </xsl:when> + <xsl:when test="$sf06a='611'"> + <xsl:call-template name="createSubNameFrom611"/> + </xsl:when> + + <xsl:when test="$sf06a='630'"> + <xsl:call-template name="createSubTitleFrom630"/> + </xsl:when> + + <xsl:when test="$sf06a='648'"> + <xsl:call-template name="createSubChronFrom648"/> + </xsl:when> + <xsl:when test="$sf06a='650'"> + <xsl:call-template name="createSubTopFrom650"/> + </xsl:when> + <xsl:when test="$sf06a='651'"> + <xsl:call-template name="createSubGeoFrom651"/> + </xsl:when> + + + <xsl:when test="$sf06a='653'"> + <xsl:call-template name="createSubFrom653"/> + </xsl:when> + <xsl:when test="$sf06a='656'"> + <xsl:call-template name="createSubFrom656"/> + </xsl:when> + <xsl:when test="$sf06a='662'"> + <xsl:call-template name="createSubGeoFrom662752"/> + </xsl:when> + <xsl:when test="$sf06a='752'"> + <xsl:call-template name="createSubGeoFrom662752"/> + </xsl:when> + + <!-- location 852 856 --> + + <xsl:when test="$sf06a='852'"> + <xsl:call-template name="createLocationFrom852"/> + </xsl:when> + <xsl:when test="$sf06a='856'"> + <xsl:call-template name="createLocationFrom856"/> + </xsl:when> + + <xsl:when test="$sf06a='490'"> + <xsl:call-template name="createRelatedItemFrom490"/> + </xsl:when> + </xsl:choose> + </xsl:template> + + <!-- titleInfo 130 730 245 246 240 740 210 --> + + <!-- 130 tmee 1.101 20140806--> + <xsl:template name="createTitleInfoFrom130"> + + <titleInfo type="uniform"> + <title> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield"> + <xsl:if test="(contains('s',@code))"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:if test="(contains('adfklmors',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + + </xsl:template> + <xsl:template name="createTitleInfoFrom730"> + <titleInfo type="uniform"> + <title> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield"> + <xsl:if test="(contains('s',@code))"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:if test="(contains('adfklmors',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + </xsl:template> + + <xsl:template name="createTitleInfoFrom210"> + <titleInfo type="abbreviated"> + <xsl:if test="marc:datafield[@tag='210'][@ind2='2']"> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="xxx880"/> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">a</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="subtitle"/> + </titleInfo> + </xsl:template> + <!-- 1.79 --> + <xsl:template name="createTitleInfoFrom245"> + <titleInfo> + <xsl:call-template name="xxx880"/> + <xsl:variable name="title"> + <xsl:choose> + <xsl:when test="marc:subfield[@code='b']"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="axis">b</xsl:with-param> + <xsl:with-param name="beforeCodes">afgks</xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abfgks</xsl:with-param> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="titleChop"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="$title"/> + </xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="@ind2>0"> + <xsl:if test="@tag!='880'"> + <!-- 1.112 --> + <nonSort xml:space="preserve"><xsl:value-of select="substring($titleChop,1,@ind2)"/> </nonSort> + </xsl:if> + <title> + <xsl:value-of select="substring($titleChop,@ind2+1)"/> + </title> + </xsl:when> + <xsl:otherwise> + <title> + <xsl:value-of select="$titleChop"/> + </title> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="marc:subfield[@code='b']"> + <subTitle> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="axis">b</xsl:with-param> + <xsl:with-param name="anyCodes">b</xsl:with-param> + <xsl:with-param name="afterCodes">afgks</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </subTitle> + </xsl:if> + <xsl:call-template name="part"/> + </titleInfo> + </xsl:template> + + <xsl:template name="createTitleInfoFrom246"> + <titleInfo type="alternative"> + <xsl:call-template name="xxx880"/> + <xsl:for-each select="marc:subfield[@code='i']"> + <xsl:attribute name="displayLabel"> + <xsl:value-of select="text()"/> + </xsl:attribute> + </xsl:for-each> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <!-- 1/04 removed $h, $b --> + <xsl:with-param name="codes">af</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="subtitle"/> + <xsl:call-template name="part"/> + </titleInfo> + </xsl:template> + + <!-- 240 nameTitleGroup--> + <!-- 1.102 --> + + <xsl:template name="createTitleInfoFrom240"> + <titleInfo type="uniform"> + <xsl:if test="//marc:datafield[@tag='100']|//marc:datafield[@tag='110']|//marc:datafield[@tag='111']"> + <xsl:attribute name="nameTitleGroup"> + <xsl:text>1</xsl:text> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="xxx880"/> + <title> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield"> + <xsl:if test="(contains('adfklmors',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + </xsl:template> + + <xsl:template name="createTitleInfoFrom740"> + <titleInfo type="alternative"> + <xsl:call-template name="xxx880"/> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ah</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + </xsl:template> + + <!-- name 100 110 111 1.93 --> + + <xsl:template name="createNameFrom100"> + <xsl:if test="@ind1='0' or @ind1='1'"> + <name type="personal"> + <xsl:attribute name="usage"> + <xsl:text>primary</xsl:text> + </xsl:attribute> + <xsl:call-template name="xxx880"/> + <xsl:if test="//marc:datafield[@tag='240']"> + <xsl:attribute name="nameTitleGroup"> + <xsl:text>1</xsl:text> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="nameABCDQ"/> + <xsl:call-template name="affiliation"/> + <xsl:call-template name="role"/> + <!-- 1.116 --> + <xsl:call-template name="nameIdentifier"/> + </name> + </xsl:if> + <!-- 1.99 240 fix 20140804 --> + <xsl:if test="@ind1='3'"> + <name type="family"> + <xsl:attribute name="usage"> + <xsl:text>primary</xsl:text> + </xsl:attribute> + <xsl:call-template name="xxx880"/> + + <xsl:if test="ancestor::marcrecord//marc:datafield[@tag='240']"> + <xsl:attribute name="nameTitleGroup"> + <xsl:text>1</xsl:text> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="nameABCDQ"/> + <xsl:call-template name="affiliation"/> + <xsl:call-template name="role"/> + <!-- 1.116 --> + <xsl:call-template name="nameIdentifier"/> + </name> + </xsl:if> + </xsl:template> + + <xsl:template name="createNameFrom110"> + <name type="corporate"> + <xsl:call-template name="xxx880"/> + <xsl:if test="//marc:datafield[@tag='240']"> + <xsl:attribute name="nameTitleGroup"> + <xsl:text>1</xsl:text> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="nameABCDN"/> + <xsl:call-template name="role"/> + <!-- 1.116 --> + <xsl:call-template name="nameIdentifier"/> + </name> + </xsl:template> + + + <!-- 111 1.104 20141104 --> + + <xsl:template name="createNameFrom111"> + <name type="conference"> + <xsl:call-template name="xxx880"/> + <xsl:if test="//marc:datafield[@tag='240']"> + <xsl:attribute name="nameTitleGroup"> + <xsl:text>1</xsl:text> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="nameACDENQ"/> + <xsl:call-template name="role"/> + <!-- 1.116 --> + <xsl:call-template name="nameIdentifier"/> + </name> + </xsl:template> + + + + <!-- name 700 710 711 720 --> + + <xsl:template name="createNameFrom700"> + <xsl:if test="@ind1='0' or @ind1='1'"> + <name type="personal"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="nameABCDQ"/> + <xsl:call-template name="affiliation"/> + <xsl:call-template name="role"/> + <!-- 1.116 --> + <xsl:call-template name="nameIdentifier"/> + </name> + </xsl:if> + <xsl:if test="@ind1='3'"> + <name type="family"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="nameABCDQ"/> + <xsl:call-template name="affiliation"/> + <xsl:call-template name="role"/> + <!-- 1.116 --> + <xsl:call-template name="nameIdentifier"/> + </name> + </xsl:if> + </xsl:template> + + <xsl:template name="createNameFrom710"> + <!-- 1.117 --> + <name type="corporate"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="nameABCDN"/> + <xsl:call-template name="role"/> + <!-- 1.116 --> + <xsl:call-template name="nameIdentifier"/> + </name> + </xsl:template> + +<!-- 111 1.104 20141104 --> + <xsl:template name="createNameFrom711"> + <name type="conference"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="nameACDENQ"/> + <xsl:call-template name="role"/> + <!-- 1.116 --> + <xsl:call-template name="nameIdentifier"/> + </name> + </xsl:template> + + + <xsl:template name="createNameFrom720"> + <!-- 1.91 FLVC correction: the original if test will fail because of xpath: the current node (from the for-each above) is already the 720 datafield --> + <!-- <xsl:if test="marc:datafield[@tag='720'][not(marc:subfield[@code='t'])]"> --> + <xsl:if test="not(marc:subfield[@code='t'])"> + <name> + <xsl:if test="@ind1=1"> + <xsl:attribute name="type"> + <xsl:text>personal</xsl:text> + </xsl:attribute> + </xsl:if> + <namePart> + <xsl:value-of select="marc:subfield[@code='a']"/> + </namePart> + <xsl:call-template name="role"/> + </name> + </xsl:if> + </xsl:template> + + + + <!-- replced by above 1.91 + <xsl:template name="createNameFrom720"> + <xsl:if test="marc:datafield[@tag='720'][not(marc:subfield[@code='t'])]"> + <name> + <xsl:if test="@ind1=1"> + <xsl:attribute name="type"> + <xsl:text>personal</xsl:text> + </xsl:attribute> + </xsl:if> + <namePart> + <xsl:value-of select="marc:subfield[@code='a']"/> + </namePart> + <xsl:call-template name="role"/> + </name> + </xsl:if> + </xsl:template> + --> + + + <!-- genre 047 336 655 --> + + <xsl:template name="createGenreFrom047"> + <genre authority="marcgt"> + <!-- 1.111 --> + <xsl:choose> + <xsl:when test="@ind2 = ' '"> + <xsl:attribute name="authority"><xsl:text>marcmuscomp</xsl:text></xsl:attribute> + </xsl:when> + <xsl:when test="@ind2 = '7'"> + <xsl:if test="marc:subfield[@code='2']"> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:attribute> + </xsl:if> + </xsl:when> + </xsl:choose> + <xsl:attribute name="type"> + <xsl:text>musical composition</xsl:text> + </xsl:attribute> + <!-- Template checks for altRepGroup - 880 $6 --> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abcdef</xsl:with-param> + <xsl:with-param name="delimeter">-</xsl:with-param> + </xsl:call-template> + </genre> + </xsl:template> + + <xsl:template name="createGenreFrom336"> + <genre> + <!-- 1.110 --> + <xsl:if test="marc:subfield[@code='2']"> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:attribute> + </xsl:if> + <!-- Template checks for altRepGroup - 880 $6 --> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">a</xsl:with-param> + <xsl:with-param name="delimeter">-</xsl:with-param> + </xsl:call-template> + </genre> + + </xsl:template> + + <xsl:template name="createGenreFrom655"> + <genre authority="marcgt"> + <!-- 1.109 --> + <xsl:choose> + <xsl:when test="marc:subfield[@code='2']"> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="@ind2 != ' '"> + <xsl:attribute name="authority"> + <xsl:value-of select="@ind2"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <!-- Template checks for altRepGroup - 880 $6 --> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abvxyz</xsl:with-param> + <xsl:with-param name="delimeter">-</xsl:with-param> + </xsl:call-template> + </genre> + </xsl:template> + + <!-- tOC 505 --> + + <xsl:template name="createTOCFrom505"> + <tableOfContents> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">agrt</xsl:with-param> + </xsl:call-template> + </tableOfContents> + </xsl:template> + + <!-- abstract 520 --> + + <xsl:template name="createAbstractFrom520"> + <abstract> + <xsl:attribute name="type"> + <xsl:choose> + <xsl:when test="@ind1=' '">Summary</xsl:when> + <xsl:when test="@ind1='0'">Subject</xsl:when> + <xsl:when test="@ind1='1'">Review</xsl:when> + <xsl:when test="@ind1='2'">Scope and content</xsl:when> + <xsl:when test="@ind1='3'">Abstract</xsl:when> + <xsl:when test="@ind1='4'">Content advice</xsl:when> + </xsl:choose> + </xsl:attribute> + + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ab</xsl:with-param> + </xsl:call-template> + + </abstract> + </xsl:template> + + <!-- targetAudience 521 --> + + <xsl:template name="createTargetAudienceFrom521"> + <targetAudience> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ab</xsl:with-param> + </xsl:call-template> + </targetAudience> + </xsl:template> + + <!-- note 245c thru 585 --> + + + <!-- 1.100 245c 20140804 --> + <xsl:template name="createNoteFrom245c"> + <xsl:if test="marc:subfield[@code='c']"> + <note type="statement of responsibility"> + <xsl:attribute name="altRepGroup"> + <xsl:text>00</xsl:text> + </xsl:attribute> + <xsl:call-template name="scriptCode"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">c</xsl:with-param> + </xsl:call-template> + </note> + </xsl:if> + + </xsl:template> + + <xsl:template name="createNoteFrom362"> + <note type="date/sequential designation"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom500"> + <note> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:value-of select="marc:subfield[@code='a']"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom502"> + <note type="thesis"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom504"> + <note type="bibliography"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom508"> + <note type="creation/production credits"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='u' and @code!='3' and @code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom511"> + <note type="performers"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom515"> + <note type="numbering"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom518"> + <note type="venue"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='3' and @code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom524"> + <note type="preferred citation"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom530"> + <note type="additional physical form"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='u' and @code!='3' and @code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom533"> + <note type="reproduction"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <!-- tmee + <xsl:template name="createNoteFrom534"> + <note type="original version"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> +--> + + <xsl:template name="createNoteFrom535"> + <note type="original location"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom536"> + <note type="funding"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom538"> + <note type="system details"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom541"> + <note type="acquisition"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom545"> + <note type="biographical/historical"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom546"> + <note type="language"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom561"> + <note type="ownership"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom562"> + <note type="version identification"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom581"> + <note type="publications"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom583"> + <note type="action"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom585"> + <note type="exhibitions"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom5XX"> + <note> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <!-- subject Geo 034 043 045 255 656 662 752 --> + + <xsl:template name="createSubGeoFrom034"> + <xsl:if test="marc:datafield[@tag=034][marc:subfield[@code='d' or @code='e' or @code='f' or @code='g']]"> + <subject> + <xsl:call-template name="xxx880"/> + <cartographics> + <coordinates> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">defg</xsl:with-param> + </xsl:call-template> + </coordinates> + </cartographics> + </subject> + </xsl:if> + </xsl:template> + + <xsl:template name="createSubGeoFrom043"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']"> + <geographicCode> + <xsl:attribute name="authority"> + <xsl:if test="@code='a'"> + <xsl:text>marcgac</xsl:text> + </xsl:if> + <xsl:if test="@code='b'"> + <xsl:value-of select="following-sibling::marc:subfield[@code=2]"/> + </xsl:if> + <xsl:if test="@code='c'"> + <xsl:text>iso3166</xsl:text> + </xsl:if> + </xsl:attribute> + <xsl:value-of select="self::marc:subfield"/> + </geographicCode> + </xsl:for-each> + </subject> + </xsl:template> + + <xsl:template name="createSubGeoFrom255"> + <subject> + <xsl:call-template name="xxx880"/> + <cartographics> + <xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']"> + <xsl:if test="@code='a'"> + <scale> + <xsl:value-of select="."/> + </scale> + </xsl:if> + <xsl:if test="@code='b'"> + <projection> + <xsl:value-of select="."/> + </projection> + </xsl:if> + <xsl:if test="@code='c'"> + <coordinates> + <xsl:value-of select="."/> + </coordinates> + </xsl:if> + </xsl:for-each> + </cartographics> + </subject> + </xsl:template> + + <xsl:template name="createSubNameFrom600"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subjectAuthority"/> + <name type="personal"> + <namePart> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">aq</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </namePart> + <xsl:call-template name="termsOfAddress"/> + <xsl:call-template name="nameDate"/> + <xsl:call-template name="affiliation"/> + <xsl:call-template name="role"/> + </name> + <xsl:if test="marc:subfield[@code='t']"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">t</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + </xsl:if> + <xsl:call-template name="subjectAnyOrder"/> + </subject> + </xsl:template> + + <xsl:template name="createSubNameFrom610"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subjectAuthority"/> + <name type="corporate"> + <xsl:for-each select="marc:subfield[@code='a']"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='b']"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </xsl:for-each> + <xsl:if test="marc:subfield[@code='c' or @code='d' or @code='n' or @code='p']"> + <namePart> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">cdnp</xsl:with-param> + </xsl:call-template> + </namePart> + </xsl:if> + <xsl:call-template name="role"/> + </name> + <xsl:if test="marc:subfield[@code='t']"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">t</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + </xsl:if> + <xsl:call-template name="subjectAnyOrder"/> + </subject> + </xsl:template> + + <xsl:template name="createSubNameFrom611"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subjectAuthority"/> + <name type="conference"> + <namePart> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abcdeqnp</xsl:with-param> + </xsl:call-template> + </namePart> + <xsl:for-each select="marc:subfield[@code='4']"> + <role> + <roleTerm authority="marcrelator" type="code"> + <xsl:value-of select="."/> + </roleTerm> + </role> + </xsl:for-each> + </name> + <xsl:if test="marc:subfield[@code='t']"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">tpn</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + </xsl:if> + <xsl:call-template name="subjectAnyOrder"/> + </subject> + </xsl:template> + + <xsl:template name="createSubTitleFrom630"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subjectAuthority"/> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">adfhklor</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + <xsl:call-template name="subjectAnyOrder"/> + </subject> + </xsl:template> + + <xsl:template name="createSubChronFrom648"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:if test="marc:subfield[@code=2]"> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code=2]"/> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="uri"/> + <xsl:call-template name="subjectAuthority"/> + <temporal> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abcd</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </temporal> + <xsl:call-template name="subjectAnyOrder"/> + </subject> + </xsl:template> + + <xsl:template name="createSubTopFrom650"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subjectAuthority"/> + <topic> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abcd</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </topic> + <xsl:call-template name="subjectAnyOrder"/> + </subject> + </xsl:template> + + <xsl:template name="createSubGeoFrom651"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subjectAuthority"/> + <xsl:for-each select="marc:subfield[@code='a']"> + <geographic> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </geographic> + </xsl:for-each> + <xsl:call-template name="subjectAnyOrder"/> + </subject> + </xsl:template> + + <xsl:template name="createSubFrom653"> + + <xsl:if test="@ind2=' '"> + <subject> + <topic> + <xsl:value-of select="."/> + </topic> + </subject> + </xsl:if> + <xsl:if test="@ind2='0'"> + <subject> + <topic> + <xsl:value-of select="."/> + </topic> + </subject> + </xsl:if> +<!-- tmee 1.93 20140130 --> + <xsl:if test="@ind=' ' or @ind1='0' or @ind1='1'"> + <subject> + <name type="personal"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </name> + </subject> + </xsl:if> + <xsl:if test="@ind1='3'"> + <subject> + <name type="family"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </name> + </subject> + </xsl:if> + <xsl:if test="@ind2='2'"> + <subject> + <name type="corporate"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </name> + </subject> + </xsl:if> + <xsl:if test="@ind2='3'"> + <subject> + <name type="conference"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </name> + </subject> + </xsl:if> + <xsl:if test="@ind2=4"> + <subject> + <temporal> + <xsl:value-of select="."/> + </temporal> + </subject> + </xsl:if> + <xsl:if test="@ind2=5"> + <subject> + <geographic> + <xsl:value-of select="."/> + </geographic> + </subject> + </xsl:if> + + <xsl:if test="@ind2=6"> + <subject> + <genre> + <xsl:value-of select="."/> + </genre> + </subject> + </xsl:if> + </xsl:template> + + <xsl:template name="createSubFrom656"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:if test="marc:subfield[@code=2]"> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code=2]"/> + </xsl:attribute> + </xsl:if> + <occupation> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </xsl:with-param> + </xsl:call-template> + </occupation> + </subject> + </xsl:template> + + <xsl:template name="createSubGeoFrom662752"> + <subject> + <xsl:call-template name="xxx880"/> + <hierarchicalGeographic> + <!-- 1.113 --> + <xsl:if test="marc:subfield[@code='0']"> + <xsl:attribute name="valueURI"><xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute> + </xsl:if> + <xsl:for-each select="marc:subfield[@code='a']"> + <country> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </country> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='b']"> + <state> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </state> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='c']"> + <county> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </county> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='d']"> + <city> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </city> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='e']"> + <citySection> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </citySection> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='g']"> + <area> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </area> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='h']"> + <extraterrestrialArea> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </extraterrestrialArea> + </xsl:for-each> + </hierarchicalGeographic> + </subject> + </xsl:template> + + <xsl:template name="createSubTemFrom045"> + <xsl:if test="//marc:datafield[@tag=045 and @ind1='2'][marc:subfield[@code='b' or @code='c']]"> + <subject> + <xsl:call-template name="xxx880"/> + <temporal encoding="iso8601" point="start"> + <xsl:call-template name="dates045b"> + <xsl:with-param name="str" select="marc:subfield[@code='b' or @code='c'][1]"/> + </xsl:call-template> + </temporal> + <temporal encoding="iso8601" point="end"> + <xsl:call-template name="dates045b"> + <xsl:with-param name="str" select="marc:subfield[@code='b' or @code='c'][2]"/> + </xsl:call-template> + </temporal> + </subject> + </xsl:if> + </xsl:template> + + <!-- classification 050 060 080 082 084 086 --> + + <xsl:template name="createClassificationFrom050"> + <xsl:for-each select="marc:subfield[@code='b']"> + <classification authority="lcc"> + <xsl:call-template name="xxx880"/> + <xsl:if test="../marc:subfield[@code='3']"> + <xsl:attribute name="displayLabel"> + <xsl:value-of select="../marc:subfield[@code='3']"/> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="preceding-sibling::marc:subfield[@code='a'][1]"/> + <xsl:text> </xsl:text> + <xsl:value-of select="text()"/> + </classification> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='a'][not(following-sibling::marc:subfield[@code='b'])]"> + <classification authority="lcc"> + <xsl:call-template name="xxx880"/> + <xsl:if test="../marc:subfield[@code='3']"> + <xsl:attribute name="displayLabel"> + <xsl:value-of select="../marc:subfield[@code='3']"/> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="text()"/> + </classification> + </xsl:for-each> + </xsl:template> + <xsl:template name="createClassificationFrom060"> + <classification authority="nlm"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ab</xsl:with-param> + </xsl:call-template> + </classification> + </xsl:template> + <xsl:template name="createClassificationFrom080"> + <classification authority="udc"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abx</xsl:with-param> + </xsl:call-template> + </classification> + </xsl:template> + <xsl:template name="createClassificationFrom082"> + <classification authority="ddc"> + <xsl:call-template name="xxx880"/> + <xsl:if test="marc:subfield[@code='2']"> + <xsl:attribute name="edition"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ab</xsl:with-param> + </xsl:call-template> + </classification> + </xsl:template> + <xsl:template name="createClassificationFrom084"> + <classification> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:attribute> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ab</xsl:with-param> + </xsl:call-template> + </classification> + </xsl:template> + <xsl:template name="createClassificationFrom086"> + <xsl:for-each select="marc:datafield[@tag=086][@ind1=0]"> + <classification authority="sudocs"> + <xsl:call-template name="xxx880"/> + <xsl:value-of select="marc:subfield[@code='a']"/> + </classification> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=086][@ind1=1]"> + <classification authority="candoc"> + <xsl:call-template name="xxx880"/> + <xsl:value-of select="marc:subfield[@code='a']"/> + </classification> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=086][@ind1!=1 and @ind1!=0]"> + <classification> + <xsl:call-template name="xxx880"/> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:attribute> + <xsl:value-of select="marc:subfield[@code='a']"/> + </classification> + </xsl:for-each> + </xsl:template> + + <!-- identifier 020 024 022 028 010 037 UNDO Nov 23 2010 RG SM--> + + <!-- createRelatedItemFrom490 <xsl:for-each select="marc:datafield[@tag=490][@ind1=0]"> --> + + <xsl:template name="createRelatedItemFrom490"> + <relatedItem type="series"> + <xsl:call-template name="xxx880"/> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">av</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + </relatedItem> + </xsl:template> + + + <!-- location 852 856 --> + + <xsl:template name="createLocationFrom852"> + <location> + <xsl:if test="marc:subfield[@code='a' or @code='b' or @code='e']"> + <physicalLocation> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abe</xsl:with-param> + </xsl:call-template> + </physicalLocation> + </xsl:if> + <xsl:if test="marc:subfield[@code='u']"> + <physicalLocation> + <xsl:call-template name="uri"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">u</xsl:with-param> + </xsl:call-template> + </physicalLocation> + </xsl:if> + <!-- 1.78 --> + <xsl:if test="marc:subfield[@code='h' or @code='i' or @code='j' or @code='k' or @code='l' or @code='m' or @code='t']"> + <shelfLocator> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">hijklmt</xsl:with-param> + </xsl:call-template> + </shelfLocator> + </xsl:if> + <!-- 1.114 --> + <xsl:if test="marc:subfield[@code='p' or @code='t']"> + <holdingSimple> + <copyInformation> + <xsl:for-each select="marc:subfield[@code='p']|marc:subfield[@code='t']"> + <itemIdentifier> + <xsl:if test="@code='t'"> + <xsl:attribute name="type"><xsl:text>copy number</xsl:text></xsl:attribute> + </xsl:if> + <xsl:apply-templates select="."/> + </itemIdentifier> + </xsl:for-each> + </copyInformation> + </holdingSimple> + </xsl:if> + </location> + </xsl:template> + + <xsl:template name="createLocationFrom856"> + <xsl:if test="//marc:datafield[@tag=856][@ind2!=2][marc:subfield[@code='u']]"> + <location> + <url displayLabel="electronic resource"> + <!-- 1.41 tmee AQ1.9 added choice protocol for @usage="primary display" --> + <xsl:variable name="primary"> + <xsl:choose> + <xsl:when test="@ind2=0 and count(preceding-sibling::marc:datafield[@tag=856] [@ind2=0])=0">true</xsl:when> + + <xsl:when test="@ind2=1 and count(ancestor::marc:record//marc:datafield[@tag=856][@ind2=0])=0 and count(preceding-sibling::marc:datafield[@tag=856][@ind2=1])=0">true</xsl:when> + + <xsl:when test="@ind2!=1 and @ind2!=0 and @ind2!=2 and count(ancestor::marc:record//marc:datafield[@tag=856 and @ind2=0])=0 and count(ancestor::marc:record//marc:datafield[@tag=856 and @ind2=1])=0 and count(preceding-sibling::marc:datafield[@tag=856][@ind2])=0">true</xsl:when> + <xsl:otherwise>false</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$primary='true'"> + <xsl:attribute name="usage">primary display</xsl:attribute> + </xsl:if> + + <xsl:if test="marc:subfield[@code='y' or @code='3']"> + <xsl:attribute name="displayLabel"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">y3</xsl:with-param> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="marc:subfield[@code='z']"> + <xsl:attribute name="note"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">z</xsl:with-param> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="marc:subfield[@code='u']"/> + </url> + </location> + </xsl:if> + </xsl:template> + + <!-- accessCondition 506 540 1.87 20130829--> + + <xsl:template name="createAccessConditionFrom506"> + <accessCondition type="restriction on access"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abcd35</xsl:with-param> + </xsl:call-template> + </accessCondition> + </xsl:template> + + <xsl:template name="createAccessConditionFrom540"> + <accessCondition type="use and reproduction"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abcde35</xsl:with-param> + </xsl:call-template> + </accessCondition> + </xsl:template> + + <!-- recordInfo 040 005 001 003 --> + + <!-- 880 global copy template --> + <xsl:template match="* | @*" mode="global_copy"> + <xsl:copy> + <xsl:apply-templates select="* | @* | text()" mode="global_copy"/> + </xsl:copy> + </xsl:template> + +</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2005. Progress Software Corporation. All rights reserved. +<metaInformation> +<scenarios/><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/><MapperBlockPosition></MapperBlockPosition><TemplateContext></TemplateContext></MapperMetaTag> +</metaInformation> +--> \ No newline at end of file diff --git a/xsl/MARC21slim2MODS3-6.xsl b/xsl/MARC21slim2MODS3-6.xsl new file mode 100644 index 0000000000000000000000000000000000000000..72ff47710358e994ad1aa54b73b8e74e957948c6 --- /dev/null +++ b/xsl/MARC21slim2MODS3-6.xsl @@ -0,0 +1,5714 @@ +<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"> + <xsl:include href="http://www.loc.gov/standards/marcxml/xslt/MARC21slimUtils.xsl"/> + <xsl:output encoding="UTF-8" indent="yes" method="xml"/> + <xsl:strip-space elements="*"/> + + <!-- Maintenance note: For each revision, change the content of <recordInfo><recordOrigin> to reflect the new revision number. + MARC21slim2MODS3-6 + + MODS 3.6 (Revision 1.119) 20180621 + + Revision 1.119 - Fixed 700 ind1=0 to transform - tmee 2018/06/21 + Revision 1.118 - Fixed namePart termsOfAddress subelement order - 2018/01/31 tmee + Revision 1.117 - Fixed name type="corporate" RE: MODS 3.6 - 2017/2/14 ntra + Revision 1.116 - Added nameIdentifier to 700/710/711/100/110/111 $0 RE: MODS 3.6 - 2016/3/15 ws + Revision 1.115 - Added @otherType for 7xx RE: MODS 3.6 - 2016/3/15 ws + Revision 1.114 - Added <itemIdentifier> for 852$p and <itemIdentifier > with type="copy number" for 852$t RE: MODS 3.6 - 2016/3/15 ws + Revision 1.113 - Added @valueURI="contents of $0" for 752/662 RE: MODS 3.6 - 2016/3/15 ws + Revision 1.112 - Added @xml:space="preserve" to title/nonSort on 245 and 242 RE: MODS 3.6 - 2016/3/15 ws + + Revision 1.111 - Added test to prevent empty authority attribute for 047 with no subfield 2. - ws 2016/03/24 + Revision 1.110 - Added test to prevent empty authority attribute for 336 with no subfield 2. - ws 2016/03/24 + Revision 1.109 - Added test to prevent empty authority attribute for 655 and use if ind2 if no subfield 2 is available. - ws 2016/03/24 + Revision 1.108 - Added filter to name templates to exclude names with title subfields. - ws 2016/03/24 + + Revision 1.107 - Added support for 024/@ind1=7 - ws 2016/1/7 + Revision 1.106 - Added a xsl:when to deal with '#' and ' ' in $leader19 and $controlField008-18 - ws 2014/12/19 + Revision 1.105 - Add @unit to extent - ws 2014/11/20 + Revision 1.104 - Fixed 111$n and 711$n to reflect mapping to <namePart> tmee 20141112 + Revision 1.103 - Fixed 008/28 to reflect revised mapping for government publication tmee 20141104 + Revision 1.102 - Fixed 240$s duplication tmee 20140812 + Revision 1.101 - Fixed 130 tmee 20140806 + Revision 1.100 - Fixed 245c tmee 20140804 + Revision 1.99 - Fixed 240 issue tmee 20140804 + Revision 1.98 - Fixed 336 mapping tmee 20140522 + Revision 1.97 - Fixed 264 mapping tmee 20140521 + Revision 1.96 - Fixed 310 and 321 and 008 frequency authority for marcfrequency tmee 2014/04/22 + Revision 1.95 - Modified 035 to include identifier type (WlCaITV) tmee 2014/04/21 + Revision 1.94 - Leader 07 b changed mapping from continuing to serial tmee 2014/02/21 + + MODS 3.5 + Revision 1.93 - Fixed personal name transform for ind1=0 tmee 2014/01/31 + Revision 1.92 - Removed duplicate code for 856 1.51 tmee 2014/01/31 + Revision 1.91 - Fixed createnameFrom720 duplication tmee 2014/01/31 + Revision 1.90 - Fixed 520 displayLabel tmee tmee 2014/01/31 + Revision 1.89 - Fixed 008-06 when value = 's' for cartographics tmee tmee 2014/01/31 + Revision 1.88 - Fixed 510c mapping - tmee 2013/08/29 + Revision 1.87 - Fixed expressions of <accessCondition> type values - tmee 2013/08/29 + Revision 1.86 - Fixed 008 <frequency> subfield to occur w/i <originiInfo> - tmee 2013/08/29 + Revision 1.85 - Fixed 245$c - tmee 2013/03/07 + Revision 1.84 - Fixed 1.35 and 1.36 date mapping for 008 when 008/06=e,p,r,s,t so only 008/07-10 displays, rather than 008/07-14 - tmee 2013/02/01 + Revision 1.83 - Deleted mapping for 534 to note - tmee 2013/01/18 + Revision 1.82 - Added mapping for 264 ind 0,1,2,3 to originInfo - 2013/01/15 tmee + Revision 1.81 - Added mapping for 336$a$2, 337$a$2, 338$a$2 - 2012/12/03 tmee + Revision 1.80 - Added 100/700 mapping for "family" - 2012/09/10 tmee + Revision 1.79 - Added 245 $s mapping - 2012/07/11 tmee + Revision 1.78 - Fixed 852 mapping <shelfLocation> was changed to <shelfLocator> - 2012/05/07 tmee + Revision 1.77 - Fixed 008-06 when value = 's' - 2012/04/19 tmee + Revision 1.76 - Fixed 242 - 2012/02/01 tmee + Revision 1.75 - Fixed 653 - 2012/01/31 tmee + Revision 1.74 - Fixed 510 note - 2011/07/15 tmee + Revision 1.73 - Fixed 506 540 - 2011/07/11 tmee + Revision 1.72 - Fixed frequency error - 2011/07/07 and 2011/07/14 tmee + Revision 1.71 - Fixed subject titles for subfields t - 2011/04/26 tmee + Revision 1.70 - Added mapping for OCLC numbers in 035s to go into <identifier type="oclc"> 2011/02/27 - tmee + Revision 1.69 - Added mapping for untyped identifiers for 024 - 2011/02/27 tmee + Revision 1.68 - Added <subject><titleInfo> mapping for 600/610/611 subfields t,p,n - 2010/12/22 tmee + Revision 1.67 - Added frequency values and authority="marcfrequency" for 008/18 - 2010/12/09 tmee + Revision 1.66 - Fixed 008/06=c,d,i,m,k,u, from dateCreated to dateIssued - 2010/12/06 tmee + Revision 1.65 - Added back marcsmd and marccategory for 007 cr- 2010/12/06 tmee + Revision 1.64 - Fixed identifiers - removed isInvalid template - 2010/12/06 tmee + Revision 1.63 - Fixed descriptiveStandard value from aacr2 to aacr - 2010/12/06 tmee + Revision 1.62 - Fixed date mapping for 008/06=e,p,r,s,t - 2010/12/01 tmee + Revision 1.61 - Added 007 mappings for marccategory - 2010/11/12 tmee + Revision 1.60 - Added altRepGroups and 880 linkages for relevant fields, see mapping - 2010/11/26 tmee + Revision 1.59 - Added scriptTerm type=text to language for 546b and 066c - 2010/09/23 tmee + Revision 1.58 - Expanded script template to include code conversions for extended scripts - 2010/09/22 tmee + Revision 1.57 - Added Ldr/07 and Ldr/19 mappings - 2010/09/17 tmee + Revision 1.56 - Mapped 1xx usage="primary" - 2010/09/17 tmee + Revision 1.55 - Mapped UT 240/1xx nameTitleGroup - 2010/09/17 tmee + MODS 3.4 + Revision 1.54 - Fixed 086 redundancy - 2010/07/27 tmee + Revision 1.53 - Added direct href for MARC21slimUtils - 2010/07/27 tmee + Revision 1.52 - Mapped 046 subfields c,e,k,l - 2010/04/09 tmee + Revision 1.51 - Corrected 856 transform - 2010/01/29 tmee + Revision 1.50 - Added 210 $2 authority attribute in <titleInfo type=”abbreviated”> 2009/11/23 tmee + Revision 1.49 - Aquifer revision 1.14 - Added 240s (version) data to <titleInfo type="uniform"><title> 2009/11/23 tmee + Revision 1.48 - Aquifer revision 1.27 - Added mapping of 242 second indicator (for nonfiling characters) to <titleInfo><nonSort > subelement 2007/08/08 tmee/dlf + Revision 1.47 - Aquifer revision 1.26 - Mapped 300 subfield f (type of unit) - and g (size of unit) 2009 ntra + Revision 1.46 - Aquifer revision 1.25 - Changed mapping of 767 so that <type="otherVersion> 2009/11/20 tmee + Revision 1.45 - Aquifer revision 1.24 - Changed mapping of 765 so that <type="otherVersion> 2009/11/20 tmee + Revision 1.44 - Added <recordInfo><recordOrigin> canned text about the version of this stylesheet 2009 ntra + Revision 1.43 - Mapped 351 subfields a,b,c 2009/11/20 tmee + Revision 1.42 - Changed 856 second indicator=1 to go to <location><url displayLabel=”electronic resource”> instead of to <relatedItem type=”otherVersion”><url> 2009/11/20 tmee + Revision 1.41 - Aquifer revision 1.9 Added variable and choice protocol for adding usage=”primary display” 2009/11/19 tmee + Revision 1.40 - Dropped <note> for 510 and added <relatedItem type="isReferencedBy"> for 510 2009/11/19 tmee + Revision 1.39 - Aquifer revision 1.23 Changed mapping for 762 (Subseries Entry) from <relatedItem type="series"> to <relatedItem type="constituent"> 2009/11/19 tmee + Revision 1.38 - Aquifer revision 1.29 Dropped 007s for electronic versions 2009/11/18 tmee + Revision 1.37 - Fixed date redundancy in output (with questionable dates) 2009/11/16 tmee + Revision 1.36 - If mss material (Ldr/06=d,p,f,t) map 008 dates and 260$c/$g dates to dateCreated 2009/11/24, otherwise map 008 and 260$c/$g to dateIssued 2010/01/08 tmee + Revision 1.35 - Mapped appended detailed dates from 008/07-10 and 008/11-14 to dateIssued or DateCreated w/encoding="marc" 2010/01/12 tmee + Revision 1.34 - Mapped 045b B.C. and C.E. date range info to iso8601-compliant dates in <subject><temporal> 2009/01/08 ntra + Revision 1.33 - Mapped Ldr/06 "o" to <typeOfResource>kit 2009/11/16 tmee + Revision 1.32 - Mapped specific note types from the MODS Note Type list <http://www.loc.gov/standards/mods/mods-notes.html> tmee 2009/11/17 + Revision 1.31 - Mapped 540 to <accessCondition type="use and reproduction"> and 506 to <accessCondition type="restriction on access"> and delete mappings of 540 and 506 to <note> + Revision 1.30 - Mapped 037c to <identifier displayLabel=""> 2009/11/13 tmee + Revision 1.29 - Corrected schemaLocation to 3.3 2009/11/13 tmee + Revision 1.28 - Changed mapping from 752,662 g going to mods:hierarchicalGeographic/area instead of "region" 2009/07/30 ntra + Revision 1.27 - Mapped 648 to <subject> 2009/03/13 tmee + Revision 1.26 - Added subfield $s mapping for 130/240/730 2008/10/16 tmee + Revision 1.25 - Mapped 040e to <descriptiveStandard> and Leader/18 to <descriptive standard>aacr2 2008/09/18 tmee + 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 + 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 + 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 + Revision 1.21 - Mapped 856 ind2=1 or ind2=2 to <relatedItem><location><url> 2008/07/03 tmee + Revision 1.20 - Added genre w/@auth="contents of 2" and type= "musical composition" 2008/07/01 tmee + Revision 1.19 - Added genre offprint for 008/24+ BK code 2 2008/07/01 tmee + Revision 1.18 - Added xlink/uri for subfield 0 for 130/240/730, 100/700, 110/710, 111/711 2008/06/26 tmee + Revision 1.17 - Added mapping of 662 2008/05/14 tmee + Revision 1.16 - Changed @authority from "marc" to "marcgt" for 007 and 008 codes mapped to a term in <genre> 2007/07/10 tmee + Revision 1.15 - For field 630, moved call to part template outside title element 2007/07/10 tmee + 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 + Revision 1.13 - Changed order of output under cartographics to reflect schema 2006/11/28 tmee + Revision 1.12 - Updated to reflect MODS 3.2 Mapping 2006/10/11 tmee + Revision 1.11 - The attribute objectPart moved from <languageTerm> to <language> 2006/04/08 jrad + 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 + Revision 1.09 - Subfield $y was added to field 242 2004/09/02 10:57 jrad + Revision 1.08 - Subject chopPunctuation expanded and attribute fixes 2004/08/12 jrad + Revision 1.07 - 2004/03/25 08:29 jrad + Revision 1.06 - Various validation fixes 2004/02/20 ntra + Revision 1.05 - MODS2 to MODS3 updates, language unstacking and de-duping, chopPunctuation expanded 2003/10/02 16:18:58 ntra + Revision 1.03 - Additional Changes not related to MODS Version 2.0 by ntra + Revision 1.02 - Added Log Comment 2003/03/24 19:37:42 ckeith + --> + + <xsl:template match="/"> + <xsl:choose> + <xsl:when test="//marc:collection"> + <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-6.xsd"> + <xsl:for-each select="//marc:collection/marc:record"> + <mods version="3.6"> + <xsl:call-template name="marcRecord"/> + </mods> + </xsl:for-each> + </modsCollection> + </xsl:when> + <xsl:otherwise> + <mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.6" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-6.xsd"> + <xsl:for-each select="//marc:record"> + <xsl:call-template name="marcRecord"/> + </xsl:for-each> + </mods> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="marcRecord"> + <xsl:variable name="leader" select="marc:leader"/> + <xsl:variable name="leader6" select="substring($leader,7,1)"/> + <xsl:variable name="leader7" select="substring($leader,8,1)"/> + <xsl:variable name="leader19" select="substring($leader,20,1)"/> + <xsl:variable name="controlField008" select="marc:controlfield[@tag='008']"/> + <xsl:variable name="typeOf008"> + <xsl:choose> + <xsl:when test="$leader6='a'"> + <xsl:choose> + <xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when> + <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">SE</xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test="$leader6='t'">BK</xsl:when> + <xsl:when test="$leader6='p'">MM</xsl:when> + <xsl:when test="$leader6='m'">CF</xsl:when> + <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when> + <xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">VM</xsl:when> + <xsl:when test="$leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'">MU</xsl:when> + </xsl:choose> + </xsl:variable> + + <!-- titleInfo --> + + <xsl:for-each select="marc:datafield[@tag='245']"> + <xsl:call-template name="createTitleInfoFrom245"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='210']"> + <xsl:call-template name="createTitleInfoFrom210"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='246']"> + <xsl:call-template name="createTitleInfoFrom246"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='240']"> + <xsl:call-template name="createTitleInfoFrom240"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='740']"> + <xsl:call-template name="createTitleInfoFrom740"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='130']"> + <xsl:call-template name="createTitleInfoFrom130"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='730']"> + <xsl:call-template name="createTitleInfoFrom730"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='242']"> + <titleInfo type="translated"> + <!--09/01/04 Added subfield $y--> + <xsl:for-each select="marc:subfield[@code='y']"> + <xsl:attribute name="lang"> + <xsl:value-of select="text()"/> + </xsl:attribute> + </xsl:for-each> + + <!-- AQ1.27 tmee/dlf --> + <xsl:variable name="title"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <!-- 1/04 removed $h, b --> + <xsl:with-param name="codes">a</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="titleChop"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="$title"/> + </xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="@ind2>0"> + <!-- 1.112 --> + <nonSort xml:space="preserve"><xsl:value-of select="substring($titleChop,1,@ind2)"/> </nonSort> + <title> + <xsl:value-of select="substring($titleChop,@ind2+1)"/> + </title> + </xsl:when> + <xsl:otherwise> + <title> + <xsl:value-of select="$titleChop"/> + </title> + </xsl:otherwise> + </xsl:choose> + + <!-- 1/04 fix --> + <xsl:call-template name="subtitle"/> + <xsl:call-template name="part"/> + </titleInfo> + </xsl:for-each> + + <!-- name --> + <!-- 1.108 --> + <xsl:for-each select="marc:datafield[@tag='100'][not(marc:subfield[@code='t'])]"> + <xsl:call-template name="createNameFrom100"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='110'][not(marc:subfield[@code='t'])]"> + <xsl:call-template name="createNameFrom110"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='111'][not(marc:subfield[@code='t'])]"> + <xsl:call-template name="createNameFrom111"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='700'][not(marc:subfield[@code='t'])]"> + <xsl:call-template name="createNameFrom700"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='710'][not(marc:subfield[@code='t'])]"> + <xsl:call-template name="createNameFrom710"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='711'][not(marc:subfield[@code='t'])]"> + <xsl:call-template name="createNameFrom711"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='720'][not(marc:subfield[@code='t'])]"> + <xsl:call-template name="createNameFrom720"/> + </xsl:for-each> + + <!--old 7XXs + <xsl:for-each select="marc:datafield[@tag='700'][not(marc:subfield[@code='t'])]"> + <name type="personal"> + <xsl:call-template name="nameABCDQ"/> + <xsl:call-template name="affiliation"/> + <xsl:call-template name="role"/> + </name> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='710'][not(marc:subfield[@code='t'])]"> + <name type="corporate"> + <xsl:call-template name="nameABCDN"/> + <xsl:call-template name="role"/> + </name> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='711'][not(marc:subfield[@code='t'])]"> + <name type="conference"> + <xsl:call-template name="nameACDEQ"/> + <xsl:call-template name="role"/> + </name> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='720'][not(marc:subfield[@code='t'])]"> + <name> + <xsl:if test="@ind1=1"> + <xsl:attribute name="type"> + <xsl:text>personal</xsl:text> + </xsl:attribute> + </xsl:if> + <namePart> + <xsl:value-of select="marc:subfield[@code='a']"/> + </namePart> + <xsl:call-template name="role"/> + </name> + </xsl:for-each> +--> + + <typeOfResource> + <xsl:if test="$leader7='c'"> + <xsl:attribute name="collection">yes</xsl:attribute> + </xsl:if> + <xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'"> + <xsl:attribute name="manuscript">yes</xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="$leader6='a' or $leader6='t'">text</xsl:when> + <xsl:when test="$leader6='e' or $leader6='f'">cartographic</xsl:when> + <xsl:when test="$leader6='c' or $leader6='d'">notated music</xsl:when> + <xsl:when test="$leader6='i'">sound recording-nonmusical</xsl:when> + <xsl:when test="$leader6='j'">sound recording-musical</xsl:when> + <xsl:when test="$leader6='k'">still image</xsl:when> + <xsl:when test="$leader6='g'">moving image</xsl:when> + <xsl:when test="$leader6='r'">three dimensional object</xsl:when> + <xsl:when test="$leader6='m'">software, multimedia</xsl:when> + <xsl:when test="$leader6='p'">mixed material</xsl:when> + </xsl:choose> + </typeOfResource> + <xsl:if test="substring($controlField008,26,1)='d'"> + <genre authority="marcgt">globe</genre> + </xsl:if> + <xsl:if test="marc:controlfield[@tag='007'][substring(text(),1,1)='a'][substring(text(),2,1)='r']"> + <genre authority="marcgt">remote-sensing image</genre> + </xsl:if> + <xsl:if test="$typeOf008='MP'"> + <xsl:variable name="controlField008-25" select="substring($controlField008,26,1)"/> + <xsl:choose> + <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']"> + <genre authority="marcgt">map</genre> + </xsl:when> + <xsl:when test="$controlField008-25='e' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']"> + <genre authority="marcgt">atlas</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$typeOf008='SE'"> + <xsl:variable name="controlField008-21" select="substring($controlField008,22,1)"/> + <xsl:choose> + <xsl:when test="$controlField008-21='d'"> + <genre authority="marcgt">database</genre> + </xsl:when> + <xsl:when test="$controlField008-21='l'"> + <genre authority="marcgt">loose-leaf</genre> + </xsl:when> + <xsl:when test="$controlField008-21='m'"> + <genre authority="marcgt">series</genre> + </xsl:when> + <xsl:when test="$controlField008-21='n'"> + <genre authority="marcgt">newspaper</genre> + </xsl:when> + <xsl:when test="$controlField008-21='p'"> + <genre authority="marcgt">periodical</genre> + </xsl:when> + <xsl:when test="$controlField008-21='w'"> + <genre authority="marcgt">web site</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$typeOf008='BK' or $typeOf008='SE'"> + <xsl:variable name="controlField008-24" select="substring($controlField008,25,4)"/> + <xsl:choose> + <xsl:when test="contains($controlField008-24,'a')"> + <genre authority="marcgt">abstract or summary</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'b')"> + <genre authority="marcgt">bibliography</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'c')"> + <genre authority="marcgt">catalog</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'d')"> + <genre authority="marcgt">dictionary</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'e')"> + <genre authority="marcgt">encyclopedia</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'f')"> + <genre authority="marcgt">handbook</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'g')"> + <genre authority="marcgt">legal article</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'i')"> + <genre authority="marcgt">index</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'k')"> + <genre authority="marcgt">discography</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'l')"> + <genre authority="marcgt">legislation</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'m')"> + <genre authority="marcgt">theses</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'n')"> + <genre authority="marcgt">survey of literature</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'o')"> + <genre authority="marcgt">review</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'p')"> + <genre authority="marcgt">programmed text</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'q')"> + <genre authority="marcgt">filmography</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'r')"> + <genre authority="marcgt">directory</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'s')"> + <genre authority="marcgt">statistics</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'t')"> + <genre authority="marcgt">technical report</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'v')"> + <genre authority="marcgt">legal case and case notes</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'w')"> + <genre authority="marcgt">law report or digest</genre> + </xsl:when> + <xsl:when test="contains($controlField008-24,'z')"> + <genre authority="marcgt">treaty</genre> + </xsl:when> + </xsl:choose> + <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/> + <xsl:choose> + <xsl:when test="$controlField008-29='1'"> + <genre authority="marcgt">conference publication</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$typeOf008='CF'"> + <xsl:variable name="controlField008-26" select="substring($controlField008,27,1)"/> + <xsl:choose> + <xsl:when test="$controlField008-26='a'"> + <genre authority="marcgt">numeric data</genre> + </xsl:when> + <xsl:when test="$controlField008-26='e'"> + <genre authority="marcgt">database</genre> + </xsl:when> + <xsl:when test="$controlField008-26='f'"> + <genre authority="marcgt">font</genre> + </xsl:when> + <xsl:when test="$controlField008-26='g'"> + <genre authority="marcgt">game</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$typeOf008='BK'"> + <xsl:if test="substring($controlField008,25,1)='j'"> + <genre authority="marcgt">patent</genre> + </xsl:if> + <xsl:if test="substring($controlField008,25,1)='2'"> + <genre authority="marcgt">offprint</genre> + </xsl:if> + <xsl:if test="substring($controlField008,31,1)='1'"> + <genre authority="marcgt">festschrift</genre> + </xsl:if> + <xsl:variable name="controlField008-34" select="substring($controlField008,35,1)"/> + <xsl:if test="$controlField008-34='a' or $controlField008-34='b' or $controlField008-34='c' or $controlField008-34='d'"> + <genre authority="marcgt">biography</genre> + </xsl:if> + <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/> + <xsl:choose> + <xsl:when test="$controlField008-33='e'"> + <genre authority="marcgt">essay</genre> + </xsl:when> + <xsl:when test="$controlField008-33='d'"> + <genre authority="marcgt">drama</genre> + </xsl:when> + <xsl:when test="$controlField008-33='c'"> + <genre authority="marcgt">comic strip</genre> + </xsl:when> + <xsl:when test="$controlField008-33='l'"> + <genre authority="marcgt">fiction</genre> + </xsl:when> + <xsl:when test="$controlField008-33='h'"> + <genre authority="marcgt">humor, satire</genre> + </xsl:when> + <xsl:when test="$controlField008-33='i'"> + <genre authority="marcgt">letter</genre> + </xsl:when> + <xsl:when test="$controlField008-33='f'"> + <genre authority="marcgt">novel</genre> + </xsl:when> + <xsl:when test="$controlField008-33='j'"> + <genre authority="marcgt">short story</genre> + </xsl:when> + <xsl:when test="$controlField008-33='s'"> + <genre authority="marcgt">speech</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$typeOf008='MU'"> + <xsl:variable name="controlField008-30-31" select="substring($controlField008,31,2)"/> + <xsl:if test="contains($controlField008-30-31,'b')"> + <genre authority="marcgt">biography</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'c')"> + <genre authority="marcgt">conference publication</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'d')"> + <genre authority="marcgt">drama</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'e')"> + <genre authority="marcgt">essay</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'f')"> + <genre authority="marcgt">fiction</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'o')"> + <genre authority="marcgt">folktale</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'h')"> + <genre authority="marcgt">history</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'k')"> + <genre authority="marcgt">humor, satire</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'m')"> + <genre authority="marcgt">memoir</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'p')"> + <genre authority="marcgt">poetry</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'r')"> + <genre authority="marcgt">rehearsal</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'g')"> + <genre authority="marcgt">reporting</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'s')"> + <genre authority="marcgt">sound</genre> + </xsl:if> + <xsl:if test="contains($controlField008-30-31,'l')"> + <genre authority="marcgt">speech</genre> + </xsl:if> + </xsl:if> + <xsl:if test="$typeOf008='VM'"> + <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/> + <xsl:choose> + <xsl:when test="$controlField008-33='a'"> + <genre authority="marcgt">art original</genre> + </xsl:when> + <xsl:when test="$controlField008-33='b'"> + <genre authority="marcgt">kit</genre> + </xsl:when> + <xsl:when test="$controlField008-33='c'"> + <genre authority="marcgt">art reproduction</genre> + </xsl:when> + <xsl:when test="$controlField008-33='d'"> + <genre authority="marcgt">diorama</genre> + </xsl:when> + <xsl:when test="$controlField008-33='f'"> + <genre authority="marcgt">filmstrip</genre> + </xsl:when> + <xsl:when test="$controlField008-33='g'"> + <genre authority="marcgt">legal article</genre> + </xsl:when> + <xsl:when test="$controlField008-33='i'"> + <genre authority="marcgt">picture</genre> + </xsl:when> + <xsl:when test="$controlField008-33='k'"> + <genre authority="marcgt">graphic</genre> + </xsl:when> + <xsl:when test="$controlField008-33='l'"> + <genre authority="marcgt">technical drawing</genre> + </xsl:when> + <xsl:when test="$controlField008-33='m'"> + <genre authority="marcgt">motion picture</genre> + </xsl:when> + <xsl:when test="$controlField008-33='n'"> + <genre authority="marcgt">chart</genre> + </xsl:when> + <xsl:when test="$controlField008-33='o'"> + <genre authority="marcgt">flash card</genre> + </xsl:when> + <xsl:when test="$controlField008-33='p'"> + <genre authority="marcgt">microscope slide</genre> + </xsl:when> + <xsl:when test="$controlField008-33='q' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']"> + <genre authority="marcgt">model</genre> + </xsl:when> + <xsl:when test="$controlField008-33='r'"> + <genre authority="marcgt">realia</genre> + </xsl:when> + <xsl:when test="$controlField008-33='s'"> + <genre authority="marcgt">slide</genre> + </xsl:when> + <xsl:when test="$controlField008-33='t'"> + <genre authority="marcgt">transparency</genre> + </xsl:when> + <xsl:when test="$controlField008-33='v'"> + <genre authority="marcgt">videorecording</genre> + </xsl:when> + <xsl:when test="$controlField008-33='w'"> + <genre authority="marcgt">toy</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + +<!-- 111$n, 711$n 1.103 --> + + <xsl:if test="$typeOf008='BK'"> + <xsl:variable name="controlField008-28" select="substring($controlField008,29,1)"/> + <xsl:choose> + <xsl:when test="contains($controlField008-28,'a')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'c')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'f')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'i')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'l')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'o')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'s')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'u')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'z')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'|')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$typeOf008='CF'"> + <xsl:variable name="controlField008-28" select="substring($controlField008,29,1)"/> + <xsl:choose> + <xsl:when test="contains($controlField008-28,'a')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'c')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'f')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'i')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'l')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'o')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'s')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'u')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'z')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'|')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$typeOf008='CR'"> + <xsl:variable name="controlField008-28" select="substring($controlField008,29,1)"/> + <xsl:choose> + <xsl:when test="contains($controlField008-28,'a')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'c')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'f')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'i')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'l')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'o')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'s')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'u')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'z')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'|')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$typeOf008='MP'"> + <xsl:variable name="controlField008-28" select="substring($controlField008,29,1)"/> + <xsl:choose> + <xsl:when test="contains($controlField008-28,'a')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'c')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'f')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'i')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'l')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'o')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'s')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'u')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'z')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'|')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$typeOf008='VM'"> + <xsl:variable name="controlField008-28" select="substring($controlField008,29,1)"/> + <xsl:choose> + <xsl:when test="contains($controlField008-28,'a')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'c')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'f')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'i')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'l')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'m')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'o')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'s')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'u')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'z')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + <xsl:when test="contains($controlField008-28,'|')"> + <genre authority="marcgt">government publication</genre> + </xsl:when> + </xsl:choose> + </xsl:if> + + + <!-- genre --> + + <xsl:for-each select="marc:datafield[@tag=047]"> + <xsl:call-template name="createGenreFrom047"/> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=336]"> + <xsl:call-template name="createGenreFrom336"/> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=655]"> + <xsl:call-template name="createGenreFrom655"/> + </xsl:for-each> + + <!-- originInfo 250 and 260 --> + + <originInfo> + <xsl:call-template name="scriptCode"/> + <xsl:for-each select="marc:datafield[(@tag=260 or @tag=250) and marc:subfield[@code='a' or code='b' or @code='c' or code='g']]"> + <xsl:call-template name="z2xx880"/> + </xsl:for-each> + + <xsl:variable name="MARCpublicationCode" select="normalize-space(substring($controlField008,16,3))"/> + <xsl:if test="translate($MARCpublicationCode,'|','')"> + <place> + <placeTerm> + <xsl:attribute name="type">code</xsl:attribute> + <xsl:attribute name="authority">marccountry</xsl:attribute> + <xsl:value-of select="$MARCpublicationCode"/> + </placeTerm> + </place> + </xsl:if> + <xsl:for-each select="marc:datafield[@tag=044]/marc:subfield[@code='c']"> + <place> + <placeTerm> + <xsl:attribute name="type">code</xsl:attribute> + <xsl:attribute name="authority">iso3166</xsl:attribute> + <xsl:value-of select="."/> + </placeTerm> + </place> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='a']"> + <place> + <placeTerm> + <xsl:attribute name="type">text</xsl:attribute> + <xsl:call-template name="chopPunctuationFront"> + <xsl:with-param name="chopString"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </placeTerm> + </place> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='m']"> + <dateValid point="start"> + <xsl:value-of select="."/> + </dateValid> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='n']"> + <dateValid point="end"> + <xsl:value-of select="."/> + </dateValid> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='j']"> + <dateModified> + <xsl:value-of select="."/> + </dateModified> + </xsl:for-each> + + <!-- tmee 1.52 --> + + <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='c']"> + <dateIssued encoding="marc" point="start"> + <xsl:value-of select="."/> + </dateIssued> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='e']"> + <dateIssued encoding="marc" point="end"> + <xsl:value-of select="."/> + </dateIssued> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='k']"> + <dateCreated encoding="marc" point="start"> + <xsl:value-of select="."/> + </dateCreated> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='l']"> + <dateCreated encoding="marc" point="end"> + <xsl:value-of select="."/> + </dateCreated> + </xsl:for-each> + + <!-- tmee 1.35 1.36 dateIssued/nonMSS vs dateCreated/MSS --> + <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='b' or @code='c' or @code='g']"> + <xsl:choose> + <xsl:when test="@code='b'"> + <publisher> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + <xsl:with-param name="punctuation"> + <xsl:text>:,;/ </xsl:text> + </xsl:with-param> + </xsl:call-template> + </publisher> + </xsl:when> + <xsl:when test="(@code='c')"> + <xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'"> + <dateCreated> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </dateCreated> + </xsl:if> + + <xsl:if test="not($leader6='d' or $leader6='f' or $leader6='p' or $leader6='t')"> + <dateIssued> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </dateIssued> + </xsl:if> + </xsl:when> + <xsl:when test="@code='g'"> + <xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'"> + <dateCreated> + <xsl:value-of select="."/> + </dateCreated> + </xsl:if> + <xsl:if test="not($leader6='d' or $leader6='f' or $leader6='p' or $leader6='t')"> + <dateCreated> + <xsl:value-of select="."/> + </dateCreated> + </xsl:if> + </xsl:when> + </xsl:choose> + </xsl:for-each> + <xsl:variable name="dataField260c"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="marc:datafield[@tag=260]/marc:subfield[@code='c']"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="controlField008-7-10" select="normalize-space(substring($controlField008, 8, 4))"/> + <xsl:variable name="controlField008-11-14" select="normalize-space(substring($controlField008, 12, 4))"/> + <xsl:variable name="controlField008-6" select="normalize-space(substring($controlField008, 7, 1))"/> + + + + <!-- tmee 1.35 and 1.36 and 1.84--> + + <xsl:if test="($controlField008-6='e' or $controlField008-6='p' or $controlField008-6='r' or $controlField008-6='s' or $controlField008-6='t') and ($leader6='d' or $leader6='f' or $leader6='p' or $leader6='t')"> + <xsl:if test="$controlField008-7-10 and ($controlField008-7-10 != $dataField260c)"> + <dateCreated encoding="marc"> + <xsl:value-of select="$controlField008-7-10"/> + </dateCreated> + </xsl:if> + </xsl:if> + + <xsl:if test="($controlField008-6='e' or $controlField008-6='p' or $controlField008-6='r' or $controlField008-6='s' or $controlField008-6='t') and not($leader6='d' or $leader6='f' or $leader6='p' or $leader6='t')"> + <xsl:if test="$controlField008-7-10 and ($controlField008-7-10 != $dataField260c)"> + <dateIssued encoding="marc"> + <xsl:value-of select="$controlField008-7-10"/></dateIssued> + </xsl:if> + </xsl:if> + + <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='u'"> + <xsl:if test="$controlField008-7-10"> + <dateIssued encoding="marc" point="start"> + <xsl:value-of select="$controlField008-7-10"/> + </dateIssued> + </xsl:if> + </xsl:if> + + <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='u'"> + <xsl:if test="$controlField008-11-14"> + <dateIssued encoding="marc" point="end"> + <xsl:value-of select="$controlField008-11-14"/> + </dateIssued> + </xsl:if> + </xsl:if> + + <xsl:if test="$controlField008-6='q'"> + <xsl:if test="$controlField008-7-10"> + <dateIssued encoding="marc" point="start" qualifier="questionable"> + <xsl:value-of select="$controlField008-7-10"/> + </dateIssued> + </xsl:if> + </xsl:if> + <xsl:if test="$controlField008-6='q'"> + <xsl:if test="$controlField008-11-14"> + <dateIssued encoding="marc" point="end" qualifier="questionable"> + <xsl:value-of select="$controlField008-11-14"/> + </dateIssued> + </xsl:if> + </xsl:if> + + + <!-- tmee 1.77 008-06 dateIssued for value 's' 1.89 removed 20130920 + <xsl:if test="$controlField008-6='s'"> + <xsl:if test="$controlField008-7-10"> + <dateIssued encoding="marc"> + <xsl:value-of select="$controlField008-7-10"/> + </dateIssued> + </xsl:if> + </xsl:if> + --> + + <xsl:if test="$controlField008-6='t'"> + <xsl:if test="$controlField008-11-14"> + <copyrightDate encoding="marc"> + <xsl:value-of select="$controlField008-11-14"/> + </copyrightDate> + </xsl:if> + </xsl:if> + <xsl:for-each select="marc:datafield[@tag=033][@ind1=0 or @ind1=1]/marc:subfield[@code='a']"> + <dateCaptured encoding="iso8601"> + <xsl:value-of select="."/> + </dateCaptured> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][1]"> + <dateCaptured encoding="iso8601" point="start"> + <xsl:value-of select="."/> + </dateCaptured> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][2]"> + <dateCaptured encoding="iso8601" point="end"> + <xsl:value-of select="."/> + </dateCaptured> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=250]/marc:subfield[@code='a']"> + <edition> + <xsl:value-of select="."/> + </edition> + </xsl:for-each> + <xsl:for-each select="marc:leader"> + <issuance> + <xsl:choose> + <xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">monographic</xsl:when> + <xsl:when test="$leader7='m' and ($leader19='a' or $leader19='b' or $leader19='c')">multipart monograph</xsl:when> + <!-- 1.106 20141218 --> + <xsl:when test="$leader7='m' and ($leader19=' ')">single unit</xsl:when> + <xsl:when test="$leader7='m' and ($leader19='#')">single unit</xsl:when> + <xsl:when test="$leader7='i'">integrating resource</xsl:when> + <xsl:when test="$leader7='b' or $leader7='s'">serial</xsl:when> + </xsl:choose> + </issuance> + </xsl:for-each> + + <!-- 1.96 20140422 --> + <xsl:for-each select="marc:datafield[@tag=310]|marc:datafield[@tag=321]"> + <frequency> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ab</xsl:with-param> + </xsl:call-template> + </frequency> + </xsl:for-each> + + <!-- 1.67 1.72 updated fixed location issue 201308 1.86 --> + + <xsl:if test="$typeOf008='SE'"> + <xsl:for-each select="marc:controlfield[@tag=008]"> + <xsl:variable name="controlField008-18" select="substring($controlField008,19,1)"/> + <xsl:variable name="frequency"> + <frequency> + <xsl:choose> + <xsl:when test="$controlField008-18='a'">Annual</xsl:when> + <xsl:when test="$controlField008-18='b'">Bimonthly</xsl:when> + <xsl:when test="$controlField008-18='c'">Semiweekly</xsl:when> + <xsl:when test="$controlField008-18='d'">Daily</xsl:when> + <xsl:when test="$controlField008-18='e'">Biweekly</xsl:when> + <xsl:when test="$controlField008-18='f'">Semiannual</xsl:when> + <xsl:when test="$controlField008-18='g'">Biennial</xsl:when> + <xsl:when test="$controlField008-18='h'">Triennial</xsl:when> + <xsl:when test="$controlField008-18='i'">Three times a week</xsl:when> + <xsl:when test="$controlField008-18='j'">Three times a month</xsl:when> + <xsl:when test="$controlField008-18='k'">Continuously updated</xsl:when> + <xsl:when test="$controlField008-18='m'">Monthly</xsl:when> + <xsl:when test="$controlField008-18='q'">Quarterly</xsl:when> + <xsl:when test="$controlField008-18='s'">Semimonthly</xsl:when> + <xsl:when test="$controlField008-18='t'">Three times a year</xsl:when> + <xsl:when test="$controlField008-18='u'">Unknown</xsl:when> + <xsl:when test="$controlField008-18='w'">Weekly</xsl:when> + <!-- 1.106 20141218 --> + <xsl:when test="$controlField008-18=' '">Completely irregular</xsl:when> + <xsl:when test="$controlField008-18='#'">Completely irregular</xsl:when> + <xsl:otherwise/> + </xsl:choose> + </frequency> + </xsl:variable> + <xsl:if test="$frequency!=''"> + <frequency authority="marcfrequency"> + <xsl:value-of select="$frequency"/> + </frequency> + </xsl:if> + </xsl:for-each> + </xsl:if> + </originInfo> + + + <!-- originInfo - 264 --> + + <xsl:for-each select="marc:datafield[@tag=264][@ind2=0]"> + <originInfo eventType="production"> + <!-- Template checks for altRepGroup - 880 $6 --> + <xsl:call-template name="xxx880"/> + <place> + <placeTerm type="text"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </placeTerm> + </place> + <publisher> + <xsl:value-of select="marc:subfield[@code='b']"/> + </publisher> + <dateOther type="production"> + <xsl:value-of select="marc:subfield[@code='c']"/> + </dateOther> + </originInfo> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=264][@ind2=1]"> + <originInfo eventType="publication"> + <!-- Template checks for altRepGroup - 880 $6 1.88 20130829 added chopPunc--> + <xsl:call-template name="xxx880"/> + <place> + <placeTerm type="text"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </placeTerm> + </place> + <publisher> + <xsl:value-of select="marc:subfield[@code='b']"/> + </publisher> + <dateIssued> + <xsl:value-of select="marc:subfield[@code='c']"/> + </dateIssued> + </originInfo> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=264][@ind2=2]"> + <originInfo eventType="distribution"> + <!-- Template checks for altRepGroup - 880 $6 --> + <xsl:call-template name="xxx880"/> + <place> + <placeTerm type="text"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </placeTerm> + </place> + <publisher> + <xsl:value-of select="marc:subfield[@code='b']"/> + </publisher> + <dateOther type="distribution"> + <xsl:value-of select="marc:subfield[@code='c']"/> + </dateOther> + </originInfo> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=264][@ind2=3]"> + <originInfo eventType="manufacture"> + <!-- Template checks for altRepGroup - 880 $6 --> + <xsl:call-template name="xxx880"/> + <place> + <placeTerm type="text"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </placeTerm> + </place> + <publisher> + <xsl:value-of select="marc:subfield[@code='b']"/> + </publisher> + <dateOther type="manufacture"> + <xsl:value-of select="marc:subfield[@code='c']"/> + </dateOther> + </originInfo> + </xsl:for-each> + + + <xsl:for-each select="marc:datafield[@tag=880]"> + <xsl:variable name="related_datafield" select="substring-before(marc:subfield[@code='6'],'-')"/> + <xsl:variable name="occurence_number" select="substring( substring-after(marc:subfield[@code='6'],'-') , 1 , 2 )"/> + <xsl:variable name="hit" select="../marc:datafield[@tag=$related_datafield and contains(marc:subfield[@code='6'] , concat('880-' , $occurence_number))]/@tag"/> + + <xsl:choose> + <xsl:when test="$hit='260'"> + <originInfo> + <xsl:call-template name="scriptCode"/> + <xsl:for-each select="../marc:datafield[@tag=260 and marc:subfield[@code='a' or code='b' or @code='c' or code='g']]"> + <xsl:call-template name="z2xx880"/> + </xsl:for-each> + <xsl:if test="marc:subfield[@code='a']"> + <place> + <placeTerm type="text"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </placeTerm> + </place> + </xsl:if> + <xsl:if test="marc:subfield[@code='b']"> + <publisher> + <xsl:value-of select="marc:subfield[@code='b']"/> + </publisher> + </xsl:if> + <xsl:if test="marc:subfield[@code='c']"> + <dateIssued> + <xsl:value-of select="marc:subfield[@code='c']"/> + </dateIssued> + </xsl:if> + <xsl:if test="marc:subfield[@code='g']"> + <dateCreated> + <xsl:value-of select="marc:subfield[@code='g']"/> + </dateCreated> + </xsl:if> + <xsl:for-each select="../marc:datafield[@tag=880]/marc:subfield[@code=6][contains(text(),'250')]"> + <edition> + <xsl:value-of select="following-sibling::marc:subfield"/> + </edition> + </xsl:for-each> + </originInfo> + </xsl:when> + <xsl:when test="$hit='300'"> + <physicalDescription> + <xsl:for-each select="../marc:datafield[@tag=300]"> + <xsl:call-template name="z3xx880"/> + </xsl:for-each> + <extent> + <xsl:for-each select="marc:subfield"> + <xsl:if test="@code='a' or @code='3' or @code='b' or @code='c'"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + </extent> + <!-- form 337 338 --> + <form> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:attribute> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">a</xsl:with-param> + </xsl:call-template> + </form> + </physicalDescription> + </xsl:when> + </xsl:choose> + </xsl:for-each> + + <!-- language 041 --> + <xsl:variable name="controlField008-35-37" select="normalize-space(translate(substring($controlField008,36,3),'|#',''))"/> + <xsl:if test="$controlField008-35-37"> + <language> + <languageTerm authority="iso639-2b" type="code"> + <xsl:value-of select="substring($controlField008,36,3)"/> + </languageTerm> + </language> + </xsl:if> + <xsl:for-each select="marc:datafield[@tag=041]"> + <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']"> + <xsl:variable name="langCodes" select="."/> + <xsl:choose> + <xsl:when test="../marc:subfield[@code='2']='rfc3066'"> + <!-- not stacked but could be repeated --> + <xsl:call-template name="rfcLanguages"> + <xsl:with-param name="nodeNum"> + <xsl:value-of select="1"/> + </xsl:with-param> + <xsl:with-param name="usedLanguages"> + <xsl:text/> + </xsl:with-param> + <xsl:with-param name="controlField008-35-37"> + <xsl:value-of select="$controlField008-35-37"/> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- iso --> + <xsl:variable name="allLanguages"> + <xsl:copy-of select="$langCodes"/> + </xsl:variable> + <xsl:variable name="currentLanguage"> + <xsl:value-of select="substring($allLanguages,1,3)"/> + </xsl:variable> + <xsl:call-template name="isoLanguage"> + <xsl:with-param name="currentLanguage"> + <xsl:value-of select="substring($allLanguages,1,3)"/> + </xsl:with-param> + <xsl:with-param name="remainingLanguages"> + <xsl:value-of select="substring($allLanguages,4,string-length($allLanguages)-3)"/> + </xsl:with-param> + <xsl:with-param name="usedLanguages"> + <xsl:if test="$controlField008-35-37"> + <xsl:value-of select="$controlField008-35-37"/> + </xsl:if> + </xsl:with-param> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:for-each> + + <!-- physicalDescription --> + + <xsl:variable name="physicalDescription"> + <!--3.2 change tmee 007/11 --> + <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='a']"> + <digitalOrigin>reformatted digital</digitalOrigin> + </xsl:if> + <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='b']"> + <digitalOrigin>digitized microfilm</digitalOrigin> + </xsl:if> + <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='d']"> + <digitalOrigin>digitized other analog</digitalOrigin> + </xsl:if> + <xsl:variable name="controlField008-23" select="substring($controlField008,24,1)"/> + <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/> + <xsl:variable name="check008-23"> + <xsl:if test="$typeOf008='BK' or $typeOf008='MU' or $typeOf008='SE' or $typeOf008='MM'"> + <xsl:value-of select="true()"/> + </xsl:if> + </xsl:variable> + <xsl:variable name="check008-29"> + <xsl:if test="$typeOf008='MP' or $typeOf008='VM'"> + <xsl:value-of select="true()"/> + </xsl:if> + </xsl:variable> + <xsl:choose> + <xsl:when test="($check008-23 and $controlField008-23='f') or ($check008-29 and $controlField008-29='f')"> + <form authority="marcform">braille</form> + </xsl:when> + <xsl:when test="($controlField008-23=' ' and ($leader6='c' or $leader6='d')) or (($typeOf008='BK' or $typeOf008='SE') and ($controlField008-23=' ' or $controlField008='r'))"> + <form authority="marcform">print</form> + </xsl:when> + <xsl:when test="$leader6 = 'm' or ($check008-23 and $controlField008-23='s') or ($check008-29 and $controlField008-29='s')"> + <form authority="marcform">electronic</form> + </xsl:when> + <!-- 1.33 --> + <xsl:when test="$leader6 = 'o'"> + <form authority="marcform">kit</form> + </xsl:when> + <xsl:when test="($check008-23 and $controlField008-23='b') or ($check008-29 and $controlField008-29='b')"> + <form authority="marcform">microfiche</form> + </xsl:when> + <xsl:when test="($check008-23 and $controlField008-23='a') or ($check008-29 and $controlField008-29='a')"> + <form authority="marcform">microfilm</form> + </xsl:when> + </xsl:choose> + + <!-- 1/04 fix --> + <xsl:if test="marc:datafield[@tag=130]/marc:subfield[@code='h']"> + <form authority="gmd"> + <xsl:call-template name="chopBrackets"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:datafield[@tag=130]/marc:subfield[@code='h']"/> + </xsl:with-param> + </xsl:call-template> + </form> + </xsl:if> + <xsl:if test="marc:datafield[@tag=240]/marc:subfield[@code='h']"> + <form authority="gmd"> + <xsl:call-template name="chopBrackets"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:datafield[@tag=240]/marc:subfield[@code='h']"/> + </xsl:with-param> + </xsl:call-template> + </form> + </xsl:if> + <xsl:if test="marc:datafield[@tag=242]/marc:subfield[@code='h']"> + <form authority="gmd"> + <xsl:call-template name="chopBrackets"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:datafield[@tag=242]/marc:subfield[@code='h']"/> + </xsl:with-param> + </xsl:call-template> + </form> + </xsl:if> + <xsl:if test="marc:datafield[@tag=245]/marc:subfield[@code='h']"> + <form authority="gmd"> + <xsl:call-template name="chopBrackets"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:datafield[@tag=245]/marc:subfield[@code='h']"/> + </xsl:with-param> + </xsl:call-template> + </form> + </xsl:if> + <xsl:if test="marc:datafield[@tag=246]/marc:subfield[@code='h']"> + <form authority="gmd"> + <xsl:call-template name="chopBrackets"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:datafield[@tag=246]/marc:subfield[@code='h']"/> + </xsl:with-param> + </xsl:call-template> + </form> + </xsl:if> + <xsl:if test="marc:datafield[@tag=730]/marc:subfield[@code='h']"> + <form authority="gmd"> + <xsl:call-template name="chopBrackets"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:datafield[@tag=730]/marc:subfield[@code='h']"/> + </xsl:with-param> + </xsl:call-template> + </form> + </xsl:if> + <xsl:for-each select="marc:datafield[@tag=256]/marc:subfield[@code='a']"> + <form> + <xsl:value-of select="."/> + </form> + </xsl:for-each> + <xsl:for-each select="marc:controlfield[@tag=007][substring(text(),1,1)='c']"> + <xsl:choose> + <xsl:when test="substring(text(),14,1)='a'"> + <reformattingQuality>access</reformattingQuality> + </xsl:when> + <xsl:when test="substring(text(),14,1)='p'"> + <reformattingQuality>preservation</reformattingQuality> + </xsl:when> + <xsl:when test="substring(text(),14,1)='r'"> + <reformattingQuality>replacement</reformattingQuality> + </xsl:when> + </xsl:choose> + </xsl:for-each> + <!--3.2 change tmee 007/01 --> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='b']"> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">chip cartridge</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='c']"> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">computer optical disc cartridge</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='j']"> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">magnetic disc</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='m']"> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">magneto-optical disc</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='o']"> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">optical disc</form> + </xsl:if> + + <!-- 1.38 AQ 1.29 tmee 1.66 added marccategory and marcsmd as part of 3.4 --> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='r']"> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">remote</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='a']"> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">tape cartridge</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='f']"> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">tape cassette</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='h']"> + <form authority="marccategory">electronic resource</form> + <form authority="marcsmd">tape reel</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='a']"> + <form authority="marccategory">globe</form> + <form authority="marcsmd">celestial globe</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='e']"> + <form authority="marccategory">globe</form> + <form authority="marcsmd">earth moon globe</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='b']"> + <form authority="marccategory">globe</form> + <form authority="marcsmd">planetary or lunar globe</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='c']"> + <form authority="marccategory">globe</form> + <form authority="marcsmd">terrestrial globe</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='o'][substring(text(),2,1)='o']"> + <form authority="marccategory">kit</form> + <form authority="marcsmd">kit</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']"> + <form authority="marccategory">map</form> + <form authority="marcsmd">atlas</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='g']"> + <form authority="marccategory">map</form> + <form authority="marcsmd">diagram</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='j']"> + <form authority="marccategory">map</form> + <form authority="marcsmd">map</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']"> + <form authority="marccategory">map</form> + <form authority="marcsmd">model</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='k']"> + <form authority="marccategory">map</form> + <form authority="marcsmd">profile</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='r']"> + <form authority="marcsmd">remote-sensing image</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='s']"> + <form authority="marccategory">map</form> + <form authority="marcsmd">section</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='y']"> + <form authority="marccategory">map</form> + <form authority="marcsmd">view</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='a']"> + <form authority="marccategory">microform</form> + <form authority="marcsmd">aperture card</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='e']"> + <form authority="marccategory">microform</form> + <form authority="marcsmd">microfiche</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='f']"> + <form authority="marccategory">microform</form> + <form authority="marcsmd">microfiche cassette</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='b']"> + <form authority="marccategory">microform</form> + <form authority="marcsmd">microfilm cartridge</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='c']"> + <form authority="marccategory">microform</form> + <form authority="marcsmd">microfilm cassette</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='d']"> + <form authority="marccategory">microform</form> + <form authority="marcsmd">microfilm reel</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='g']"> + <form authority="marccategory">microform</form> + <form authority="marcsmd">microopaque</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='c']"> + <form authority="marccategory">motion picture</form> + <form authority="marcsmd">film cartridge</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='f']"> + <form authority="marccategory">motion picture</form> + <form authority="marcsmd">film cassette</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='r']"> + <form authority="marccategory">motion picture</form> + <form authority="marcsmd">film reel</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='n']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">chart</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='c']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">collage</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='d']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">drawing</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='o']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">flash card</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='e']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">painting</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='f']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">photomechanical print</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='g']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">photonegative</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='h']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">photoprint</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='i']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">picture</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='j']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">print</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='l']"> + <form authority="marccategory">nonprojected graphic</form> + <form authority="marcsmd">technical drawing</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='q'][substring(text(),2,1)='q']"> + <form authority="marccategory">notated music</form> + <form authority="marcsmd">notated music</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='d']"> + <form authority="marccategory">projected graphic</form> + <form authority="marcsmd">filmslip</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='c']"> + <form authority="marccategory">projected graphic</form> + <form authority="marcsmd">filmstrip cartridge</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='o']"> + <form authority="marccategory">projected graphic</form> + <form authority="marcsmd">filmstrip roll</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='f']"> + <form authority="marccategory">projected graphic</form> + <form authority="marcsmd">other filmstrip type</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='s']"> + <form authority="marccategory">projected graphic</form> + <form authority="marcsmd">slide</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='t']"> + <form authority="marccategory">projected graphic</form> + <form authority="marcsmd">transparency</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='r'][substring(text(),2,1)='r']"> + <form authority="marccategory">remote-sensing image</form> + <form authority="marcsmd">remote-sensing image</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='e']"> + <form authority="marccategory">sound recording</form> + <form authority="marcsmd">cylinder</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='q']"> + <form authority="marccategory">sound recording</form> + <form authority="marcsmd">roll</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='g']"> + <form authority="marccategory">sound recording</form> + <form authority="marcsmd">sound cartridge</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='s']"> + <form authority="marccategory">sound recording</form> + <form authority="marcsmd">sound cassette</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='d']"> + <form authority="marccategory">sound recording</form> + <form authority="marcsmd">sound disc</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='t']"> + <form authority="marccategory">sound recording</form> + <form authority="marcsmd">sound-tape reel</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='i']"> + <form authority="marccategory">sound recording</form> + <form authority="marcsmd">sound-track film</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='w']"> + <form authority="marccategory">sound recording</form> + <form authority="marcsmd">wire recording</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='c']"> + <form authority="marccategory">tactile material</form> + <form authority="marcsmd">braille</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='b']"> + <form authority="marccategory">tactile material</form> + <form authority="marcsmd">combination</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='a']"> + <form authority="marccategory">tactile material</form> + <form authority="marcsmd">moon</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='d']"> + <form authority="marccategory">tactile material</form> + <form authority="marcsmd">tactile, with no writing system</form> + </xsl:if> + + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='c']"> + <form authority="marccategory">text</form> + <form authority="marcsmd">braille</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='b']"> + <form authority="marccategory">text</form> + <form authority="marcsmd">large print</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='a']"> + <form authority="marccategory">text</form> + <form authority="marcsmd">regular print</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='d']"> + <form authority="marccategory">text</form> + <form authority="marcsmd">text in looseleaf binder</form> + </xsl:if> + + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='c']"> + <form authority="marccategory">videorecording</form> + <form authority="marcsmd">videocartridge</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='f']"> + <form authority="marccategory">videorecording</form> + <form authority="marcsmd">videocassette</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='d']"> + <form authority="marccategory">videorecording</form> + <form authority="marcsmd">videodisc</form> + </xsl:if> + <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='r']"> + <form authority="marccategory">videorecording</form> + <form authority="marcsmd">videoreel</form> + </xsl:if> + + <xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='q'][string-length(.)>1]"> + <internetMediaType> + <xsl:value-of select="."/> + </internetMediaType> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=300]"> + <extent> + <xsl:if test="marc:subfield[@code='f']"> + <xsl:attribute name="unit"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">f</xsl:with-param> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abce3g</xsl:with-param> + </xsl:call-template> + </extent> + </xsl:for-each> + + + <xsl:for-each select="marc:datafield[@tag=337]"> + <form type="media"> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code=2]"/> + </xsl:attribute> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">a</xsl:with-param> + </xsl:call-template> + </form> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=338]"> + <form type="carrier"> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code=2]"/> + </xsl:attribute> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">a</xsl:with-param> + </xsl:call-template> + </form> + </xsl:for-each> + + + <!-- 1.43 tmee 351 $3$a$b$c--> + <xsl:for-each select="marc:datafield[@tag=351]"> + <note type="arrangement"> + <xsl:for-each select="marc:subfield[@code='3']"> + <xsl:value-of select="."/> + <xsl:text>: </xsl:text> + </xsl:for-each> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abc</xsl:with-param> + </xsl:call-template> + </note> + </xsl:for-each> + + </xsl:variable> + + + <xsl:if test="string-length(normalize-space($physicalDescription))"> + <physicalDescription> + <xsl:for-each select="marc:datafield[@tag=300]"> + <!-- Template checks for altRepGroup - 880 $6 --> + <xsl:call-template name="z3xx880"/> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=337]"> + <!-- Template checks for altRepGroup - 880 $6 --> + <xsl:call-template name="xxx880"/> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=338]"> + <!-- Template checks for altRepGroup - 880 $6 --> + <xsl:call-template name="xxx880"/> + </xsl:for-each> + + <xsl:copy-of select="$physicalDescription"/> + </physicalDescription> + </xsl:if> + + + <xsl:for-each select="marc:datafield[@tag=520]"> + <xsl:call-template name="createAbstractFrom520"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=505]"> + <xsl:call-template name="createTOCFrom505"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=521]"> + <xsl:call-template name="createTargetAudienceFrom521"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=506]"> + <xsl:call-template name="createAccessConditionFrom506"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=540]"> + <xsl:call-template name="createAccessConditionFrom540"/> + </xsl:for-each> + + + <xsl:if test="$typeOf008='BK' or $typeOf008='CF' or $typeOf008='MU' or $typeOf008='VM'"> + <xsl:variable name="controlField008-22" select="substring($controlField008,23,1)"/> + <xsl:choose> + <!-- 01/04 fix --> + <xsl:when test="$controlField008-22='d'"> + <targetAudience authority="marctarget">adolescent</targetAudience> + </xsl:when> + <xsl:when test="$controlField008-22='e'"> + <targetAudience authority="marctarget">adult</targetAudience> + </xsl:when> + <xsl:when test="$controlField008-22='g'"> + <targetAudience authority="marctarget">general</targetAudience> + </xsl:when> + <xsl:when test="$controlField008-22='b' or $controlField008-22='c' or $controlField008-22='j'"> + <targetAudience authority="marctarget">juvenile</targetAudience> + </xsl:when> + <xsl:when test="$controlField008-22='a'"> + <targetAudience authority="marctarget">preschool</targetAudience> + </xsl:when> + <xsl:when test="$controlField008-22='f'"> + <targetAudience authority="marctarget">specialized</targetAudience> + </xsl:when> + </xsl:choose> + </xsl:if> + + <!-- 1.32 tmee Drop note mapping for 510 and map only to <relatedItem> + <xsl:for-each select="marc:datafield[@tag=510]"> + <note type="citation/reference"> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:for-each> + --> + + <!-- 245c 362az 502-585 5XX--> + + <xsl:for-each select="marc:datafield[@tag=245]"> + <xsl:call-template name="createNoteFrom245c"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=362]"> + <xsl:call-template name="createNoteFrom362"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=500]"> + <xsl:call-template name="createNoteFrom500"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=502]"> + <xsl:call-template name="createNoteFrom502"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=504]"> + <xsl:call-template name="createNoteFrom504"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=508]"> + <xsl:call-template name="createNoteFrom508"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=511]"> + <xsl:call-template name="createNoteFrom511"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=515]"> + <xsl:call-template name="createNoteFrom515"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=518]"> + <xsl:call-template name="createNoteFrom518"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=524]"> + <xsl:call-template name="createNoteFrom524"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=530]"> + <xsl:call-template name="createNoteFrom530"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=533]"> + <xsl:call-template name="createNoteFrom533"/> + </xsl:for-each> + <!-- + <xsl:for-each select="marc:datafield[@tag=534]"> + <xsl:call-template name="createNoteFrom534"/> + </xsl:for-each> +--> + + <xsl:for-each select="marc:datafield[@tag=535]"> + <xsl:call-template name="createNoteFrom535"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=536]"> + <xsl:call-template name="createNoteFrom536"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=538]"> + <xsl:call-template name="createNoteFrom538"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=541]"> + <xsl:call-template name="createNoteFrom541"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=545]"> + <xsl:call-template name="createNoteFrom545"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=546]"> + <xsl:call-template name="createNoteFrom546"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=561]"> + <xsl:call-template name="createNoteFrom561"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=562]"> + <xsl:call-template name="createNoteFrom562"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=581]"> + <xsl:call-template name="createNoteFrom581"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=583]"> + <xsl:call-template name="createNoteFrom583"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=585]"> + <xsl:call-template name="createNoteFrom585"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=501 or @tag=507 or @tag=513 or @tag=514 or @tag=516 or @tag=522 or @tag=525 or @tag=526 or @tag=544 or @tag=547 or @tag=550 or @tag=552 or @tag=555 or @tag=556 or @tag=565 or @tag=567 or @tag=580 or @tag=584 or @tag=586]"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=034]"> + <xsl:call-template name="createSubGeoFrom034"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=043]"> + <xsl:call-template name="createSubGeoFrom043"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=045]"> + <xsl:call-template name="createSubTemFrom045"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=255]"> + <xsl:call-template name="createSubGeoFrom255"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=600]"> + <xsl:call-template name="createSubNameFrom600"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=610]"> + <xsl:call-template name="createSubNameFrom610"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=611]"> + <xsl:call-template name="createSubNameFrom611"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=630]"> + <xsl:call-template name="createSubTitleFrom630"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=648]"> + <xsl:call-template name="createSubChronFrom648"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=650]"> + <xsl:call-template name="createSubTopFrom650"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=651]"> + <xsl:call-template name="createSubGeoFrom651"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=653]"> + <xsl:call-template name="createSubFrom653"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=656]"> + <xsl:call-template name="createSubFrom656"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=662]"> + <xsl:call-template name="createSubGeoFrom662752"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=752]"> + <xsl:call-template name="createSubGeoFrom662752"/> + </xsl:for-each> + + <!-- createClassificationFrom 0XX--> + <xsl:for-each select="marc:datafield[@tag='050']"> + <xsl:call-template name="createClassificationFrom050"/> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='060']"> + <xsl:call-template name="createClassificationFrom060"/> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='080']"> + <xsl:call-template name="createClassificationFrom080"/> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='082']"> + <xsl:call-template name="createClassificationFrom082"/> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='084']"> + <xsl:call-template name="createClassificationFrom084"/> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='086']"> + <xsl:call-template name="createClassificationFrom086"/> + </xsl:for-each> + + <!-- location --> + + <xsl:for-each select="marc:datafield[@tag=852]"> + <xsl:call-template name="createLocationFrom852"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=856]"> + <xsl:call-template name="createLocationFrom856"/> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=490][@ind1=0]"> + <xsl:call-template name="createRelatedItemFrom490"/> + </xsl:for-each> + + + <xsl:for-each select="marc:datafield[@tag=440]"> + <relatedItem type="series"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">av</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + </relatedItem> + </xsl:for-each> + + <!-- tmee 1.40 1.74 1.88 fixed 510c mapping 20130829--> + + <xsl:for-each select="marc:datafield[@tag=510]"> + <relatedItem type="isReferencedBy"> + <xsl:for-each select="marc:subfield[@code='a']"> + <titleInfo> + <title> + <xsl:value-of select="."/> + </title> + </titleInfo> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='b']"> + <originInfo> + <dateOther type="coverage"> + <xsl:value-of select="."/> + </dateOther> + </originInfo> + </xsl:for-each> + + <part> + <detail type="part"> + <number> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">c</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </number> + </detail> + </part> + </relatedItem> + </xsl:for-each> + + + <xsl:for-each select="marc:datafield[@tag=534]"> + <relatedItem type="original"> + <xsl:call-template name="relatedTitle"/> + <xsl:call-template name="relatedName"/> + <xsl:if test="marc:subfield[@code='b' or @code='c']"> + <originInfo> + <xsl:for-each select="marc:subfield[@code='c']"> + <publisher> + <xsl:value-of select="."/> + </publisher> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='b']"> + <edition> + <xsl:value-of select="."/> + </edition> + </xsl:for-each> + </originInfo> + </xsl:if> + <xsl:call-template name="relatedIdentifierISSN"/> + <xsl:for-each select="marc:subfield[@code='z']"> + <identifier type="isbn"> + <xsl:value-of select="."/> + </identifier> + </xsl:for-each> + <xsl:call-template name="relatedNote"/> + </relatedItem> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=700][marc:subfield[@code='t']]"> + <relatedItem> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="constituentOrRelatedType"/> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="afterCodes">g</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + <name type="personal"> + <namePart> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">aq</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="beforeCodes">g</xsl:with-param> + </xsl:call-template> + </namePart> + <xsl:call-template name="termsOfAddress"/> + <xsl:call-template name="nameDate"/> + <xsl:call-template name="role"/> + </name> + <xsl:call-template name="relatedForm"/> + <xsl:call-template name="relatedIdentifierISSN"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=710][marc:subfield[@code='t']]"> + <relatedItem> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="constituentOrRelatedType"/> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="afterCodes">dg</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="relatedPartNumName"/> + </titleInfo> + <name type="corporate"> + <xsl:for-each select="marc:subfield[@code='a']"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='b']"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </xsl:for-each> + <xsl:variable name="tempNamePart"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">c</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="beforeCodes">dgn</xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:if test="normalize-space($tempNamePart)"> + <namePart> + <xsl:value-of select="$tempNamePart"/> + </namePart> + </xsl:if> + <xsl:call-template name="role"/> + </name> + <xsl:call-template name="relatedForm"/> + <xsl:call-template name="relatedIdentifierISSN"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=711][marc:subfield[@code='t']]"> + <relatedItem> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="constituentOrRelatedType"/> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">tfklsv</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="afterCodes">g</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="relatedPartNumName"/> + </titleInfo> + <name type="conference"> + <namePart> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">aqdc</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="beforeCodes">gn</xsl:with-param> + </xsl:call-template> + </namePart> + </name> + <xsl:call-template name="relatedForm"/> + <xsl:call-template name="relatedIdentifierISSN"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=730][@ind2=2]"> + <relatedItem> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="constituentOrRelatedType"/> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">adfgklmorsv</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + <xsl:call-template name="relatedForm"/> + <xsl:call-template name="relatedIdentifierISSN"/> + </relatedItem> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=740][@ind2=2]"> + <relatedItem> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="constituentOrRelatedType"/> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + <xsl:call-template name="relatedForm"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=760]"> + <relatedItem type="series"> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="relatedItem76X-78X"/> + </relatedItem> + </xsl:for-each> + + <!--AQ1.23 tmee/dlf --> + <xsl:for-each select="marc:datafield[@tag=762]"> + <relatedItem type="constituent"> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="relatedItem76X-78X"/> + </relatedItem> + </xsl:for-each> + + <!-- AQ1.5, AQ1.7 deleted tags 777 and 787 from the following select for relatedItem mapping --> + <!-- 1.45 and 1.46 - AQ1.24 and 1.25 tmee--> + <xsl:for-each select="marc:datafield[@tag=765]|marc:datafield[@tag=767]|marc:datafield[@tag=775]"> + <relatedItem type="otherVersion"> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="relatedItem76X-78X"/> + </relatedItem> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=770]|marc:datafield[@tag=774]"> + <relatedItem type="constituent"> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="relatedItem76X-78X"/> + </relatedItem> + </xsl:for-each> + + + <xsl:for-each select="marc:datafield[@tag=772]|marc:datafield[@tag=773]"> + <relatedItem type="host"> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="relatedItem76X-78X"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=776]"> + <relatedItem type="otherFormat"> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="relatedItem76X-78X"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=780]"> + <relatedItem type="preceding"> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="relatedItem76X-78X"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=785]"> + <relatedItem type="succeeding"> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="relatedItem76X-78X"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=786]"> + <relatedItem type="original"> + <!-- 1.115 --> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="otherType"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="relatedItem76X-78X"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=800]"> + <relatedItem type="series"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="afterCodes">g</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + <name type="personal"> + <namePart> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">aq</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="beforeCodes">g</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </namePart> + <xsl:call-template name="termsOfAddress"/> + <xsl:call-template name="nameDate"/> + <xsl:call-template name="role"/> + </name> + <xsl:call-template name="relatedForm"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=810]"> + <relatedItem type="series"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="afterCodes">dg</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="relatedPartNumName"/> + </titleInfo> + <name type="corporate"> + <xsl:for-each select="marc:subfield[@code='a']"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='b']"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </xsl:for-each> + <namePart> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">c</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="beforeCodes">dgn</xsl:with-param> + </xsl:call-template> + </namePart> + <xsl:call-template name="role"/> + </name> + <xsl:call-template name="relatedForm"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=811]"> + <relatedItem type="series"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">tfklsv</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="afterCodes">g</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="relatedPartNumName"/> + </titleInfo> + <name type="conference"> + <namePart> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">aqdc</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="beforeCodes">gn</xsl:with-param> + </xsl:call-template> + </namePart> + <xsl:call-template name="role"/> + </name> + <xsl:call-template name="relatedForm"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='830']"> + <relatedItem type="series"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">adfgklmorsv</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + <xsl:call-template name="relatedForm"/> + </relatedItem> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='856'][@ind2='2']/marc:subfield[@code='q']"> + <relatedItem> + <internetMediaType> + <xsl:value-of select="."/> + </internetMediaType> + </relatedItem> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='880']"> + <xsl:apply-templates select="self::*" mode="trans880"/> + </xsl:for-each> + + + <!-- 856, 020, 024, 022, 028, 010, 035, 037 --> + + <xsl:for-each select="marc:datafield[@tag='020']"> + <xsl:if test="marc:subfield[@code='a']"> + <identifier type="isbn"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </identifier> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='020']"> + <xsl:if test="marc:subfield[@code='z']"> + <identifier type="isbn" invalid="yes"> + <xsl:value-of select="marc:subfield[@code='z']"/> + </identifier> + </xsl:if> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='024'][@ind1='0']"> + <xsl:if test="marc:subfield[@code='a']"> + <identifier type="isrc"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </identifier> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='024'][@ind1='2']"> + <xsl:if test="marc:subfield[@code='a']"> + <identifier type="ismn"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </identifier> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='024'][@ind1='4']"> + <identifier type="sici"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ab</xsl:with-param> + </xsl:call-template> + </identifier> + </xsl:for-each> + + <!-- 1.107 WS --> + <xsl:for-each select="marc:datafield[@tag='024'][@ind1='7']"> + <identifier> + <xsl:if test="marc:subfield[@code='2']"> + <xsl:attribute name="type"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="marc:subfield[@code='a']"/> + </identifier> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='024'][@ind1='8']"> + <identifier> + <xsl:value-of select="marc:subfield[@code='a']"/> + </identifier> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='022'][marc:subfield[@code='a']]"> + <xsl:if test="marc:subfield[@code='a']"> + <identifier type="issn"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </identifier> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='022'][marc:subfield[@code='z']]"> + <xsl:if test="marc:subfield[@code='z']"> + <identifier type="issn" invalid="yes"> + <xsl:value-of select="marc:subfield[@code='z']"/> + </identifier> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='022'][marc:subfield[@code='y']]"> + <xsl:if test="marc:subfield[@code='y']"> + <identifier type="issn" invalid="yes"> + <xsl:value-of select="marc:subfield[@code='y']"/> + </identifier> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='022'][marc:subfield[@code='l']]"> + <xsl:if test="marc:subfield[@code='l']"> + <identifier type="issn-l"> + <xsl:value-of select="marc:subfield[@code='l']"/> + </identifier> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='022'][marc:subfield[@code='m']]"> + <xsl:if test="marc:subfield[@code='m']"> + <identifier type="issn-l" invalid="yes"> + <xsl:value-of select="marc:subfield[@code='m']"/> + </identifier> + </xsl:if> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='010'][marc:subfield[@code='a']]"> + <identifier type="lccn"> + <xsl:value-of select="normalize-space(marc:subfield[@code='a'])"/> + </identifier> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag='010'][marc:subfield[@code='z']]"> + <identifier type="lccn" invalid="yes"> + <xsl:value-of select="normalize-space(marc:subfield[@code='z'])"/> + </identifier> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='028']"> + <identifier> + <xsl:attribute name="type"> + <xsl:choose> + <xsl:when test="@ind1='0'">issue number</xsl:when> + <xsl:when test="@ind1='1'">matrix number</xsl:when> + <xsl:when test="@ind1='2'">music plate</xsl:when> + <xsl:when test="@ind1='3'">music publisher</xsl:when> + <xsl:when test="@ind1='4'">videorecording identifier</xsl:when> + </xsl:choose> + </xsl:attribute> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes"> + <xsl:choose> + <xsl:when test="@ind1='0'">ba</xsl:when> + <xsl:otherwise>ab</xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </identifier> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='035'][marc:subfield[@code='a'][contains(text(), '(OCoLC)')]]"> + <identifier type="oclc"> + <xsl:value-of select="normalize-space(substring-after(marc:subfield[@code='a'], '(OCoLC)'))"/> + </identifier> + </xsl:for-each> + + + <!-- 3.5 1.95 20140421 --> + <xsl:for-each select="marc:datafield[@tag='035'][marc:subfield[@code='a'][contains(text(), '(WlCaITV)')]]"> + <identifier type="WlCaITV"> + <xsl:value-of select="normalize-space(substring-after(marc:subfield[@code='a'], '(WlCaITV)'))"/> + </identifier> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag='037']"> + <identifier type="stock number"> + <xsl:if test="marc:subfield[@code='c']"> + <xsl:attribute name="displayLabel"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">c</xsl:with-param> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ab</xsl:with-param> + </xsl:call-template> + </identifier> + </xsl:for-each> + + + <!-- 1.51 tmee 20100129--> + <xsl:for-each select="marc:datafield[@tag='856'][marc:subfield[@code='u']]"> + <xsl:if 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') "> + <identifier> + <xsl:attribute name="type"> + <xsl:if test="starts-with(marc:subfield[@code='u'],'urn:doi') or starts-with(marc:subfield[@code='u'],'doi')">doi</xsl:if> + <xsl:if 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:if> + </xsl:attribute> + <xsl:value-of select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))"/> + </identifier> + </xsl:if> + <xsl:if test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl')"> + <identifier type="hdl"> + <xsl:if test="marc:subfield[@code='y' or @code='3' or @code='z']"> + <xsl:attribute name="displayLabel"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">y3z</xsl:with-param> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))"/> + </identifier> + </xsl:if> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=024][@ind1=1]"> + <identifier type="upc"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </identifier> + </xsl:for-each> + + + <!-- 1.51 tmee 20100129 removed duplicate code 20131217 + <xsl:for-each select="marc:datafield[@tag='856'][marc:subfield[@code='u']]"> + <xsl:if + 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') "> + <identifier> + <xsl:attribute name="type"> + <xsl:if + test="starts-with(marc:subfield[@code='u'],'urn:doi') or starts-with(marc:subfield[@code='u'],'doi')" + >doi</xsl:if> + <xsl:if + 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:if> + </xsl:attribute> + <xsl:value-of + select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))" + /> + </identifier> + </xsl:if> + + <xsl:if + test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl')"> + <identifier type="hdl"> + <xsl:if test="marc:subfield[@code='y' or @code='3' or @code='z']"> + <xsl:attribute name="displayLabel"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">y3z</xsl:with-param> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:value-of + select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))" + /> + </identifier> + </xsl:if> + </xsl:for-each> + --> + + + <xsl:for-each select="marc:datafield[@tag=856][@ind2=2][marc:subfield[@code='u']]"> + <relatedItem> + <location> + <url> + <xsl:if test="marc:subfield[@code='y' or @code='3']"> + <xsl:attribute name="displayLabel"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">y3</xsl:with-param> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="marc:subfield[@code='z']"> + <xsl:attribute name="note"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">z</xsl:with-param> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="marc:subfield[@code='u']"/> + </url> + </location> + </relatedItem> + </xsl:for-each> + + <recordInfo> + <xsl:for-each select="marc:leader[substring($leader,19,1)='a']"> + <descriptionStandard>aacr</descriptionStandard> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=040]"> + <xsl:if test="marc:subfield[@code='e']"> + <descriptionStandard> + <xsl:value-of select="marc:subfield[@code='e']"/> + </descriptionStandard> + </xsl:if> + <recordContentSource authority="marcorg"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </recordContentSource> + </xsl:for-each> + <xsl:for-each select="marc:controlfield[@tag=008]"> + <recordCreationDate encoding="marc"> + <xsl:value-of select="substring(.,1,6)"/> + </recordCreationDate> + </xsl:for-each> + + <xsl:for-each select="marc:controlfield[@tag=005]"> + <recordChangeDate encoding="iso8601"> + <xsl:value-of select="."/> + </recordChangeDate> + </xsl:for-each> + <xsl:for-each select="marc:controlfield[@tag=001]"> + <recordIdentifier> + <xsl:if test="../marc:controlfield[@tag=003]"> + <xsl:attribute name="source"> + <xsl:value-of select="../marc:controlfield[@tag=003]"/> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="."/> + </recordIdentifier> + </xsl:for-each> + + <recordOrigin>Converted from MARCXML to MODS version 3.6 using MARC21slim2MODS3-6.xsl + (Revision 1.119 2018/06/21)</recordOrigin> + + <xsl:for-each select="marc:datafield[@tag=040]/marc:subfield[@code='b']"> + <languageOfCataloging> + <languageTerm authority="iso639-2b" type="code"> + <xsl:value-of select="."/> + </languageTerm> + </languageOfCataloging> + </xsl:for-each> + </recordInfo> + </xsl:template> + + <xsl:template name="displayForm"> + <xsl:for-each select="marc:subfield[@code='c']"> + <displayForm> + <xsl:value-of select="."/> + </displayForm> + </xsl:for-each> + </xsl:template> + <xsl:template name="affiliation"> + <xsl:for-each select="marc:subfield[@code='u']"> + <affiliation> + <xsl:value-of select="."/> + </affiliation> + </xsl:for-each> + </xsl:template> + <xsl:template name="uri"> + <xsl:for-each select="marc:subfield[@code='u']|marc:subfield[@code='0']"> + <xsl:attribute name="xlink:href"> + <xsl:value-of select="."/> + </xsl:attribute> + </xsl:for-each> + </xsl:template> + <xsl:template name="role"> + <xsl:for-each select="marc:subfield[@code='e']"> + <role> + <roleTerm type="text"> + <xsl:value-of select="."/> + </roleTerm> + </role> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='4']"> + <role> + <roleTerm authority="marcrelator" type="code"> + <xsl:value-of select="."/> + </roleTerm> + </role> + </xsl:for-each> + </xsl:template> + <xsl:template name="part"> + <xsl:variable name="partNumber"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="axis">n</xsl:with-param> + <xsl:with-param name="anyCodes">n</xsl:with-param> + <xsl:with-param name="afterCodes">fgkdlmor</xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="partName"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="axis">p</xsl:with-param> + <xsl:with-param name="anyCodes">p</xsl:with-param> + <xsl:with-param name="afterCodes">fgkdlmor</xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:if test="string-length(normalize-space($partNumber))"> + <partNumber> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="$partNumber"/> + </xsl:call-template> + </partNumber> + </xsl:if> + <xsl:if test="string-length(normalize-space($partName))"> + <partName> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="$partName"/> + </xsl:call-template> + </partName> + </xsl:if> + </xsl:template> + <xsl:template name="relatedPart"> + <xsl:if test="@tag=773"> + <xsl:for-each select="marc:subfield[@code='g']"> + <part> + <text> + <xsl:value-of select="."/> + </text> + </part> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='q']"> + <part> + <xsl:call-template name="parsePart"/> + </part> + </xsl:for-each> + </xsl:if> + </xsl:template> + <xsl:template name="relatedPartNumName"> + <xsl:variable name="partNumber"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="axis">g</xsl:with-param> + <xsl:with-param name="anyCodes">g</xsl:with-param> + <xsl:with-param name="afterCodes">pst</xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="partName"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="axis">p</xsl:with-param> + <xsl:with-param name="anyCodes">p</xsl:with-param> + <xsl:with-param name="afterCodes">fgkdlmor</xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:if test="string-length(normalize-space($partNumber))"> + <partNumber> + <xsl:value-of select="$partNumber"/> + </partNumber> + </xsl:if> + <xsl:if test="string-length(normalize-space($partName))"> + <partName> + <xsl:value-of select="$partName"/> + </partName> + </xsl:if> + </xsl:template> + <xsl:template name="relatedName"> + <xsl:for-each select="marc:subfield[@code='a']"> + <name> + <namePart> + <xsl:value-of select="."/> + </namePart> + </name> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedForm"> + <xsl:for-each select="marc:subfield[@code='h']"> + <physicalDescription> + <form> + <xsl:value-of select="."/> + </form> + </physicalDescription> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedExtent"> + <xsl:for-each select="marc:subfield[@code='h']"> + <physicalDescription> + <extent> + <xsl:value-of select="."/> + </extent> + </physicalDescription> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedNote"> + <xsl:for-each select="marc:subfield[@code='n']"> + <note> + <xsl:value-of select="."/> + </note> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedSubject"> + <xsl:for-each select="marc:subfield[@code='j']"> + <subject> + <temporal encoding="iso8601"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </temporal> + </subject> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedIdentifierISSN"> + <xsl:for-each select="marc:subfield[@code='x']"> + <identifier type="issn"> + <xsl:value-of select="."/> + </identifier> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedIdentifierLocal"> + <xsl:for-each select="marc:subfield[@code='w']"> + <identifier type="local"> + <xsl:value-of select="."/> + </identifier> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedIdentifier"> + <xsl:for-each select="marc:subfield[@code='o']"> + <identifier> + <xsl:value-of select="."/> + </identifier> + </xsl:for-each> + </xsl:template> + + <!--tmee 1.40 510 isReferencedBy --> + <xsl:template name="relatedItem510"> + <xsl:call-template name="displayLabel"/> + <xsl:call-template name="relatedTitle76X-78X"/> + <xsl:call-template name="relatedName"/> + <xsl:call-template name="relatedOriginInfo510"/> + <xsl:call-template name="relatedLanguage"/> + <xsl:call-template name="relatedExtent"/> + <xsl:call-template name="relatedNote"/> + <xsl:call-template name="relatedSubject"/> + <xsl:call-template name="relatedIdentifier"/> + <xsl:call-template name="relatedIdentifierISSN"/> + <xsl:call-template name="relatedIdentifierLocal"/> + <xsl:call-template name="relatedPart"/> + </xsl:template> + <xsl:template name="relatedItem76X-78X"> + <xsl:call-template name="displayLabel"/> + <xsl:call-template name="relatedTitle76X-78X"/> + <xsl:call-template name="relatedName"/> + <xsl:call-template name="relatedOriginInfo"/> + <xsl:call-template name="relatedLanguage"/> + <xsl:call-template name="relatedExtent"/> + <xsl:call-template name="relatedNote"/> + <xsl:call-template name="relatedSubject"/> + <xsl:call-template name="relatedIdentifier"/> + <xsl:call-template name="relatedIdentifierISSN"/> + <xsl:call-template name="relatedIdentifierLocal"/> + <xsl:call-template name="relatedPart"/> + </xsl:template> + <xsl:template name="subjectGeographicZ"> + <geographic> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </geographic> + </xsl:template> + <xsl:template name="subjectTemporalY"> + <temporal> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </temporal> + </xsl:template> + <xsl:template name="subjectTopic"> + <topic> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </topic> + </xsl:template> + <!-- 3.2 change tmee 6xx $v genre --> + <xsl:template name="subjectGenre"> + <genre> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </genre> + </xsl:template> + + <xsl:template name="nameABCDN"> + <xsl:for-each select="marc:subfield[@code='a']"> + <namePart> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </namePart> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='b']"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </xsl:for-each> + <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']"> + <namePart> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">cdn</xsl:with-param> + </xsl:call-template> + </namePart> + </xsl:if> + </xsl:template> + <xsl:template name="nameABCDQ"> + <namePart> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">aq</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="punctuation"> + <xsl:text>:,;/ </xsl:text> + </xsl:with-param> + </xsl:call-template> + </namePart> + <xsl:call-template name="termsOfAddress"/> + <xsl:call-template name="nameDate"/> + </xsl:template> + <xsl:template name="nameACDEQ"> + <namePart> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">acdeq</xsl:with-param> + </xsl:call-template> + </namePart> + </xsl:template> + + <!--1.104 20141104--> + <xsl:template name="nameACDENQ"> + <namePart> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">acdenq</xsl:with-param> + </xsl:call-template> + </namePart> + </xsl:template> + + <!-- 1.116 --> + <xsl:template name="nameIdentifier"> + <xsl:if test="marc:subfield[@code='0']"> + <nameIdentifier> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">0</xsl:with-param> + </xsl:call-template> + </nameIdentifier> + </xsl:if> + </xsl:template> + + + <xsl:template name="constituentOrRelatedType"> + <xsl:if test="@ind2=2"> + <xsl:attribute name="type">constituent</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template name="relatedTitle"> + <xsl:for-each select="marc:subfield[@code='t']"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="."/> + </xsl:with-param> + </xsl:call-template> + </title> + </titleInfo> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedTitle76X-78X"> + <xsl:for-each select="marc:subfield[@code='t']"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="."/> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']"> + <xsl:call-template name="relatedPartNumName"/> + </xsl:if> + </titleInfo> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='p']"> + <titleInfo type="abbreviated"> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="."/> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']"> + <xsl:call-template name="relatedPartNumName"/> + </xsl:if> + </titleInfo> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='s']"> + <titleInfo type="uniform"> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="."/> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']"> + <xsl:call-template name="relatedPartNumName"/> + </xsl:if> + </titleInfo> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedOriginInfo"> + <xsl:if test="marc:subfield[@code='b' or @code='d'] or marc:subfield[@code='f']"> + <originInfo> + <xsl:if test="@tag=775"> + <xsl:for-each select="marc:subfield[@code='f']"> + <place> + <placeTerm> + <xsl:attribute name="type">code</xsl:attribute> + <xsl:attribute name="authority">marcgac</xsl:attribute> + <xsl:value-of select="."/> + </placeTerm> + </place> + </xsl:for-each> + </xsl:if> + <xsl:for-each select="marc:subfield[@code='d']"> + <publisher> + <xsl:value-of select="."/> + </publisher> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='b']"> + <edition> + <xsl:value-of select="."/> + </edition> + </xsl:for-each> + </originInfo> + </xsl:if> + </xsl:template> + + <!-- tmee 1.40 --> + + <xsl:template name="relatedOriginInfo510"> + <xsl:for-each select="marc:subfield[@code='b']"> + <originInfo> + <dateOther type="coverage"> + <xsl:value-of select="."/> + </dateOther> + </originInfo> + </xsl:for-each> + </xsl:template> + <xsl:template name="relatedLanguage"> + <xsl:for-each select="marc:subfield[@code='e']"> + <xsl:call-template name="getLanguage"> + <xsl:with-param name="langString"> + <xsl:value-of select="."/> + </xsl:with-param> + </xsl:call-template> + </xsl:for-each> + </xsl:template> + <xsl:template name="nameDate"> + <xsl:for-each select="marc:subfield[@code='d']"> + <namePart type="date"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </namePart> + </xsl:for-each> + </xsl:template> + <xsl:template name="subjectAuthority"> + <xsl:if test="@ind2!=4"> + <xsl:if test="@ind2!=' '"> + <xsl:if test="@ind2!=8"> + <xsl:if test="@ind2!=9"> + <xsl:attribute name="authority"> + <xsl:choose> + <xsl:when test="@ind2=0">lcsh</xsl:when> + <xsl:when test="@ind2=1">lcshac</xsl:when> + <xsl:when test="@ind2=2">mesh</xsl:when> + <!-- 1/04 fix --> + <xsl:when test="@ind2=3">nal</xsl:when> + <xsl:when test="@ind2=5">csh</xsl:when> + <xsl:when test="@ind2=6">rvm</xsl:when> + <xsl:when test="@ind2=7"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:when> + </xsl:choose> + </xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:if> + </xsl:if> + </xsl:template> + <!-- 1.75 + fix --> + <xsl:template name="subject653Type"> + <xsl:if test="@ind2!=' '"> + <xsl:if test="@ind2!='0'"> + <xsl:if test="@ind2!='4'"> + <xsl:if test="@ind2!='5'"> + <xsl:if test="@ind2!='6'"> + <xsl:if test="@ind2!='7'"> + <xsl:if test="@ind2!='8'"> + <xsl:if test="@ind2!='9'"> + <xsl:attribute name="type"> + <xsl:choose> + <xsl:when test="@ind2=1">personal</xsl:when> + <xsl:when test="@ind2=2">corporate</xsl:when> + <xsl:when test="@ind2=3">conference</xsl:when> + </xsl:choose> + </xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:if> + </xsl:if> + </xsl:if> + </xsl:if> + </xsl:if> + </xsl:if> + + + </xsl:template> + <xsl:template name="subjectAnyOrder"> + <xsl:for-each select="marc:subfield[@code='v' or @code='x' or @code='y' or @code='z']"> + <xsl:choose> + <xsl:when test="@code='v'"> + <xsl:call-template name="subjectGenre"/> + </xsl:when> + <xsl:when test="@code='x'"> + <xsl:call-template name="subjectTopic"/> + </xsl:when> + <xsl:when test="@code='y'"> + <xsl:call-template name="subjectTemporalY"/> + </xsl:when> + <xsl:when test="@code='z'"> + <xsl:call-template name="subjectGeographicZ"/> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template name="specialSubfieldSelect"> + <xsl:param name="anyCodes"/> + <xsl:param name="axis"/> + <xsl:param name="beforeCodes"/> + <xsl:param name="afterCodes"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield"> + <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])"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </xsl:template> + + + <xsl:template match="marc:datafield[@tag=656]"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:if test="marc:subfield[@code=2]"> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code=2]"/> + </xsl:attribute> + </xsl:if> + <occupation> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </xsl:with-param> + </xsl:call-template> + </occupation> + </subject> + </xsl:template> + <xsl:template name="termsOfAddress"> + <xsl:if test="marc:subfield[@code='b' or @code='c']"> + <namePart type="termsOfAddress"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">bc</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </namePart> + </xsl:if> + </xsl:template> + <xsl:template name="displayLabel"> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:attribute name="displayLabel"> + <xsl:value-of select="marc:subfield[@code='i']"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="marc:subfield[@code='3']"> + <xsl:attribute name="displayLabel"> + <xsl:value-of select="marc:subfield[@code='3']"/> + </xsl:attribute> + </xsl:if> + </xsl:template> + + <!-- isInvalid + <xsl:template name="isInvalid"> + <xsl:param name="type"/> + <xsl:if + test="marc:subfield[@code='z'] or marc:subfield[@code='y'] or marc:subfield[@code='m']"> + <identifier> + <xsl:attribute name="type"> + <xsl:value-of select="$type"/> + </xsl:attribute> + <xsl:attribute name="invalid"> + <xsl:text>yes</xsl:text> + </xsl:attribute> + <xsl:if test="marc:subfield[@code='z']"> + <xsl:value-of select="marc:subfield[@code='z']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='y']"> + <xsl:value-of select="marc:subfield[@code='y']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='m']"> + <xsl:value-of select="marc:subfield[@code='m']"/> + </xsl:if> + </identifier> + </xsl:if> + </xsl:template> + --> + <xsl:template name="subtitle"> + <xsl:if test="marc:subfield[@code='b']"> + <subTitle> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:subfield[@code='b']"/> + <!--<xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">b</xsl:with-param> + </xsl:call-template>--> + </xsl:with-param> + </xsl:call-template> + </subTitle> + </xsl:if> + </xsl:template> + <xsl:template name="script"> + <xsl:param name="scriptCode"/> + <xsl:attribute name="script"> + <xsl:choose> + <!-- ISO 15924 and CJK is a local code 20101123--> + <xsl:when test="$scriptCode='(3'">Arab</xsl:when> + <xsl:when test="$scriptCode='(4'">Arab</xsl:when> + <xsl:when test="$scriptCode='(B'">Latn</xsl:when> + <xsl:when test="$scriptCode='!E'">Latn</xsl:when> + <xsl:when test="$scriptCode='$1'">CJK</xsl:when> + <xsl:when test="$scriptCode='(N'">Cyrl</xsl:when> + <xsl:when test="$scriptCode='(Q'">Cyrl</xsl:when> + <xsl:when test="$scriptCode='(2'">Hebr</xsl:when> + <xsl:when test="$scriptCode='(S'">Grek</xsl:when> + </xsl:choose> + </xsl:attribute> + </xsl:template> + <xsl:template name="parsePart"> + <!-- assumes 773$q= 1:2:3<4 + with up to 3 levels and one optional start page + --> + <xsl:variable name="level1"> + <xsl:choose> + <xsl:when test="contains(text(),':')"> + <!-- 1:2 --> + <xsl:value-of select="substring-before(text(),':')"/> + </xsl:when> + <xsl:when test="not(contains(text(),':'))"> + <!-- 1 or 1<3 --> + <xsl:if test="contains(text(),'<')"> + <!-- 1<3 --> + <xsl:value-of select="substring-before(text(),'<')"/> + </xsl:if> + <xsl:if test="not(contains(text(),'<'))"> + <!-- 1 --> + <xsl:value-of select="text()"/> + </xsl:if> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="sici2"> + <xsl:choose> + <xsl:when test="starts-with(substring-after(text(),$level1),':')"> + <xsl:value-of select="substring(substring-after(text(),$level1),2)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after(text(),$level1)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="level2"> + <xsl:choose> + <xsl:when test="contains($sici2,':')"> + <!-- 2:3<4 --> + <xsl:value-of select="substring-before($sici2,':')"/> + </xsl:when> + <xsl:when test="contains($sici2,'<')"> + <!-- 1: 2<4 --> + <xsl:value-of select="substring-before($sici2,'<')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$sici2"/> + <!-- 1:2 --> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="sici3"> + <xsl:choose> + <xsl:when test="starts-with(substring-after($sici2,$level2),':')"> + <xsl:value-of select="substring(substring-after($sici2,$level2),2)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after($sici2,$level2)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="level3"> + <xsl:choose> + <xsl:when test="contains($sici3,'<')"> + <!-- 2<4 --> + <xsl:value-of select="substring-before($sici3,'<')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$sici3"/> + <!-- 3 --> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="page"> + <xsl:if test="contains(text(),'<')"> + <xsl:value-of select="substring-after(text(),'<')"/> + </xsl:if> + </xsl:variable> + <xsl:if test="$level1"> + <detail level="1"> + <number> + <xsl:value-of select="$level1"/> + </number> + </detail> + </xsl:if> + <xsl:if test="$level2"> + <detail level="2"> + <number> + <xsl:value-of select="$level2"/> + </number> + </detail> + </xsl:if> + <xsl:if test="$level3"> + <detail level="3"> + <number> + <xsl:value-of select="$level3"/> + </number> + </detail> + </xsl:if> + <xsl:if test="$page"> + <extent unit="page"> + <start> + <xsl:value-of select="$page"/> + </start> + </extent> + </xsl:if> + </xsl:template> + <xsl:template name="getLanguage"> + <xsl:param name="langString"/> + <xsl:param name="controlField008-35-37"/> + <xsl:variable name="length" select="string-length($langString)"/> + <xsl:choose> + <xsl:when test="$length=0"/> + <xsl:when test="$controlField008-35-37=substring($langString,1,3)"> + <xsl:call-template name="getLanguage"> + <xsl:with-param name="langString" select="substring($langString,4,$length)"/> + <xsl:with-param name="controlField008-35-37" select="$controlField008-35-37"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <language> + <languageTerm authority="iso639-2b" type="code"> + <xsl:value-of select="substring($langString,1,3)"/> + </languageTerm> + </language> + <xsl:call-template name="getLanguage"> + <xsl:with-param name="langString" select="substring($langString,4,$length)"/> + <xsl:with-param name="controlField008-35-37" select="$controlField008-35-37"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="isoLanguage"> + <xsl:param name="currentLanguage"/> + <xsl:param name="usedLanguages"/> + <xsl:param name="remainingLanguages"/> + <xsl:choose> + <xsl:when test="string-length($currentLanguage)=0"/> + <xsl:when test="not(contains($usedLanguages, $currentLanguage))"> + <language> + <xsl:if test="@code!='a'"> + <xsl:attribute name="objectPart"> + <xsl:choose> + <xsl:when test="@code='b'">summary or subtitle</xsl:when> + <xsl:when test="@code='d'">sung or spoken text</xsl:when> + <xsl:when test="@code='e'">libretto</xsl:when> + <xsl:when test="@code='f'">table of contents</xsl:when> + <xsl:when test="@code='g'">accompanying material</xsl:when> + <xsl:when test="@code='h'">translation</xsl:when> + </xsl:choose> + </xsl:attribute> + </xsl:if> + <languageTerm authority="iso639-2b" type="code"> + <xsl:value-of select="$currentLanguage"/> + </languageTerm> + </language> + <xsl:call-template name="isoLanguage"> + <xsl:with-param name="currentLanguage"> + <xsl:value-of select="substring($remainingLanguages,1,3)"/> + </xsl:with-param> + <xsl:with-param name="usedLanguages"> + <xsl:value-of select="concat($usedLanguages,$currentLanguage)"/> + </xsl:with-param> + <xsl:with-param name="remainingLanguages"> + <xsl:value-of select="substring($remainingLanguages,4,string-length($remainingLanguages))"/> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="isoLanguage"> + <xsl:with-param name="currentLanguage"> + <xsl:value-of select="substring($remainingLanguages,1,3)"/> + </xsl:with-param> + <xsl:with-param name="usedLanguages"> + <xsl:value-of select="concat($usedLanguages,$currentLanguage)"/> + </xsl:with-param> + <xsl:with-param name="remainingLanguages"> + <xsl:value-of select="substring($remainingLanguages,4,string-length($remainingLanguages))"/> + </xsl:with-param> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="chopBrackets"> + <xsl:param name="chopString"/> + <xsl:variable name="string"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="$chopString"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="substring($string, 1,1)='['"> + <xsl:value-of select="substring($string,2, string-length($string)-2)"/> + </xsl:if> + <xsl:if test="substring($string, 1,1)!='['"> + <xsl:value-of select="$string"/> + </xsl:if> + </xsl:template> + <xsl:template name="rfcLanguages"> + <xsl:param name="nodeNum"/> + <xsl:param name="usedLanguages"/> + <xsl:param name="controlField008-35-37"/> + <xsl:variable name="currentLanguage" select="."/> + <xsl:choose> + <xsl:when test="not($currentLanguage)"/> + <xsl:when test="$currentLanguage!=$controlField008-35-37 and $currentLanguage!='rfc3066'"> + <xsl:if test="not(contains($usedLanguages,$currentLanguage))"> + <language> + <xsl:if test="@code!='a'"> + <xsl:attribute name="objectPart"> + <xsl:choose> + <xsl:when test="@code='b'">summary or subtitle</xsl:when> + <xsl:when test="@code='d'">sung or spoken text</xsl:when> + <xsl:when test="@code='e'">libretto</xsl:when> + <xsl:when test="@code='f'">table of contents</xsl:when> + <xsl:when test="@code='g'">accompanying material</xsl:when> + <xsl:when test="@code='h'">translation</xsl:when> + </xsl:choose> + </xsl:attribute> + </xsl:if> + <languageTerm authority="rfc3066" type="code"> + <xsl:value-of select="$currentLanguage"/> + </languageTerm> + </language> + </xsl:if> + </xsl:when> + <xsl:otherwise> </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- tmee added 20100106 for 045$b BC and CE date range info --> + <xsl:template name="dates045b"> + <xsl:param name="str"/> + <xsl:variable name="first-char" select="substring($str,1,1)"/> + <xsl:choose> + <xsl:when test="$first-char ='c'"> + <xsl:value-of select="concat ('-', substring($str, 2))"/> + </xsl:when> + <xsl:when test="$first-char ='d'"> + <xsl:value-of select="substring($str, 2)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$str"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="scriptCode"> + <xsl:variable name="sf06" select="normalize-space(child::marc:subfield[@code='6'])"/> + <xsl:variable name="sf06a" select="substring($sf06, 1, 3)"/> + <xsl:variable name="sf06b" select="substring($sf06, 5, 2)"/> + <xsl:variable name="sf06c" select="substring($sf06, 7)"/> + <xsl:variable name="scriptCode" select="substring($sf06, 8, 2)"/> + <xsl:if test="//marc:datafield/marc:subfield[@code='6']"> + <xsl:attribute name="script"> + <xsl:choose> + <xsl:when test="$scriptCode=''">Latn</xsl:when> + <xsl:when test="$scriptCode='(3'">Arab</xsl:when> + <xsl:when test="$scriptCode='(4'">Arab</xsl:when> + <xsl:when test="$scriptCode='(B'">Latn</xsl:when> + <xsl:when test="$scriptCode='!E'">Latn</xsl:when> + <xsl:when test="$scriptCode='$1'">CJK</xsl:when> + <xsl:when test="$scriptCode='(N'">Cyrl</xsl:when> + <xsl:when test="$scriptCode='(Q'">Cyrl</xsl:when> + <xsl:when test="$scriptCode='(2'">Hebr</xsl:when> + <xsl:when test="$scriptCode='(S'">Grek</xsl:when> + </xsl:choose> + </xsl:attribute> + </xsl:if> + </xsl:template> + + <!-- tmee 20100927 for 880s & corresponding fields 20101123 scriptCode --> + + <xsl:template name="xxx880"> + <xsl:if test="child::marc:subfield[@code='6']"> + <xsl:variable name="sf06" select="normalize-space(child::marc:subfield[@code='6'])"/> + <xsl:variable name="sf06a" select="substring($sf06, 1, 3)"/> + <xsl:variable name="sf06b" select="substring($sf06, 5, 2)"/> + <xsl:variable name="sf06c" select="substring($sf06, 7)"/> + <xsl:variable name="scriptCode" select="substring($sf06, 8, 2)"/> + <xsl:if test="//marc:datafield/marc:subfield[@code='6']"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="$sf06b"/> + </xsl:attribute> + <xsl:attribute name="script"> + <xsl:choose> + <xsl:when test="$scriptCode=''">Latn</xsl:when> + <xsl:when test="$scriptCode='(3'">Arab</xsl:when> + <xsl:when test="$scriptCode='(4'">Arab</xsl:when> + <xsl:when test="$scriptCode='(B'">Latn</xsl:when> + <xsl:when test="$scriptCode='!E'">Latn</xsl:when> + <xsl:when test="$scriptCode='$1'">CJK</xsl:when> + <xsl:when test="$scriptCode='(N'">Cyrl</xsl:when> + <xsl:when test="$scriptCode='(Q'">Cyrl</xsl:when> + <xsl:when test="$scriptCode='(2'">Hebr</xsl:when> + <xsl:when test="$scriptCode='(S'">Grek</xsl:when> + </xsl:choose> + </xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:template> + + <xsl:template name="yyy880"> + <xsl:if test="preceding-sibling::marc:subfield[@code='6']"> + <xsl:variable name="sf06" select="normalize-space(preceding-sibling::marc:subfield[@code='6'])"/> + <xsl:variable name="sf06a" select="substring($sf06, 1, 3)"/> + <xsl:variable name="sf06b" select="substring($sf06, 5, 2)"/> + <xsl:variable name="sf06c" select="substring($sf06, 7)"/> + <xsl:if test="//marc:datafield/marc:subfield[@code='6']"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="$sf06b"/> + </xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:template> + + <xsl:template name="z2xx880"> + <!-- Evaluating the 260 field --> + <xsl:variable name="x260"> + <xsl:choose> + <xsl:when test="@tag='260' and marc:subfield[@code='6']"> + <xsl:variable name="sf06260" select="normalize-space(child::marc:subfield[@code='6'])"/> + <xsl:variable name="sf06260a" select="substring($sf06260, 1, 3)"/> + <xsl:variable name="sf06260b" select="substring($sf06260, 5, 2)"/> + <xsl:variable name="sf06260c" select="substring($sf06260, 7)"/> + <xsl:value-of select="$sf06260b"/> + </xsl:when> + <xsl:when test="@tag='250' and ../marc:datafield[@tag='260']/marc:subfield[@code='6']"> + <xsl:variable name="sf06260" select="normalize-space(../marc:datafield[@tag='260']/marc:subfield[@code='6'])"/> + <xsl:variable name="sf06260a" select="substring($sf06260, 1, 3)"/> + <xsl:variable name="sf06260b" select="substring($sf06260, 5, 2)"/> + <xsl:variable name="sf06260c" select="substring($sf06260, 7)"/> + <xsl:value-of select="$sf06260b"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="x250"> + <xsl:choose> + <xsl:when test="@tag='250' and marc:subfield[@code='6']"> + <xsl:variable name="sf06250" select="normalize-space(../marc:datafield[@tag='250']/marc:subfield[@code='6'])"/> + <xsl:variable name="sf06250a" select="substring($sf06250, 1, 3)"/> + <xsl:variable name="sf06250b" select="substring($sf06250, 5, 2)"/> + <xsl:variable name="sf06250c" select="substring($sf06250, 7)"/> + <xsl:value-of select="$sf06250b"/> + </xsl:when> + <xsl:when test="@tag='260' and ../marc:datafield[@tag='250']/marc:subfield[@code='6']"> + <xsl:variable name="sf06250" select="normalize-space(../marc:datafield[@tag='250']/marc:subfield[@code='6'])"/> + <xsl:variable name="sf06250a" select="substring($sf06250, 1, 3)"/> + <xsl:variable name="sf06250b" select="substring($sf06250, 5, 2)"/> + <xsl:variable name="sf06250c" select="substring($sf06250, 7)"/> + <xsl:value-of select="$sf06250b"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:choose> + <xsl:when test="$x250!='' and $x260!=''"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="concat($x250, $x260)"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$x250!=''"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="$x250"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$x260!=''"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="$x260"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="//marc:datafield/marc:subfield[@code='6']"> </xsl:if> + </xsl:template> + + <xsl:template name="z3xx880"> + <!-- Evaluating the 300 field --> + <xsl:variable name="x300"> + <xsl:choose> + <xsl:when test="@tag='300' and marc:subfield[@code='6']"> + <xsl:variable name="sf06300" select="normalize-space(child::marc:subfield[@code='6'])"/> + <xsl:variable name="sf06300a" select="substring($sf06300, 1, 3)"/> + <xsl:variable name="sf06300b" select="substring($sf06300, 5, 2)"/> + <xsl:variable name="sf06300c" select="substring($sf06300, 7)"/> + <xsl:value-of select="$sf06300b"/> + </xsl:when> + <xsl:when test="@tag='351' and ../marc:datafield[@tag='300']/marc:subfield[@code='6']"> + <xsl:variable name="sf06300" select="normalize-space(../marc:datafield[@tag='300']/marc:subfield[@code='6'])"/> + <xsl:variable name="sf06300a" select="substring($sf06300, 1, 3)"/> + <xsl:variable name="sf06300b" select="substring($sf06300, 5, 2)"/> + <xsl:variable name="sf06300c" select="substring($sf06300, 7)"/> + <xsl:value-of select="$sf06300b"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="x351"> + <xsl:choose> + <xsl:when test="@tag='351' and marc:subfield[@code='6']"> + <xsl:variable name="sf06351" select="normalize-space(../marc:datafield[@tag='351']/marc:subfield[@code='6'])"/> + <xsl:variable name="sf06351a" select="substring($sf06351, 1, 3)"/> + <xsl:variable name="sf06351b" select="substring($sf06351, 5, 2)"/> + <xsl:variable name="sf06351c" select="substring($sf06351, 7)"/> + <xsl:value-of select="$sf06351b"/> + </xsl:when> + <xsl:when test="@tag='300' and ../marc:datafield[@tag='351']/marc:subfield[@code='6']"> + <xsl:variable name="sf06351" select="normalize-space(../marc:datafield[@tag='351']/marc:subfield[@code='6'])"/> + <xsl:variable name="sf06351a" select="substring($sf06351, 1, 3)"/> + <xsl:variable name="sf06351b" select="substring($sf06351, 5, 2)"/> + <xsl:variable name="sf06351c" select="substring($sf06351, 7)"/> + <xsl:value-of select="$sf06351b"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="x337"> + <xsl:if test="@tag='337' and marc:subfield[@code='6']"> + <xsl:variable name="sf06337" select="normalize-space(child::marc:subfield[@code='6'])"/> + <xsl:variable name="sf06337a" select="substring($sf06337, 1, 3)"/> + <xsl:variable name="sf06337b" select="substring($sf06337, 5, 2)"/> + <xsl:variable name="sf06337c" select="substring($sf06337, 7)"/> + <xsl:value-of select="$sf06337b"/> + </xsl:if> + </xsl:variable> + <xsl:variable name="x338"> + <xsl:if test="@tag='338' and marc:subfield[@code='6']"> + <xsl:variable name="sf06338" select="normalize-space(child::marc:subfield[@code='6'])"/> + <xsl:variable name="sf06338a" select="substring($sf06338, 1, 3)"/> + <xsl:variable name="sf06338b" select="substring($sf06338, 5, 2)"/> + <xsl:variable name="sf06338c" select="substring($sf06338, 7)"/> + <xsl:value-of select="$sf06338b"/> + </xsl:if> + </xsl:variable> + + <xsl:choose> + <xsl:when test="$x351!='' and $x300!=''"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="concat($x351, $x300, $x337, $x338)"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$x351!=''"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="$x351"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$x300!=''"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="$x300"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$x337!=''"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="$x351"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$x338!=''"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="$x300"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="//marc:datafield/marc:subfield[@code='6']"> </xsl:if> + </xsl:template> + + + + <xsl:template name="true880"> + <xsl:variable name="sf06" select="normalize-space(marc:subfield[@code='6'])"/> + <xsl:variable name="sf06a" select="substring($sf06, 1, 3)"/> + <xsl:variable name="sf06b" select="substring($sf06, 5, 2)"/> + <xsl:variable name="sf06c" select="substring($sf06, 7)"/> + <xsl:if test="//marc:datafield/marc:subfield[@code='6']"> + <xsl:attribute name="altRepGroup"> + <xsl:value-of select="$sf06b"/> + </xsl:attribute> + </xsl:if> + </xsl:template> + + <xsl:template match="marc:datafield" mode="trans880"> + <xsl:variable name="dataField880" select="//marc:datafield"/> + <xsl:variable name="sf06" select="normalize-space(marc:subfield[@code='6'])"/> + <xsl:variable name="sf06a" select="substring($sf06, 1, 3)"/> + <xsl:variable name="sf06b" select="substring($sf06, 4)"/> + <xsl:choose> + + <!--tranforms 880 equiv--> + + <xsl:when test="$sf06a='047'"> + <xsl:call-template name="createGenreFrom047"/> + </xsl:when> + <xsl:when test="$sf06a='336'"> + <xsl:call-template name="createGenreFrom336"/> + </xsl:when> + <xsl:when test="$sf06a='655'"> + <xsl:call-template name="createGenreFrom655"/> + </xsl:when> + + <xsl:when test="$sf06a='050'"> + <xsl:call-template name="createClassificationFrom050"/> + </xsl:when> + <xsl:when test="$sf06a='060'"> + <xsl:call-template name="createClassificationFrom060"/> + </xsl:when> + <xsl:when test="$sf06a='080'"> + <xsl:call-template name="createClassificationFrom080"/> + </xsl:when> + <xsl:when test="$sf06a='082'"> + <xsl:call-template name="createClassificationFrom082"/> + </xsl:when> + <xsl:when test="$sf06a='084'"> + <xsl:call-template name="createClassificationFrom080"/> + </xsl:when> + <xsl:when test="$sf06a='086'"> + <xsl:call-template name="createClassificationFrom082"/> + </xsl:when> + <xsl:when test="$sf06a='100'"> + <xsl:call-template name="createNameFrom100"/> + </xsl:when> + <xsl:when test="$sf06a='110'"> + <xsl:call-template name="createNameFrom110"/> + </xsl:when> + <xsl:when test="$sf06a='111'"> + <xsl:call-template name="createNameFrom110"/> + </xsl:when> + <xsl:when test="$sf06a='700'"> + <xsl:call-template name="createNameFrom700"/> + </xsl:when> + <xsl:when test="$sf06a='710'"> + <xsl:call-template name="createNameFrom710"/> + </xsl:when> + <xsl:when test="$sf06a='711'"> + <xsl:call-template name="createNameFrom710"/> + </xsl:when> + <xsl:when test="$sf06a='210'"> + <xsl:call-template name="createTitleInfoFrom210"/> + </xsl:when> + <xsl:when test="$sf06a='245'"> + <xsl:call-template name="createTitleInfoFrom245"/> + <xsl:call-template name="createNoteFrom245c"/> + </xsl:when> + <xsl:when test="$sf06a='246'"> + <xsl:call-template name="createTitleInfoFrom246"/> + </xsl:when> + <xsl:when test="$sf06a='240'"> + <xsl:call-template name="createTitleInfoFrom240"/> + </xsl:when> + <xsl:when test="$sf06a='740'"> + <xsl:call-template name="createTitleInfoFrom740"/> + </xsl:when> + + <xsl:when test="$sf06a='130'"> + <xsl:call-template name="createTitleInfoFrom130"/> + </xsl:when> + <xsl:when test="$sf06a='730'"> + <xsl:call-template name="createTitleInfoFrom730"/> + </xsl:when> + + <xsl:when test="$sf06a='505'"> + <xsl:call-template name="createTOCFrom505"/> + </xsl:when> + <xsl:when test="$sf06a='520'"> + <xsl:call-template name="createAbstractFrom520"/> + </xsl:when> + <xsl:when test="$sf06a='521'"> + <xsl:call-template name="createTargetAudienceFrom521"/> + </xsl:when> + <xsl:when test="$sf06a='506'"> + <xsl:call-template name="createAccessConditionFrom506"/> + </xsl:when> + <xsl:when test="$sf06a='540'"> + <xsl:call-template name="createAccessConditionFrom540"/> + </xsl:when> + + <!-- note 245 362 etc --> + + <xsl:when test="$sf06a='245'"> + <xsl:call-template name="createNoteFrom245c"/> + </xsl:when> + <xsl:when test="$sf06a='362'"> + <xsl:call-template name="createNoteFrom362"/> + </xsl:when> + <xsl:when test="$sf06a='502'"> + <xsl:call-template name="createNoteFrom502"/> + </xsl:when> + <xsl:when test="$sf06a='504'"> + <xsl:call-template name="createNoteFrom504"/> + </xsl:when> + <xsl:when test="$sf06a='508'"> + <xsl:call-template name="createNoteFrom508"/> + </xsl:when> + <xsl:when test="$sf06a='511'"> + <xsl:call-template name="createNoteFrom511"/> + </xsl:when> + <xsl:when test="$sf06a='515'"> + <xsl:call-template name="createNoteFrom515"/> + </xsl:when> + <xsl:when test="$sf06a='518'"> + <xsl:call-template name="createNoteFrom518"/> + </xsl:when> + <xsl:when test="$sf06a='524'"> + <xsl:call-template name="createNoteFrom524"/> + </xsl:when> + <xsl:when test="$sf06a='530'"> + <xsl:call-template name="createNoteFrom530"/> + </xsl:when> + <xsl:when test="$sf06a='533'"> + <xsl:call-template name="createNoteFrom533"/> + </xsl:when> + <!-- + <xsl:when test="$sf06a='534'"> + <xsl:call-template name="createNoteFrom534"/> + </xsl:when> +--> + <xsl:when test="$sf06a='535'"> + <xsl:call-template name="createNoteFrom535"/> + </xsl:when> + <xsl:when test="$sf06a='536'"> + <xsl:call-template name="createNoteFrom536"/> + </xsl:when> + <xsl:when test="$sf06a='538'"> + <xsl:call-template name="createNoteFrom538"/> + </xsl:when> + <xsl:when test="$sf06a='541'"> + <xsl:call-template name="createNoteFrom541"/> + </xsl:when> + <xsl:when test="$sf06a='545'"> + <xsl:call-template name="createNoteFrom545"/> + </xsl:when> + <xsl:when test="$sf06a='546'"> + <xsl:call-template name="createNoteFrom546"/> + </xsl:when> + <xsl:when test="$sf06a='561'"> + <xsl:call-template name="createNoteFrom561"/> + </xsl:when> + <xsl:when test="$sf06a='562'"> + <xsl:call-template name="createNoteFrom562"/> + </xsl:when> + <xsl:when test="$sf06a='581'"> + <xsl:call-template name="createNoteFrom581"/> + </xsl:when> + <xsl:when test="$sf06a='583'"> + <xsl:call-template name="createNoteFrom583"/> + </xsl:when> + <xsl:when test="$sf06a='585'"> + <xsl:call-template name="createNoteFrom585"/> + </xsl:when> + + <!-- note 5XX --> + + <xsl:when test="$sf06a='501'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='507'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='513'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='514'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='516'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='522'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='525'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='526'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='544'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='552'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='555'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='556'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='565'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='567'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='580'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='584'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + <xsl:when test="$sf06a='586'"> + <xsl:call-template name="createNoteFrom5XX"/> + </xsl:when> + + <!-- subject 034 043 045 255 656 662 752 --> + + <xsl:when test="$sf06a='034'"> + <xsl:call-template name="createSubGeoFrom034"/> + </xsl:when> + <xsl:when test="$sf06a='043'"> + <xsl:call-template name="createSubGeoFrom043"/> + </xsl:when> + <xsl:when test="$sf06a='045'"> + <xsl:call-template name="createSubTemFrom045"/> + </xsl:when> + <xsl:when test="$sf06a='255'"> + <xsl:call-template name="createSubGeoFrom255"/> + </xsl:when> + + <xsl:when test="$sf06a='600'"> + <xsl:call-template name="createSubNameFrom600"/> + </xsl:when> + <xsl:when test="$sf06a='610'"> + <xsl:call-template name="createSubNameFrom610"/> + </xsl:when> + <xsl:when test="$sf06a='611'"> + <xsl:call-template name="createSubNameFrom611"/> + </xsl:when> + + <xsl:when test="$sf06a='630'"> + <xsl:call-template name="createSubTitleFrom630"/> + </xsl:when> + + <xsl:when test="$sf06a='648'"> + <xsl:call-template name="createSubChronFrom648"/> + </xsl:when> + <xsl:when test="$sf06a='650'"> + <xsl:call-template name="createSubTopFrom650"/> + </xsl:when> + <xsl:when test="$sf06a='651'"> + <xsl:call-template name="createSubGeoFrom651"/> + </xsl:when> + + + <xsl:when test="$sf06a='653'"> + <xsl:call-template name="createSubFrom653"/> + </xsl:when> + <xsl:when test="$sf06a='656'"> + <xsl:call-template name="createSubFrom656"/> + </xsl:when> + <xsl:when test="$sf06a='662'"> + <xsl:call-template name="createSubGeoFrom662752"/> + </xsl:when> + <xsl:when test="$sf06a='752'"> + <xsl:call-template name="createSubGeoFrom662752"/> + </xsl:when> + + <!-- location 852 856 --> + + <xsl:when test="$sf06a='852'"> + <xsl:call-template name="createLocationFrom852"/> + </xsl:when> + <xsl:when test="$sf06a='856'"> + <xsl:call-template name="createLocationFrom856"/> + </xsl:when> + + <xsl:when test="$sf06a='490'"> + <xsl:call-template name="createRelatedItemFrom490"/> + </xsl:when> + </xsl:choose> + </xsl:template> + + <!-- titleInfo 130 730 245 246 240 740 210 --> + + <!-- 130 tmee 1.101 20140806--> + <xsl:template name="createTitleInfoFrom130"> + + <titleInfo type="uniform"> + <title> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield"> + <xsl:if test="(contains('s',@code))"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:if test="(contains('adfklmors',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + + </xsl:template> + <xsl:template name="createTitleInfoFrom730"> + <titleInfo type="uniform"> + <title> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield"> + <xsl:if test="(contains('s',@code))"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:if test="(contains('adfklmors',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + </xsl:template> + + <xsl:template name="createTitleInfoFrom210"> + <titleInfo type="abbreviated"> + <xsl:if test="marc:datafield[@tag='210'][@ind2='2']"> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="xxx880"/> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">a</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="subtitle"/> + </titleInfo> + </xsl:template> + <!-- 1.79 --> + <xsl:template name="createTitleInfoFrom245"> + <titleInfo> + <xsl:call-template name="xxx880"/> + <xsl:variable name="title"> + <xsl:choose> + <xsl:when test="marc:subfield[@code='b']"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="axis">b</xsl:with-param> + <xsl:with-param name="beforeCodes">afgks</xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abfgks</xsl:with-param> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="titleChop"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="$title"/> + </xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="@ind2>0"> + <xsl:if test="@tag!='880'"> + <!-- 1.112 --> + <nonSort xml:space="preserve"><xsl:value-of select="substring($titleChop,1,@ind2)"/> </nonSort> + </xsl:if> + <title> + <xsl:value-of select="substring($titleChop,@ind2+1)"/> + </title> + </xsl:when> + <xsl:otherwise> + <title> + <xsl:value-of select="$titleChop"/> + </title> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="marc:subfield[@code='b']"> + <subTitle> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="axis">b</xsl:with-param> + <xsl:with-param name="anyCodes">b</xsl:with-param> + <xsl:with-param name="afterCodes">afgks</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </subTitle> + </xsl:if> + <xsl:call-template name="part"/> + </titleInfo> + </xsl:template> + + <xsl:template name="createTitleInfoFrom246"> + <titleInfo type="alternative"> + <xsl:call-template name="xxx880"/> + <xsl:for-each select="marc:subfield[@code='i']"> + <xsl:attribute name="displayLabel"> + <xsl:value-of select="text()"/> + </xsl:attribute> + </xsl:for-each> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <!-- 1/04 removed $h, $b --> + <xsl:with-param name="codes">af</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="subtitle"/> + <xsl:call-template name="part"/> + </titleInfo> + </xsl:template> + + <!-- 240 nameTitleGroup--> + <!-- 1.102 --> + + <xsl:template name="createTitleInfoFrom240"> + <titleInfo type="uniform"> + <xsl:if test="//marc:datafield[@tag='100']|//marc:datafield[@tag='110']|//marc:datafield[@tag='111']"> + <xsl:attribute name="nameTitleGroup"> + <xsl:text>1</xsl:text> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="xxx880"/> + <title> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield"> + <xsl:if test="(contains('adfklmors',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + </xsl:template> + + <xsl:template name="createTitleInfoFrom740"> + <titleInfo type="alternative"> + <xsl:call-template name="xxx880"/> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ah</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + </xsl:template> + + <!-- name 100 110 111 1.93 --> + + <xsl:template name="createNameFrom100"> + <xsl:if test="@ind1='0' or @ind1='1'"> + <name type="personal"> + <xsl:attribute name="usage"> + <xsl:text>primary</xsl:text> + </xsl:attribute> + <xsl:call-template name="xxx880"/> + <xsl:if test="//marc:datafield[@tag='240']"> + <xsl:attribute name="nameTitleGroup"> + <xsl:text>1</xsl:text> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="nameABCDQ"/> + <xsl:call-template name="affiliation"/> + <xsl:call-template name="role"/> + <!-- 1.116 --> + <xsl:call-template name="nameIdentifier"/> + </name> + </xsl:if> + <!-- 1.99 240 fix 20140804 --> + <xsl:if test="@ind1='3'"> + <name type="family"> + <xsl:attribute name="usage"> + <xsl:text>primary</xsl:text> + </xsl:attribute> + <xsl:call-template name="xxx880"/> + + <xsl:if test="ancestor::marcrecord//marc:datafield[@tag='240']"> + <xsl:attribute name="nameTitleGroup"> + <xsl:text>1</xsl:text> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="nameABCDQ"/> + <xsl:call-template name="affiliation"/> + <xsl:call-template name="role"/> + <!-- 1.116 --> + <xsl:call-template name="nameIdentifier"/> + </name> + </xsl:if> + </xsl:template> + + <xsl:template name="createNameFrom110"> + <name type="corporate"> + <xsl:call-template name="xxx880"/> + <xsl:if test="//marc:datafield[@tag='240']"> + <xsl:attribute name="nameTitleGroup"> + <xsl:text>1</xsl:text> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="nameABCDN"/> + <xsl:call-template name="role"/> + <!-- 1.116 --> + <xsl:call-template name="nameIdentifier"/> + </name> + </xsl:template> + + + <!-- 111 1.104 20141104 --> + + <xsl:template name="createNameFrom111"> + <name type="conference"> + <xsl:call-template name="xxx880"/> + <xsl:if test="//marc:datafield[@tag='240']"> + <xsl:attribute name="nameTitleGroup"> + <xsl:text>1</xsl:text> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="nameACDENQ"/> + <xsl:call-template name="role"/> + <!-- 1.116 --> + <xsl:call-template name="nameIdentifier"/> + </name> + </xsl:template> + + + + <!-- name 700 710 711 720 --> + + <xsl:template name="createNameFrom700"> + <xsl:if test="@ind1='0' or @ind1='1'"> + <name type="personal"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="nameABCDQ"/> + <xsl:call-template name="affiliation"/> + <xsl:call-template name="role"/> + <!-- 1.116 --> + <xsl:call-template name="nameIdentifier"/> + </name> + </xsl:if> + <xsl:if test="@ind1='3'"> + <name type="family"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="nameABCDQ"/> + <xsl:call-template name="affiliation"/> + <xsl:call-template name="role"/> + <!-- 1.116 --> + <xsl:call-template name="nameIdentifier"/> + </name> + </xsl:if> + </xsl:template> + + <xsl:template name="createNameFrom710"> + <!-- 1.117 --> + <name type="corporate"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="nameABCDN"/> + <xsl:call-template name="role"/> + <!-- 1.116 --> + <xsl:call-template name="nameIdentifier"/> + </name> + </xsl:template> + +<!-- 111 1.104 20141104 --> + <xsl:template name="createNameFrom711"> + <name type="conference"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="nameACDENQ"/> + <xsl:call-template name="role"/> + <!-- 1.116 --> + <xsl:call-template name="nameIdentifier"/> + </name> + </xsl:template> + + + <xsl:template name="createNameFrom720"> + <!-- 1.91 FLVC correction: the original if test will fail because of xpath: the current node (from the for-each above) is already the 720 datafield --> + <!-- <xsl:if test="marc:datafield[@tag='720'][not(marc:subfield[@code='t'])]"> --> + <xsl:if test="not(marc:subfield[@code='t'])"> + <name> + <xsl:if test="@ind1=1"> + <xsl:attribute name="type"> + <xsl:text>personal</xsl:text> + </xsl:attribute> + </xsl:if> + <namePart> + <xsl:value-of select="marc:subfield[@code='a']"/> + </namePart> + <xsl:call-template name="role"/> + </name> + </xsl:if> + </xsl:template> + + + + <!-- replced by above 1.91 + <xsl:template name="createNameFrom720"> + <xsl:if test="marc:datafield[@tag='720'][not(marc:subfield[@code='t'])]"> + <name> + <xsl:if test="@ind1=1"> + <xsl:attribute name="type"> + <xsl:text>personal</xsl:text> + </xsl:attribute> + </xsl:if> + <namePart> + <xsl:value-of select="marc:subfield[@code='a']"/> + </namePart> + <xsl:call-template name="role"/> + </name> + </xsl:if> + </xsl:template> + --> + + + <!-- genre 047 336 655 --> + + <xsl:template name="createGenreFrom047"> + <genre authority="marcgt"> + <!-- 1.111 --> + <xsl:choose> + <xsl:when test="@ind2 = ' '"> + <xsl:attribute name="authority"><xsl:text>marcmuscomp</xsl:text></xsl:attribute> + </xsl:when> + <xsl:when test="@ind2 = '7'"> + <xsl:if test="marc:subfield[@code='2']"> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:attribute> + </xsl:if> + </xsl:when> + </xsl:choose> + <xsl:attribute name="type"> + <xsl:text>musical composition</xsl:text> + </xsl:attribute> + <!-- Template checks for altRepGroup - 880 $6 --> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abcdef</xsl:with-param> + <xsl:with-param name="delimeter">-</xsl:with-param> + </xsl:call-template> + </genre> + </xsl:template> + + <xsl:template name="createGenreFrom336"> + <genre> + <!-- 1.110 --> + <xsl:if test="marc:subfield[@code='2']"> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:attribute> + </xsl:if> + <!-- Template checks for altRepGroup - 880 $6 --> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">a</xsl:with-param> + <xsl:with-param name="delimeter">-</xsl:with-param> + </xsl:call-template> + </genre> + + </xsl:template> + + <xsl:template name="createGenreFrom655"> + <genre authority="marcgt"> + <!-- 1.109 --> + <xsl:choose> + <xsl:when test="marc:subfield[@code='2']"> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="@ind2 != ' '"> + <xsl:attribute name="authority"> + <xsl:value-of select="@ind2"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <!-- Template checks for altRepGroup - 880 $6 --> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abvxyz</xsl:with-param> + <xsl:with-param name="delimeter">-</xsl:with-param> + </xsl:call-template> + </genre> + </xsl:template> + + <!-- tOC 505 --> + + <xsl:template name="createTOCFrom505"> + <tableOfContents> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">agrt</xsl:with-param> + </xsl:call-template> + </tableOfContents> + </xsl:template> + + <!-- abstract 520 --> + + <xsl:template name="createAbstractFrom520"> + <abstract> + <xsl:attribute name="type"> + <xsl:choose> + <xsl:when test="@ind1=' '">Summary</xsl:when> + <xsl:when test="@ind1='0'">Subject</xsl:when> + <xsl:when test="@ind1='1'">Review</xsl:when> + <xsl:when test="@ind1='2'">Scope and content</xsl:when> + <xsl:when test="@ind1='3'">Abstract</xsl:when> + <xsl:when test="@ind1='4'">Content advice</xsl:when> + </xsl:choose> + </xsl:attribute> + + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ab</xsl:with-param> + </xsl:call-template> + + </abstract> + </xsl:template> + + <!-- targetAudience 521 --> + + <xsl:template name="createTargetAudienceFrom521"> + <targetAudience> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ab</xsl:with-param> + </xsl:call-template> + </targetAudience> + </xsl:template> + + <!-- note 245c thru 585 --> + + + <!-- 1.100 245c 20140804 --> + <xsl:template name="createNoteFrom245c"> + <xsl:if test="marc:subfield[@code='c']"> + <note type="statement of responsibility"> + <xsl:attribute name="altRepGroup"> + <xsl:text>00</xsl:text> + </xsl:attribute> + <xsl:call-template name="scriptCode"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">c</xsl:with-param> + </xsl:call-template> + </note> + </xsl:if> + + </xsl:template> + + <xsl:template name="createNoteFrom362"> + <note type="date/sequential designation"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom500"> + <note> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:value-of select="marc:subfield[@code='a']"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom502"> + <note type="thesis"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom504"> + <note type="bibliography"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom508"> + <note type="creation/production credits"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='u' and @code!='3' and @code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom511"> + <note type="performers"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom515"> + <note type="numbering"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom518"> + <note type="venue"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='3' and @code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom524"> + <note type="preferred citation"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom530"> + <note type="additional physical form"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='u' and @code!='3' and @code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom533"> + <note type="reproduction"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <!-- tmee + <xsl:template name="createNoteFrom534"> + <note type="original version"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> +--> + + <xsl:template name="createNoteFrom535"> + <note type="original location"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom536"> + <note type="funding"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom538"> + <note type="system details"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom541"> + <note type="acquisition"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom545"> + <note type="biographical/historical"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom546"> + <note type="language"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom561"> + <note type="ownership"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom562"> + <note type="version identification"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom581"> + <note type="publications"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom583"> + <note type="action"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom585"> + <note type="exhibitions"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <xsl:template name="createNoteFrom5XX"> + <note> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="uri"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield[@code!='6' and @code!='8']"> + <xsl:value-of select="."/> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </note> + </xsl:template> + + <!-- subject Geo 034 043 045 255 656 662 752 --> + + <xsl:template name="createSubGeoFrom034"> + <xsl:if test="marc:datafield[@tag=034][marc:subfield[@code='d' or @code='e' or @code='f' or @code='g']]"> + <subject> + <xsl:call-template name="xxx880"/> + <cartographics> + <coordinates> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">defg</xsl:with-param> + </xsl:call-template> + </coordinates> + </cartographics> + </subject> + </xsl:if> + </xsl:template> + + <xsl:template name="createSubGeoFrom043"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']"> + <geographicCode> + <xsl:attribute name="authority"> + <xsl:if test="@code='a'"> + <xsl:text>marcgac</xsl:text> + </xsl:if> + <xsl:if test="@code='b'"> + <xsl:value-of select="following-sibling::marc:subfield[@code=2]"/> + </xsl:if> + <xsl:if test="@code='c'"> + <xsl:text>iso3166</xsl:text> + </xsl:if> + </xsl:attribute> + <xsl:value-of select="self::marc:subfield"/> + </geographicCode> + </xsl:for-each> + </subject> + </xsl:template> + + <xsl:template name="createSubGeoFrom255"> + <subject> + <xsl:call-template name="xxx880"/> + <cartographics> + <xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']"> + <xsl:if test="@code='a'"> + <scale> + <xsl:value-of select="."/> + </scale> + </xsl:if> + <xsl:if test="@code='b'"> + <projection> + <xsl:value-of select="."/> + </projection> + </xsl:if> + <xsl:if test="@code='c'"> + <coordinates> + <xsl:value-of select="."/> + </coordinates> + </xsl:if> + </xsl:for-each> + </cartographics> + </subject> + </xsl:template> + + <xsl:template name="createSubNameFrom600"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subjectAuthority"/> + <name type="personal"> + <namePart> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">aq</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </namePart> + <xsl:call-template name="termsOfAddress"/> + <xsl:call-template name="nameDate"/> + <xsl:call-template name="affiliation"/> + <xsl:call-template name="role"/> + </name> + <xsl:if test="marc:subfield[@code='t']"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">t</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + </xsl:if> + <xsl:call-template name="subjectAnyOrder"/> + </subject> + </xsl:template> + + <xsl:template name="createSubNameFrom610"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subjectAuthority"/> + <name type="corporate"> + <xsl:for-each select="marc:subfield[@code='a']"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='b']"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </xsl:for-each> + <xsl:if test="marc:subfield[@code='c' or @code='d' or @code='n' or @code='p']"> + <namePart> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">cdnp</xsl:with-param> + </xsl:call-template> + </namePart> + </xsl:if> + <xsl:call-template name="role"/> + </name> + <xsl:if test="marc:subfield[@code='t']"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">t</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + </xsl:if> + <xsl:call-template name="subjectAnyOrder"/> + </subject> + </xsl:template> + + <xsl:template name="createSubNameFrom611"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subjectAuthority"/> + <name type="conference"> + <namePart> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abcdeqnp</xsl:with-param> + </xsl:call-template> + </namePart> + <xsl:for-each select="marc:subfield[@code='4']"> + <role> + <roleTerm authority="marcrelator" type="code"> + <xsl:value-of select="."/> + </roleTerm> + </role> + </xsl:for-each> + </name> + <xsl:if test="marc:subfield[@code='t']"> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">tpn</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + </xsl:if> + <xsl:call-template name="subjectAnyOrder"/> + </subject> + </xsl:template> + + <xsl:template name="createSubTitleFrom630"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subjectAuthority"/> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">adfhklor</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + <xsl:call-template name="subjectAnyOrder"/> + </subject> + </xsl:template> + + <xsl:template name="createSubChronFrom648"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:if test="marc:subfield[@code=2]"> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code=2]"/> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="uri"/> + <xsl:call-template name="subjectAuthority"/> + <temporal> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abcd</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </temporal> + <xsl:call-template name="subjectAnyOrder"/> + </subject> + </xsl:template> + + <xsl:template name="createSubTopFrom650"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subjectAuthority"/> + <topic> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abcd</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </topic> + <xsl:call-template name="subjectAnyOrder"/> + </subject> + </xsl:template> + + <xsl:template name="createSubGeoFrom651"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subjectAuthority"/> + <xsl:for-each select="marc:subfield[@code='a']"> + <geographic> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </geographic> + </xsl:for-each> + <xsl:call-template name="subjectAnyOrder"/> + </subject> + </xsl:template> + + <xsl:template name="createSubFrom653"> + + <xsl:if test="@ind2=' '"> + <subject> + <topic> + <xsl:value-of select="."/> + </topic> + </subject> + </xsl:if> + <xsl:if test="@ind2='0'"> + <subject> + <topic> + <xsl:value-of select="."/> + </topic> + </subject> + </xsl:if> +<!-- tmee 1.93 20140130 --> + <xsl:if test="@ind=' ' or @ind1='0' or @ind1='1'"> + <subject> + <name type="personal"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </name> + </subject> + </xsl:if> + <xsl:if test="@ind1='3'"> + <subject> + <name type="family"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </name> + </subject> + </xsl:if> + <xsl:if test="@ind2='2'"> + <subject> + <name type="corporate"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </name> + </subject> + </xsl:if> + <xsl:if test="@ind2='3'"> + <subject> + <name type="conference"> + <namePart> + <xsl:value-of select="."/> + </namePart> + </name> + </subject> + </xsl:if> + <xsl:if test="@ind2=4"> + <subject> + <temporal> + <xsl:value-of select="."/> + </temporal> + </subject> + </xsl:if> + <xsl:if test="@ind2=5"> + <subject> + <geographic> + <xsl:value-of select="."/> + </geographic> + </subject> + </xsl:if> + + <xsl:if test="@ind2=6"> + <subject> + <genre> + <xsl:value-of select="."/> + </genre> + </subject> + </xsl:if> + </xsl:template> + + <xsl:template name="createSubFrom656"> + <subject> + <xsl:call-template name="xxx880"/> + <xsl:if test="marc:subfield[@code=2]"> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code=2]"/> + </xsl:attribute> + </xsl:if> + <occupation> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </xsl:with-param> + </xsl:call-template> + </occupation> + </subject> + </xsl:template> + + <xsl:template name="createSubGeoFrom662752"> + <subject> + <xsl:call-template name="xxx880"/> + <hierarchicalGeographic> + <!-- 1.113 --> + <xsl:if test="marc:subfield[@code='0']"> + <xsl:attribute name="valueURI"><xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute> + </xsl:if> + <xsl:for-each select="marc:subfield[@code='a']"> + <country> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </country> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='b']"> + <state> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </state> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='c']"> + <county> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </county> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='d']"> + <city> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </city> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='e']"> + <citySection> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </citySection> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='g']"> + <area> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </area> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='h']"> + <extraterrestrialArea> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </extraterrestrialArea> + </xsl:for-each> + </hierarchicalGeographic> + </subject> + </xsl:template> + + <xsl:template name="createSubTemFrom045"> + <xsl:if test="//marc:datafield[@tag=045 and @ind1='2'][marc:subfield[@code='b' or @code='c']]"> + <subject> + <xsl:call-template name="xxx880"/> + <temporal encoding="iso8601" point="start"> + <xsl:call-template name="dates045b"> + <xsl:with-param name="str" select="marc:subfield[@code='b' or @code='c'][1]"/> + </xsl:call-template> + </temporal> + <temporal encoding="iso8601" point="end"> + <xsl:call-template name="dates045b"> + <xsl:with-param name="str" select="marc:subfield[@code='b' or @code='c'][2]"/> + </xsl:call-template> + </temporal> + </subject> + </xsl:if> + </xsl:template> + + <!-- classification 050 060 080 082 084 086 --> + + <xsl:template name="createClassificationFrom050"> + <xsl:for-each select="marc:subfield[@code='b']"> + <classification authority="lcc"> + <xsl:call-template name="xxx880"/> + <xsl:if test="../marc:subfield[@code='3']"> + <xsl:attribute name="displayLabel"> + <xsl:value-of select="../marc:subfield[@code='3']"/> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="preceding-sibling::marc:subfield[@code='a'][1]"/> + <xsl:text> </xsl:text> + <xsl:value-of select="text()"/> + </classification> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='a'][not(following-sibling::marc:subfield[@code='b'])]"> + <classification authority="lcc"> + <xsl:call-template name="xxx880"/> + <xsl:if test="../marc:subfield[@code='3']"> + <xsl:attribute name="displayLabel"> + <xsl:value-of select="../marc:subfield[@code='3']"/> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="text()"/> + </classification> + </xsl:for-each> + </xsl:template> + <xsl:template name="createClassificationFrom060"> + <classification authority="nlm"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ab</xsl:with-param> + </xsl:call-template> + </classification> + </xsl:template> + <xsl:template name="createClassificationFrom080"> + <classification authority="udc"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abx</xsl:with-param> + </xsl:call-template> + </classification> + </xsl:template> + <xsl:template name="createClassificationFrom082"> + <classification authority="ddc"> + <xsl:call-template name="xxx880"/> + <xsl:if test="marc:subfield[@code='2']"> + <xsl:attribute name="edition"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ab</xsl:with-param> + </xsl:call-template> + </classification> + </xsl:template> + <xsl:template name="createClassificationFrom084"> + <classification> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:attribute> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ab</xsl:with-param> + </xsl:call-template> + </classification> + </xsl:template> + <xsl:template name="createClassificationFrom086"> + <xsl:for-each select="marc:datafield[@tag=086][@ind1=0]"> + <classification authority="sudocs"> + <xsl:call-template name="xxx880"/> + <xsl:value-of select="marc:subfield[@code='a']"/> + </classification> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=086][@ind1=1]"> + <classification authority="candoc"> + <xsl:call-template name="xxx880"/> + <xsl:value-of select="marc:subfield[@code='a']"/> + </classification> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=086][@ind1!=1 and @ind1!=0]"> + <classification> + <xsl:call-template name="xxx880"/> + <xsl:attribute name="authority"> + <xsl:value-of select="marc:subfield[@code='2']"/> + </xsl:attribute> + <xsl:value-of select="marc:subfield[@code='a']"/> + </classification> + </xsl:for-each> + </xsl:template> + + <!-- identifier 020 024 022 028 010 037 UNDO Nov 23 2010 RG SM--> + + <!-- createRelatedItemFrom490 <xsl:for-each select="marc:datafield[@tag=490][@ind1=0]"> --> + + <xsl:template name="createRelatedItemFrom490"> + <relatedItem type="series"> + <xsl:call-template name="xxx880"/> + <titleInfo> + <title> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">av</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </title> + <xsl:call-template name="part"/> + </titleInfo> + </relatedItem> + </xsl:template> + + + <!-- location 852 856 --> + + <xsl:template name="createLocationFrom852"> + <location> + <xsl:if test="marc:subfield[@code='a' or @code='b' or @code='e']"> + <physicalLocation> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abe</xsl:with-param> + </xsl:call-template> + </physicalLocation> + </xsl:if> + <xsl:if test="marc:subfield[@code='u']"> + <physicalLocation> + <xsl:call-template name="uri"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">u</xsl:with-param> + </xsl:call-template> + </physicalLocation> + </xsl:if> + <!-- 1.78 --> + <xsl:if test="marc:subfield[@code='h' or @code='i' or @code='j' or @code='k' or @code='l' or @code='m' or @code='t']"> + <shelfLocator> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">hijklmt</xsl:with-param> + </xsl:call-template> + </shelfLocator> + </xsl:if> + <!-- 1.114 --> + <xsl:if test="marc:subfield[@code='p' or @code='t']"> + <holdingSimple> + <copyInformation> + <xsl:for-each select="marc:subfield[@code='p']|marc:subfield[@code='t']"> + <itemIdentifier> + <xsl:if test="@code='t'"> + <xsl:attribute name="type"><xsl:text>copy number</xsl:text></xsl:attribute> + </xsl:if> + <xsl:apply-templates select="."/> + </itemIdentifier> + </xsl:for-each> + </copyInformation> + </holdingSimple> + </xsl:if> + </location> + </xsl:template> + + <xsl:template name="createLocationFrom856"> + <xsl:if test="//marc:datafield[@tag=856][@ind2!=2][marc:subfield[@code='u']]"> + <location> + <url displayLabel="electronic resource"> + <!-- 1.41 tmee AQ1.9 added choice protocol for @usage="primary display" --> + <xsl:variable name="primary"> + <xsl:choose> + <xsl:when test="@ind2=0 and count(preceding-sibling::marc:datafield[@tag=856] [@ind2=0])=0">true</xsl:when> + + <xsl:when test="@ind2=1 and count(ancestor::marc:record//marc:datafield[@tag=856][@ind2=0])=0 and count(preceding-sibling::marc:datafield[@tag=856][@ind2=1])=0">true</xsl:when> + + <xsl:when test="@ind2!=1 and @ind2!=0 and @ind2!=2 and count(ancestor::marc:record//marc:datafield[@tag=856 and @ind2=0])=0 and count(ancestor::marc:record//marc:datafield[@tag=856 and @ind2=1])=0 and count(preceding-sibling::marc:datafield[@tag=856][@ind2])=0">true</xsl:when> + <xsl:otherwise>false</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$primary='true'"> + <xsl:attribute name="usage">primary display</xsl:attribute> + </xsl:if> + + <xsl:if test="marc:subfield[@code='y' or @code='3']"> + <xsl:attribute name="displayLabel"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">y3</xsl:with-param> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="marc:subfield[@code='z']"> + <xsl:attribute name="note"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">z</xsl:with-param> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="marc:subfield[@code='u']"/> + </url> + </location> + </xsl:if> + </xsl:template> + + <!-- accessCondition 506 540 1.87 20130829--> + + <xsl:template name="createAccessConditionFrom506"> + <accessCondition type="restriction on access"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abcd35</xsl:with-param> + </xsl:call-template> + </accessCondition> + </xsl:template> + + <xsl:template name="createAccessConditionFrom540"> + <accessCondition type="use and reproduction"> + <xsl:call-template name="xxx880"/> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abcde35</xsl:with-param> + </xsl:call-template> + </accessCondition> + </xsl:template> + + <!-- recordInfo 040 005 001 003 --> + + <!-- 880 global copy template --> + <xsl:template match="* | @*" mode="global_copy"> + <xsl:copy> + <xsl:apply-templates select="* | @* | text()" mode="global_copy"/> + </xsl:copy> + </xsl:template> + +</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2005. Progress Software Corporation. All rights reserved. +<metaInformation> +<scenarios/><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/><MapperBlockPosition></MapperBlockPosition><TemplateContext></TemplateContext></MapperMetaTag> +</metaInformation> +--> \ No newline at end of file diff --git a/xsl/MARC21slimUtils.xsl b/xsl/MARC21slimUtils.xsl new file mode 100644 index 0000000000000000000000000000000000000000..8a0cd2d1d2c44fbd5c9d781ec31ead51ddf99fe5 --- /dev/null +++ b/xsl/MARC21slimUtils.xsl @@ -0,0 +1,188 @@ +<?xml version='1.0'?> +<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + + <!-- 08/08/08: tmee added corrected chopPunctuation templates for 260c --> + <!-- 08/19/04: ntra added "marc:" prefix to datafield element --> + <!-- 12/14/07: ntra added url encoding template --> + <!-- url encoding --> + + <xsl:variable name="ascii"> + <xsl:text> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~</xsl:text> + </xsl:variable> + + <xsl:variable name="latin1"> + <xsl:text> ¡¢£¤¥¦§¨©ª«¬Â®¯°±²³´µ¶·¸¹º»¼½¾¿ÃÃÃÃÃà ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃà áâãäåæçèéêëìÃîïðñòóôõö÷øùúûüýþÿ</xsl:text> + </xsl:variable> + <!-- Characters that usually don't need to be escaped --> + <xsl:variable name="safe"> + <xsl:text>!'()*-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~</xsl:text> + </xsl:variable> + + <xsl:variable name="hex">0123456789ABCDEF</xsl:variable> + + + <xsl:template name="datafield"> + <xsl:param name="tag"/> + <xsl:param name="ind1"> + <xsl:text> </xsl:text> + </xsl:param> + <xsl:param name="ind2"> + <xsl:text> </xsl:text> + </xsl:param> + <xsl:param name="subfields"/> + <xsl:element name="marc:datafield"> + <xsl:attribute name="tag"> + <xsl:value-of select="$tag"/> + </xsl:attribute> + <xsl:attribute name="ind1"> + <xsl:value-of select="$ind1"/> + </xsl:attribute> + <xsl:attribute name="ind2"> + <xsl:value-of select="$ind2"/> + </xsl:attribute> + <xsl:copy-of select="$subfields"/> + </xsl:element> + </xsl:template> + + <xsl:template name="subfieldSelect"> + <xsl:param name="codes">abcdefghijklmnopqrstuvwxyz</xsl:param> + <xsl:param name="delimeter"> + <xsl:text> </xsl:text> + </xsl:param> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield"> + <xsl:if test="contains($codes, @code)"> + <xsl:value-of select="text()"/> + <xsl:value-of select="$delimeter"/> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/> + </xsl:template> + + <xsl:template name="buildSpaces"> + <xsl:param name="spaces"/> + <xsl:param name="char"> + <xsl:text> </xsl:text> + </xsl:param> + <xsl:if test="$spaces>0"> + <xsl:value-of select="$char"/> + <xsl:call-template name="buildSpaces"> + <xsl:with-param name="spaces" select="$spaces - 1"/> + <xsl:with-param name="char" select="$char"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template name="chopPunctuation"> + <xsl:param name="chopString"/> + <xsl:param name="punctuation"> + <xsl:text>.:,;/ </xsl:text> + </xsl:param> + <xsl:variable name="length" select="string-length($chopString)"/> + <xsl:choose> + <xsl:when test="$length=0"/> + <xsl:when test="contains($punctuation, substring($chopString,$length,1))"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/> + <xsl:with-param name="punctuation" select="$punctuation"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="not($chopString)"/> + <xsl:otherwise> + <xsl:value-of select="$chopString"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="chopPunctuationFront"> + <xsl:param name="chopString"/> + <xsl:variable name="length" select="string-length($chopString)"/> + <xsl:choose> + <xsl:when test="$length=0"/> + <xsl:when test="contains('.:,;/[ ', substring($chopString,1,1))"> + <xsl:call-template name="chopPunctuationFront"> + <xsl:with-param name="chopString" select="substring($chopString,2,$length - 1)" + /> + </xsl:call-template> + </xsl:when> + <xsl:when test="not($chopString)"/> + <xsl:otherwise> + <xsl:value-of select="$chopString"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="chopPunctuationBack"> + <xsl:param name="chopString"/> + <xsl:param name="punctuation"> + <xsl:text>.:,;/] </xsl:text> + </xsl:param> + <xsl:variable name="length" select="string-length($chopString)"/> + <xsl:choose> + <xsl:when test="$length=0"/> + <xsl:when test="contains($punctuation, substring($chopString,$length,1))"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/> + <xsl:with-param name="punctuation" select="$punctuation"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="not($chopString)"/> + <xsl:otherwise> + <xsl:value-of select="$chopString"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- nate added 12/14/2007 for lccn.loc.gov: url encode ampersand, etc. --> + <xsl:template name="url-encode"> + + <xsl:param name="str"/> + + <xsl:if test="$str"> + <xsl:variable name="first-char" select="substring($str,1,1)"/> + <xsl:choose> + <xsl:when test="contains($safe,$first-char)"> + <xsl:value-of select="$first-char"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="codepoint"> + <xsl:choose> + <xsl:when test="contains($ascii,$first-char)"> + <xsl:value-of + select="string-length(substring-before($ascii,$first-char)) + 32" + /> + </xsl:when> + <xsl:when test="contains($latin1,$first-char)"> + <xsl:value-of + select="string-length(substring-before($latin1,$first-char)) + 160"/> + <!-- was 160 --> + </xsl:when> + <xsl:otherwise> + <xsl:message terminate="no">Warning: string contains a character + that is out of range! Substituting "?".</xsl:message> + <xsl:text>63</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="hex-digit1" + select="substring($hex,floor($codepoint div 16) + 1,1)"/> + <xsl:variable name="hex-digit2" select="substring($hex,$codepoint mod 16 + 1,1)"/> + <!-- <xsl:value-of select="concat('%',$hex-digit2)"/> --> + <xsl:value-of select="concat('%',$hex-digit1,$hex-digit2)"/> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="string-length($str) > 1"> + <xsl:call-template name="url-encode"> + <xsl:with-param name="str" select="substring($str,2)"/> + </xsl:call-template> + </xsl:if> + </xsl:if> + </xsl:template> +</xsl:stylesheet> +<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp. +<metaInformation> +<scenarios/><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/> +</metaInformation> +-->