Bugzilla – Attachment 4540 Details for
Bug 6536
Z3950 Search Enhancements: SRU targets and additional XSLT processing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch (functionality)
patch.txt (text/plain), 151.38 KB, created by
Marcel de Rooy
on 2011-06-30 13:03:02 UTC
(
hide
)
Description:
Patch (functionality)
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2011-06-30 13:03:02 UTC
Size:
151.38 KB
patch
obsolete
>From 1ce510d49cd90503f68fb97f877a615b87788d86 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 29 Jun 2011 14:17:20 +0200 >Subject: [PATCH] 6536: Z3950 Enhancements (Functionality) >Content-Type: text/plain; charset="utf-8" > >Z3950 Enhancements: SRU search targets, MARC conversion and additional XSLT processing >Testplan: see http://wiki.koha-community.org/wiki/Z3950_RFC >--- > C4/Breeding.pm | 439 +++++++- > acqui/z3950_search.pl | 320 +----- > admin/z3950servers.pl | 57 +- > cataloguing/z3950_search.pl | 297 +----- > .../prog/en/modules/admin/z3950servers.tt | 2 + > .../intranet-tmpl/prog/en/xslt/MARC21toUNIMARC.xsl | 1187 ++++++++++++++++++++ > .../intranet-tmpl/prog/en/xslt/UNIMARCtoMARC21.xsl | 523 +++++++++ > 7 files changed, 2283 insertions(+), 542 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21toUNIMARC.xsl > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCtoMARC21.xsl > >diff --git a/C4/Breeding.pm b/C4/Breeding.pm >index 9003f9a..cb04e14 100644 >--- a/C4/Breeding.pm >+++ b/C4/Breeding.pm >@@ -21,10 +21,14 @@ use strict; > use warnings; > > use C4::Biblio; >-use C4::Koha; > use C4::Charset; >-use MARC::File::USMARC; > use C4::ImportBatch; >+use C4::Koha; >+ >+use MARC::File::USMARC; >+use XML::LibXML; >+use XML::LibXSLT; >+use ZOOM; > > use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); > >@@ -36,6 +40,21 @@ BEGIN { > @EXPORT = qw(&ImportBreeding &BreedingSearch); > } > >+#------------------------------------------------------------------------------- >+ >+use constant MAX_RESULTS => 20; >+use constant TO_UNIMARC_XSLT => 'MARC21toUNIMARC.xsl'; >+use constant TO_MARC21_XSLT => 'UNIMARCtoMARC21.xsl'; >+ >+my ($input,@oConnection,@oResult,@hServer,$zquery, $squery); >+#zquery in z3950 format; squery general sru, needs server translation >+my $xsltconv; #stylesheet for marc conversion >+my $flavour; #system marc flavour >+ >+my $DEBUG=0; #set to 1 for debug warnings >+ >+#------------------------------------------------------------------------------- >+ > =head1 NAME > > C4::Breeding : module to add biblios to import_records via >@@ -154,7 +173,6 @@ sub ImportBreeding { > return ($notmarcrecord,$alreadyindb,$alreadyinfarm,$imported,$breedingid); > } > >- > =head2 BreedingSearch > > ($count, @results) = &BreedingSearch($title,$isbn,$random); >@@ -216,6 +234,421 @@ sub BreedingSearch { > return($count, @results); > } # sub breedingsearch > >+=head2 z3950_search >+ >+($breedingref, $error_ref)= C4::Breeding::z3950_search($input); >+C<$input> is a CGI object: all search parameters are passed via this object >+ >+C<$breedingref> is an arrayref of search result hashes. >+C<$error_ref> is an arrayref of error messages per server. >+ >+z3950_search does not call ImportBreeding anymore for performance reasons. >+ >+=cut >+ >+sub z3950_search { >+# This is a completely new Z3950 clients search using async ZOOM -TG 02/11/06 >+# Did some refactoring, introduced SRU searching -MR 20110608 >+# And incorporated Biblibre XSLT processing for MARC21/UNIMARC conversion >+ $input= shift; #CGI object passed >+ my (@errconn, @breeding_loop); >+ >+ init_vars(); >+ build_query(); >+ my $s= create_connections(); >+ load_xslt(); >+ start_async_searches(); >+ >+ my $nremaining = $s; >+ while($nremaining>0) { >+ my $k=loop_conn_events(); #returns finished connection number >+ handle_conn_results(\@breeding_loop, \@errconn, $k) unless $k<0; >+ --$nremaining; >+ } >+ $_->destroy() for @oConnection; >+ >+ return (\@breeding_loop, \@errconn ); >+} >+ >+#------------------------------------------------------------------------------- >+# Some internal subroutines >+ >+sub init_vars { >+ @oConnection=(); >+ @oResult=(); >+ @hServer=(); >+ ($zquery,$squery,$xsltconv,$flavour)=('','',undef,''); >+} >+ >+sub build_query { >+ my $nterms=0; >+ my $title = $input->param('title')||''; >+ my $author = $input->param('author')||''; >+ my $isbn = $input->param('isbn')||''; >+ my $lccall = $input->param('lccall')||''; >+ my $subject = $input->param('subject')||''; >+ my $dewey = $input->param('dewey')||''; >+ my $controlnumber = $input->param('controlnumber')||''; >+ my $stdid = $input->param('stdid')||''; >+ my $srchany = $input->param('srchany')||''; >+ >+ if ($isbn) { >+ $zquery = "\@or \@attr 1=8 \"$isbn\" \@attr 1=7 \"$isbn\" "; >+ $squery = "([isbn]=\"$isbn\" or [issn]=\"$isbn\") and "; >+ $nterms++; >+ } >+ if ($title) { >+ utf8::decode($title); >+ $zquery .= "\@attr 1=4 \"$title\" "; >+ $squery .= "[title]=\"$title\" and "; >+ $nterms++; >+ } >+ if ($author) { >+ utf8::decode($author); >+ $zquery .= "\@attr 1=1003 \"$author\" "; >+ $squery .= "[author]=\"$author\" and "; >+ $nterms++; >+ } >+ if ($dewey) { >+ $zquery .= "\@attr 1=16 \"$dewey\" "; >+ $squery .= "[dewey]=\"$dewey\" and "; >+ $nterms++; >+ } >+ if ($subject) { >+ utf8::decode($subject); >+ $zquery .= "\@attr 1=21 \"$subject\" "; >+ $squery .= "[subject]=\"$subject\" and "; >+ $nterms++; >+ } >+ if ($lccall) { >+ $zquery .= "\@attr 1=16 \@attr 2=3 \@attr 3=1 \@attr 4=1 \@attr 5=1 \@attr 6=1 \"$lccall\" "; >+ $squery .= "[lccn]=\"$lccall\" and "; >+ $nterms++; >+ } >+ if ($controlnumber) { >+ $zquery .= "\@attr 1=12 \"$controlnumber\" "; >+ $squery .= "[controlnumber]=\"$controlnumber\" and "; >+ $nterms++; >+ } >+ if ($stdid) { >+ $zquery .= "\@attr 1=1007 \"$stdid\" "; >+ $squery .= "[stdid]=\"$stdid\" and "; >+ $nterms++; >+ } >+ if ($srchany) { >+ $zquery .= "\@attr 1=1016 \"$srchany\" "; >+ $squery .= "[any]=\"$srchany\" and "; >+ $nterms++; >+ } >+ for(1..$nterms-1) { >+ $zquery = "\@and " . $zquery; >+ } >+ $squery=~s/\sand\s$//; #remove last and in sru query >+ warn "zquery ".$zquery if $DEBUG; >+ warn "squery ".$squery if $DEBUG; >+} >+ >+sub create_connections { >+ my $s=0; >+ my $dbh= C4::Context->dbh; >+ >+ my @id= $input->param('id'); >+ foreach my $servid (@id) { >+ my $sth = $dbh->prepare("select * from z3950servers where id=?"); >+ $sth->execute($servid); >+ my $server = $sth->fetchrow_hashref; >+ next unless $server; >+ warn "serverinfo ".join(':',my @a=map($_||'',%$server)) if $DEBUG; >+ >+ $server->{sru}= $server->{host}=~/^sru=/ ? 1: 0; >+ change_sru_host($server) if $server->{sru}; >+ >+ #set connection options >+ my $option1 = new ZOOM::Options(); >+ $option1->option('async' => 1); >+ $option1->option('elementSetName', 'F'); >+ $option1->option('databaseName', $server->{db}) unless $server->{sru}; >+ $option1->option('user', $server->{userid}) if $server->{userid}; >+ $option1->option('password',$server->{password}) if $server->{password}; >+ $option1->option('preferredRecordSyntax', $server->{syntax}); >+ $option1->option('maximumRecords', MAX_RESULTS) if $server->{sru}; >+ #MR: doubt if maximum makes difference when going through ZOOM >+ pass_sru_options($server,$option1) if $server->{sru}; >+ >+ #create connection object >+ my $conn; >+ $oConnection[$s]= create ZOOM::Connection($option1); >+ >+ #now connect >+ if($server->{sru}) { >+ $oConnection[$s]->connect( 'http://'.$server->{host}); >+ } >+ else { >+ $oConnection[$s]->connect( $server->{host}, $server->{port} ); >+ } >+ >+ $hServer[$s]= $server; >+ $s++; >+ } >+ return $s; >+} >+ >+sub change_sru_host { #merge port and database into hostname >+ my $server= shift; >+ if($server->{port} ne '80') { >+ if($server->{host}=~/^([^\/]+)\/(.*)$/ ) { >+ $server->{host}= $1.':'.$server->{port}.'/'.$2; >+ } >+ else { >+ $server->{host}.= ':'.$server->{port}; >+ } >+ } >+ #prevent double slash between host and db when concatenating >+ $server->{host}=~ s/\/$//g; >+ $server->{db}=~ s/^\///g; >+ $server->{host}.= '/'.$server->{db}; >+} >+ >+sub pass_sru_options { >+ my ($server, $option1)=@_; >+ my @parts= split /,/,$server->{host}; >+ foreach(my $i=0; $i<@parts; $i++) { >+ if($i==@parts-1) { >+ $server->{host}=$parts[$i]; >+ } >+ else { >+ if($parts[$i]=~/^([^=]+)=(.*)/) { >+ $option1->option( $1 => $2); >+ } >+ } >+ } >+} >+ >+sub load_xslt { #load stylesheet for marc conversion IF needed >+ $flavour= C4::Context->preference('marcflavour'); >+ my $loaded=0; >+ foreach (@hServer) { #load stylesheet once, set key for each server >+ $_->{marc_conv}=0; >+ if($flavour eq 'MARC21' && $_->{syntax}=~/UNIMARC/) { >+ $_->{marc_conv}=1; >+ _load_xslt_stylesheet(TO_MARC21_XSLT) unless $loaded; >+ $loaded=1; >+ } >+ elsif($flavour eq 'UNIMARC' && $_->{syntax}!~/UNIMARC/) { >+ $_->{marc_conv}=1; >+ _load_xslt_stylesheet(TO_UNIMARC_XSLT) unless $loaded; >+ $loaded=1; >+ } >+ } >+} >+ >+sub _load_xslt_stylesheet { >+ my ($name)= @_; >+ my $f=full_xslt_path($name); >+ if($f) { >+ my $parser = XML::LibXML->new(); >+ my $xslt = XML::LibXSLT->new(); >+ my $style_doc = $parser->parse_file($f); >+ $xsltconv = $xslt->parse_stylesheet($style_doc); >+ } >+ else { >+ warn "z3950_search: XSLT problem with $name"; >+ } >+} >+ >+sub full_xslt_path { >+ my $name=shift; >+ #absolute path? >+ if(substr($name,0,1) eq '/') { >+ return -e $name?$name:undef; >+ } >+ #a relative path: look in xslt subfolder of staff templates >+ my $dir= C4::Context->config('intrahtdocs').'/'. >+ C4::Context->preference('template'); >+ #try language folder first, otherwise english >+ my $lang=$input->cookie('KohaOpacLanguage')||'en'; #null->english >+ my $ff= $dir.'/'.$lang.'/xslt/'.$name; >+ return $ff if -e $ff; >+ $ff=$dir.'/en/xslt/'.$name; >+ return -e $ff? $ff: undef; >+} >+ >+sub start_async_searches { >+ my $k=0; >+ foreach my $conn (@oConnection) { >+ warn 'Doing search '.($k+1) if $DEBUG; >+ if($hServer[$k]->{sru}) { >+ $oResult[$k] = $conn->search(new ZOOM::Query::CQL(tran_query($k))); >+ } >+ else { >+ $oResult[$k]=$conn->search_pqf($zquery); >+ } >+ $k++; >+ } >+} >+ >+sub loop_conn_events { >+ my ($event, $k); >+ while ( ( $k = ZOOM::event( \@oConnection ) ) != 0 ) { >+ $event = $oConnection[ $k - 1 ]->last_event(); >+ warn( "connection ", $k - 1, ": event $event (", >+ ZOOM::event_str($event), ")\n" ) >+ if $DEBUG; >+ last if $event == ZOOM::Event::ZEND; >+ } >+ return $k-1; >+} >+ >+sub handle_conn_results { >+ my ($breedingref, $errorref, $conn)= @_; >+ >+ warn 'Handling results for '.$hServer[$conn]->{name} if $DEBUG; >+ my ($error, $errmsg, $addinfo, $diagset)= $oConnection[$conn]->error_x(); >+ if ($error) { >+ if ($error =~ m/^(10000|10007)$/ ) { >+ push(@$errorref, {'server' => $hServer[$conn]->{host} }); >+ } >+ warn "$conn ".$hServer[$conn]->{host}. >+ " error $zquery: $errmsg ($error) $addinfo\n"; >+ return; >+ } >+ >+ my $numresults = $oResult[$conn]->size(); >+ warn "Number of hits: $numresults" if $DEBUG; >+ $numresults= MAX_RESULTS if $numresults>MAX_RESULTS; >+ for(my $i=0; $i<$numresults; $i++) { >+ my $rec = $oResult[$conn]->record($i); >+ if($rec) { >+ handle_one_result($rec, $breedingref, $conn); >+ } >+ else { >+ push(@$breedingref, { >+ 'server' => $hServer[$conn]->{name}, >+ 'title' => join(': ',$oConnection[$conn]->error_x()), >+ 'breedingid' => -1, >+ 'biblionumber' => -1 >+ }); >+ } >+ } >+ $oResult[$conn]->destroy(); >+} >+ >+sub handle_one_result { >+ my ($rec, $breedingref, $conn)= @_; >+ my $marcrecord; >+ >+ if($hServer[$conn]->{sru}) { #SRU >+ $marcrecord= MARC::Record->new_from_xml($rec->raw(),'UTF-8', >+ $hServer[$conn]->{syntax}); >+ } >+ else { #z3950 >+ ($marcrecord)= MarcToUTF8Record($rec->raw(), >+ marcflavour_from_syntax($conn), $hServer[$conn]->{encoding}); >+ } >+ $marcrecord->encoding('UTF-8'); #force UTF-8 >+ #convert to system marc flavour and/or additional xslt proc. >+ $marcrecord= do_xslt_processing($conn, $marcrecord); >+ >+ #call to ImportBreeding replaced by next two calls for optimization >+ my $batch_id = GetZ3950BatchId($hServer[$conn]->{name}); >+ my $random= $input->param('random') || rand(1000000000); >+ my $breedingid = AddBiblioToBatch($batch_id, 0, $marcrecord, 'UTF-8',$random); >+ #call to TransformMarcToKoha replaced by next call; we only need 6 fields >+ #save results >+ add_breeding($breedingref, $conn, $marcrecord, $breedingid); >+} >+ >+sub marcflavour_from_syntax { >+#passing USMARC to MarcToUTF8Record doesn't work; only knows MARC21/UNIMARC >+ my $conn= shift; >+ return 'UNIMARC' if $hServer[$conn]->{syntax}=~/UNIMARC/; >+ return 'MARC21'; #otherwise >+} >+ >+sub do_xslt_processing { >+#convert marc21<->unimarc and/or additional xslt; return MARC record >+ my ($conn, $marcrecord)= @_; >+ my ($res, $newmarcrec, $parser, $style_doc, $stylesheet); >+ >+ if($hServer[$conn]->{marc_conv} && defined $xsltconv) { >+ $parser = XML::LibXML->new(); >+ $res= $parser->parse_string($marcrecord->as_xml()); >+ $res= $xsltconv->transform($res); >+ $res= $xsltconv->output_string($res); >+ $newmarcrec= MARC::Record->new_from_xml($res, 'UTF-8'); >+ } >+ >+ if($hServer[$conn]->{add_xslt}) { #server specific xslt proc >+ $res= $newmarcrec? $newmarcrec->as_xml(): $marcrecord->as_xml(); >+ $parser = XML::LibXML->new() unless $parser; >+ $res= $parser->parse_string($res); >+ my $f= full_xslt_path($hServer[$conn]->{add_xslt}); >+ $style_doc = $parser->parse_file($f) if $f; >+ my $xslt = XML::LibXSLT->new(); >+ $stylesheet = $xslt->parse_stylesheet($style_doc) if $style_doc; >+ if($stylesheet) { >+ $res= $stylesheet->transform($res); >+ $res= $stylesheet->output_string($res); >+ $newmarcrec= MARC::Record->new_from_xml($res, 'UTF-8'); >+ } >+ else { >+ warn "z3950_search: XSLT problem with ".$hServer[$conn]->{add_xslt}; >+ } >+ } >+ return $newmarcrec // $marcrecord; >+} >+ >+sub add_breeding { >+ my ($breedingref, $conn, $marcrecord, $breedingid)=@_; >+ my %row_data=(); >+ $row_data{server} = $hServer[$conn]->{name}; >+ $row_data{breedingid} = $breedingid; >+ $row_data{biblionumber} = $input->param('biblionumber')||0; >+ if($flavour ne 'UNIMARC') { #MARC21 system (not target!) >+ $row_data{isbn} = isbn_cleanup($marcrecord->subfield('020','a')||''); >+ $row_data{title}= $marcrecord->subfield('245','a')||''; >+ $row_data{author}= $marcrecord->subfield('100','a')||''; >+ $row_data{date}= $marcrecord->subfield('260','c')||''; >+ $row_data{edition}= $marcrecord->subfield('250','a')||''; >+ $row_data{lccn}= $marcrecord->subfield('050','a')||''; >+ } >+ else { #UNIMARC system (not target!) >+ $row_data{isbn}= isbn_cleanup($marcrecord->subfield('010','a')||''); >+ $row_data{title}= $marcrecord->subfield('200','a')||''; >+ $row_data{author}= $marcrecord->subfield('200','f')||''; >+ $row_data{date}= $marcrecord->subfield('210','d')||''; >+ $row_data{edition}= $marcrecord->subfield('205','a')||''; >+ $row_data{lccn}= ''; >+ } >+ push( @$breedingref, \%row_data ); >+} >+ >+sub isbn_cleanup { >+ my $isbn= shift; >+ $isbn=~ s/ |-|\.//g; >+ $isbn=~ s/\|/ \| /g; >+ $isbn=~ s/\(/ \(/g; >+ return $isbn; >+} >+ >+sub tran_query { #translate to specific sru fields per server >+ my ($s)= @_; >+ #srufields is in format title=field,isbn=field,... >+ #if a field doesn't exist, try anywhere or remove [field]= >+ my @parts= split(',', $hServer[$s]->{srufields}); >+ my %trans= map { if(/=/){($`,$')}else{()} } @parts; >+ >+ my $q=$squery; my $any= $trans{any}?$trans{any}.'=':''; >+ foreach my $key (keys %trans) { >+ my $f=$trans{$key}; >+ if($f) {$q=~s/\[$key\]/$f/g; } else {$q=~s/\[$key\]=/$any/g; } >+ } >+ $q=~s/\[\w+\]=/$any/g; # remove remaining fields (not found in field list) >+ warn $hServer[$s]->{name}." sru query: $q" if $DEBUG; >+ return $q; >+} >+ > 1; >+ > __END__ > >diff --git a/acqui/z3950_search.pl b/acqui/z3950_search.pl >index 47dbe52..39b7ffd 100755 >--- a/acqui/z3950_search.pl >+++ b/acqui/z3950_search.pl >@@ -1,6 +1,5 @@ > #!/usr/bin/perl > >-# This is a completely new Z3950 clients search using async ZOOM -TG 02/11/06 > # Copyright 2000-2002 Katipo Communications > # Copyright 2010 Catalyst IT > # >@@ -21,19 +20,19 @@ > > use warnings; > use strict; >+ > use CGI; > > use C4::Auth; >+use C4::Koha; > use C4::Output; >-use C4::Biblio; > use C4::Context; > use C4::Breeding; >-use C4::Koha; >-use C4::Charset; > use C4::Bookseller qw/ GetBookSellerFromId /; >-use ZOOM; > >-my $input = new CGI; >+#------------------------------------------------------------------------------- >+ >+my $input= new CGI; > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > { > template_name => "acqui/z3950_search.tmpl", >@@ -44,278 +43,77 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > debug => 1, > } > ); >+my $frameworkcode = $input->param('frameworkcode')||''; >+my $vendor = GetBookSellerFromId($input->param('booksellerid')||0); >+$template->param( >+ frameworkcode => $frameworkcode, >+ frameworkcodeloop => get_framework_list(), >+ booksellerid => $input->param('booksellerid')||0, >+ basketno => $input->param('basketno'), >+ name => $vendor? $vendor->{'name'}: '', >+); > >- >-my $dbh = C4::Context->dbh; >-my $error = $input->param('error'); >-my $biblionumber = $input->param('biblionumber'); >-$biblionumber = 0 unless $biblionumber; >-my $frameworkcode = $input->param('frameworkcode'); >-my $title = $input->param('title'); >-my $author = $input->param('author'); >-my $isbn = $input->param('isbn'); >-my $issn = $input->param('issn'); >-my $lccn = $input->param('lccn'); >-my $lccall = $input->param('lccall'); >-my $subject= $input->param('subject'); >-my $dewey = $input->param('dewey'); >-my $controlnumber = $input->param('controlnumber'); >-my $op = $input->param('op'); >-my $booksellerid = $input->param('booksellerid'); >-my $basketno = $input->param('basketno'); >-my $noconnection; >-my $numberpending; >-my $attr = ''; >-my $term; >-my $host; >-my $server; >-my $database; >-my $port; >-my $marcdata; >-my @encoding; >-my @results; >-my $count; >-my $toggle; >-my $record; >-my $oldbiblio; >-my $errmsg; >-my @serverhost; >-my @servername; >-my @breeding_loop = (); >-my $random = $input->param('random'); >-unless ($random) >-{ # this var is not useful anymore just kept to keep rel2_2 compatibility >- $random = rand(1000000000); >+my $op= $input->param('op')||''; >+if($op ne "do_search") { >+ show_search_form(); >+} >+else { >+ run_search(); > } >+output_html_with_http_headers $input, $cookie, $template->output; > >-my $DEBUG = 0; # if set to 1, many debug message are send on syslog. >+#------------------------------------------------------------------------------- > >-# get framework list >-my $frameworks = getframeworks; >-my @frameworkcodeloop; >-foreach my $thisframeworkcode ( keys %$frameworks ) { >+sub get_framework_list { >+ my $frameworks = getframeworks(); >+ my @frameworkcodeloop; >+ foreach my $thisframeworkcode ( keys %$frameworks ) { > my %row = ( > value => $thisframeworkcode, > frameworktext => $frameworks->{$thisframeworkcode}->{'frameworktext'}, > ); >- if ( $row{'value'} eq $frameworkcode){ >+ if ($row{'value'} eq $frameworkcode) { > $row{'active'} = 'true'; > } > push @frameworkcodeloop, \%row; >+ } >+ return \@frameworkcodeloop; > } > >-my $vendor = GetBookSellerFromId($booksellerid); >-$template->param( frameworkcode => $frameworkcode, >- frameworkcodeloop => \@frameworkcodeloop, >- booksellerid => $booksellerid, >- basketno => $basketno, >- name => $vendor->{'name'} >- ); >- >+#------------------------------------------------------------------------------- > >- >-if ( $op ne "do_search" ) { >- my $sth = $dbh->prepare("select id,host,name,checked from z3950servers order by host"); >- $sth->execute(); >- my $serverloop = $sth->fetchall_arrayref( {} ); >- $template->param( >- isbn => $isbn, >- issn => $issn, >- lccn => $lccn, >- lccall => $lccall, >- title => $title, >- author => $author, >- controlnumber=> $controlnumber, >+sub show_search_form { >+ my $dbh= C4::Context->dbh; >+ my $sth = $dbh->prepare("select id,host,name,checked from z3950servers order by host"); >+ $sth->execute(); >+ my $serverloop = $sth->fetchall_arrayref( {} ); >+ $template->param( >+ biblionumber => $input->param('biblionumber') || 0, > serverloop => $serverloop, > opsearch => "search", >- biblionumber => $biblionumber, >- ); >- output_html_with_http_headers $input, $cookie, $template->output; >-} >-else { >- my @id = $input->param('id'); >- my @oConnection; >- my @oResult; >- my $s = 0; >- my $query; >- my $nterms; >- if ($isbn || $issn) { >- $term=$isbn if ($isbn); >- $term=$issn if ($issn); >- $query .= " \@or \@attr 1=8 \"$term\" \@attr 1=7 \"$term\" "; >- $nterms++; >- } >- if ($title) { >- utf8::decode($title); >- $query .= " \@attr 1=4 \"$title\" "; >- $nterms++; >- } >- if ($author) { >- utf8::decode($author); >- $query .= " \@attr 1=1003 \"$author\" "; >- $nterms++; >- } >- if ($dewey) { >- $query .= " \@attr 1=16 \"$dewey\" "; >- $nterms++; >- } >- if ($subject) { >- utf8::decode($subject); >- $query .= " \@attr 1=21 \"$subject\" "; >- $nterms++; >- } >- if ($lccn) { >- $query .= " \@attr 1=9 $lccn "; >- $nterms++; >- } >- if ($lccall) { >- $query .= " \@attr 1=16 \@attr 2=3 \@attr 3=1 \@attr 4=1 \@attr 5=1 \@attr 6=1 \"$lccall\" "; >- $nterms++; >- } >- if ($controlnumber) { >- $query .= " \@attr 1=12 \"$controlnumber\" "; >- $nterms++; >- } >-for my $i (1..$nterms-1) { >- $query = "\@and " . $query; >+ title => $input->param('title')||'', >+ isbn => $input->param('isbn')||'', >+ lccall => $input->param('lccall')||'', >+ controlnumber=> $input->param('controlnumber')||'', >+ #srchany => $input->param('srchany')||'', >+ author => $input->param('author')||'', >+ subject => $input->param('subject')||'', >+ dewey => $input->param('dewey')||'', >+ #stdid => $input->param('stdid')||'', >+ ); >+ #acqui z3950 doesn't support srchany and stdid but cataloguing does > } >-warn "query ".$query if $DEBUG; >- >- foreach my $servid (@id) { >- my $sth = $dbh->prepare("select * from z3950servers where id=?"); >- $sth->execute($servid); >- while ( $server = $sth->fetchrow_hashref ) { >- warn "serverinfo ".join(':',%$server) if $DEBUG; >- my $noconnection = 0; >- my $option1 = new ZOOM::Options(); >- $option1->option( 'async' => 1 ); >- $option1->option( 'elementSetName', 'F' ); >- $option1->option( 'databaseName', $server->{db} ); >- $option1->option( 'user', $server->{userid} ) if $server->{userid}; >- $option1->option( 'password', $server->{password} ) >- if $server->{password}; >- $option1->option( 'preferredRecordSyntax', $server->{syntax} ); >- $oConnection[$s] = create ZOOM::Connection($option1) >- || $DEBUG >- && warn( "" . $oConnection[$s]->errmsg() ); >- warn( "server data", $server->{name}, $server->{port} ) if $DEBUG; >- $oConnection[$s]->connect( $server->{host}, $server->{port} ) >- || $DEBUG >- && warn( "" . $oConnection[$s]->errmsg() ); >- $serverhost[$s] = $server->{host}; >- $servername[$s] = $server->{name}; >- $encoding[$s] = ($server->{encoding}?$server->{encoding}:"iso-5426"); >- $s++; >- } ## while fetch >- } # foreach >- my $nremaining = $s; >- my $firstresult = 1; >- >- for ( my $z = 0 ; $z < $s ; $z++ ) { >- warn "doing the search" if $DEBUG; >- $oResult[$z] = $oConnection[$z]->search_pqf($query) >- || $DEBUG >- && warn( "somthing went wrong: " . $oConnection[$s]->errmsg() ); >- >- # $oResult[$z] = $oConnection[$z]->search_pqf($query); >- } > >-sub displayresults { >- my $k; >- my $event; >- while ( ( $k = ZOOM::event( \@oConnection ) ) != 0 ) { >- $event = $oConnection[ $k - 1 ]->last_event(); >- warn( "connection ", $k - 1, ": event $event (", >- ZOOM::event_str($event), ")\n" ) >- if $DEBUG; >- last if $event == ZOOM::Event::ZEND; >- } >- >- if ( $k != 0 ) { >- $k--; >- warn $serverhost[$k] if $DEBUG; >- my ( $error, $errmsg, $addinfo, $diagset ) = >- $oConnection[$k]->error_x(); >- if ($error) { >- warn "$k $serverhost[$k] error $query: $errmsg ($error) $addinfo\n" >- if $DEBUG; >- >- } >- else { >- my $numresults = $oResult[$k]->size(); >- my $i; >- my $result = ''; >- if ( $numresults > 0 ) { >- for ( >- $i = 0 ; >- $i < ( ( $numresults < 20 ) ? ($numresults) : (20) ) ; >- $i++ >- ) >- { >- my $rec = $oResult[$k]->record($i); >- if ($rec) { >- my $marcrecord; >- $marcdata = $rec->raw(); >- >- my ($charset_result, $charset_errors); >- ($marcrecord, $charset_result, $charset_errors) = >- MarcToUTF8Record($marcdata, C4::Context->preference('marcflavour'), $encoding[$k]); >-####WARNING records coming from Z3950 clients are in various character sets MARC8,UTF8,UNIMARC etc >-## In HEAD i change everything to UTF-8 >-# In rel2_2 i am not sure what encoding is so no character conversion is done here >-##Add necessary encoding changes to here -TG >- my $oldbiblio = TransformMarcToKoha( $dbh, $marcrecord, "" ); >- $oldbiblio->{isbn} =~ s/ |-|\.//g if $oldbiblio->{isbn}; >- # pad | and ( with spaces to allow line breaks in the HTML >- $oldbiblio->{isbn} =~ s/\|/ \| /g if $oldbiblio->{isbn}; >- $oldbiblio->{isbn} =~ s/\(/ \(/g if $oldbiblio->{isbn}; >+#------------------------------------------------------------------------------- > >- $oldbiblio->{issn} =~ s/ |-|\.//g if $oldbiblio->{issn}; >- # pad | and ( with spaces to allow line breaks in the HTML >- $oldbiblio->{issn} =~ s/\|/ \| /g if $oldbiblio->{issn}; >- $oldbiblio->{issn} =~ s/\(/ \(/g if $oldbiblio->{issn}; >- my ( >- $notmarcrecord, $alreadyindb, $alreadyinfarm, >- $imported, $breedingid >- ) >- = ImportBreeding( $marcdata, 2, $serverhost[$k], $encoding[$k], $random, 'z3950' ); >- my %row_data; >- if ( $i % 2 ) { >- $toggle = 1; >- } >- else { >- $toggle = 0; >- } >- $row_data{toggle} = $toggle; >- $row_data{server} = $servername[$k]; >- $row_data{isbn} = $oldbiblio->{isbn}; >- $row_data{lccn} = $oldbiblio->{lccn}; >- $row_data{title} = $oldbiblio->{title}; >- $row_data{author} = $oldbiblio->{author}; >- $row_data{breedingid} = $breedingid; >- $row_data{biblionumber} = $biblionumber; >- push( @breeding_loop, \%row_data ); >- >- } else { >- push(@breeding_loop,{'toggle'=>($i % 2)?1:0,'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1,'biblionumber'=>-1}); >- } # $rec >- } # upto 5 results >- } #$numresults >- } >- } # if $k !=0 >- $numberpending = $nremaining - 1; >- $template->param( >- breeding_loop => \@breeding_loop, >- server => $servername[$k], >- numberpending => $numberpending, >- ); >- output_html_with_http_headers $input, $cookie, $template->output if $numberpending == 0; >- >- # print $template->output if $firstresult !=1; >- $firstresult++; >+sub run_search { >+ my ($breedingref)= C4::Breeding::z3950_search($input); >+ #Code for Z3950 searching moved to C4 module -MR 06/27/11 >+ #second return value is ignored here (not in cataloguing) >+ $template->param( >+ breeding_loop => $breedingref, >+ biblionumber => $input->param('biblionumber') || 0, >+ ); > } >-displayresults(); >-while ( --$nremaining > 0 ) { >- displayresults(); >- } >-} ## if op=search >+ >+#------------------------------------------------------------------------------- >diff --git a/admin/z3950servers.pl b/admin/z3950servers.pl >index 44b3967..6b5e2c9 100755 >--- a/admin/z3950servers.pl >+++ b/admin/z3950servers.pl >@@ -32,7 +32,7 @@ sub StringSearch { > $searchstring=~ s/\'/\\\'/g; > my @data=split(' ',$searchstring); > my $count=@data; >- my $sth=$dbh->prepare("Select host,port,db,userid,password,name,id,checked,rank,syntax,encoding from z3950servers where (name like ?) order by rank,name"); >+ my $sth=$dbh->prepare("Select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,srufields,add_xslt from z3950servers where (name like ?) order by rank,name"); > $sth->execute("$data[0]\%"); > my @results; > while (my $data=$sth->fetchrow_hashref) { >@@ -74,15 +74,15 @@ if ($op eq 'add_form') { > my $data; > if ($searchfield) { > my $dbh = C4::Context->dbh; >- my $sth=$dbh->prepare("select host,port,db,userid,password,name,id,checked,rank,syntax,encoding from z3950servers where (name = ?) order by rank,name"); >+ my $sth=$dbh->prepare("select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,srufields,add_xslt from z3950servers where (name = ?) order by rank,name"); > $sth->execute($searchfield); > $data=$sth->fetchrow_hashref; > $sth->finish; > } > $template->param( $_ => $data->{$_} ) >- for ( qw( host port db userid password checked rank ) ); >+ for ( qw( host port db userid password checked rank srufields add_xslt) ); > $template->param( $_ . $data->{$_} => 1) >- for ( qw( syntax encoding ) ); >+ for ( qw( syntax encoding) ); > # END $OP eq ADD_FORM > ################## ADD_VALIDATE ################################## > # called by add_form, used to insert/modify data in DB >@@ -92,7 +92,7 @@ if ($op eq 'add_form') { > my $sth=$dbh->prepare("select * from z3950servers where name=?"); > $sth->execute($input->param('searchfield')); > if ($sth->rows) { >- $sth=$dbh->prepare("update z3950servers set host=?, port=?, db=?, userid=?, password=?, name=?, checked=?, rank=?,syntax=?,encoding=? where name=?"); >+ $sth=$dbh->prepare("update z3950servers set host=?, port=?, db=?, userid=?, password=?, name=?, checked=?, rank=?,syntax=?,encoding=?,srufields=?,add_xslt=? where name=?"); > $sth->execute($input->param('host'), > $input->param('port'), > $input->param('db'), >@@ -101,27 +101,32 @@ if ($op eq 'add_form') { > $input->param('searchfield'), > $input->param('checked'), > $input->param('rank'), >- $input->param('syntax'), >- $input->param('encoding'), >+ $input->param('syntax'), >+ $input->param('encoding'), >+ $input->param('srufields'), >+ $input->param('add_xslt'), > $input->param('searchfield'), > ); > } > else { > $sth=$dbh->prepare( > "INSERT INTO z3950servers " . >- "(host,port,db,userid,password,name,checked,rank,syntax,encoding) " . >- "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ); >- $sth->execute( >- $input->param( 'host' ), >- $input->param( 'port' ), >- $input->param( 'db' ), >- $input->param( 'userid' ), >- $input->param( 'password' ), >- $input->param( 'searchfield' ), >- $input->param( 'checked' ), >- $input->param( 'rank' ), >- $input->param( 'syntax' ), >- $input->param( 'encoding' ) ); >+ "(host,port,db,userid,password,name,checked,rank,syntax,encoding,srufields,add_xslt) " . >+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ); >+ $sth->execute( >+ $input->param( 'host' ), >+ $input->param( 'port' ), >+ $input->param( 'db' ), >+ $input->param( 'userid' ), >+ $input->param( 'password' ), >+ $input->param( 'searchfield' ), >+ $input->param( 'checked' ), >+ $input->param( 'rank' ), >+ $input->param( 'syntax' ), >+ $input->param( 'encoding' ), >+ $input->param( 'srufields'), >+ $input->param( 'add_xslt'), >+ ); > } > $sth->finish; > # END $OP eq ADD_VALIDATE >@@ -131,7 +136,7 @@ if ($op eq 'add_form') { > $template->param(delete_confirm => 1); > my $dbh = C4::Context->dbh; > >- my $sth2=$dbh->prepare("select host,port,db,userid,password,name,id,checked,rank,syntax,encoding from z3950servers where (name = ?) order by rank,name"); >+ my $sth2=$dbh->prepare("select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,srufields,add_xslt from z3950servers where (name = ?) order by rank,name"); > $sth2->execute($searchfield); > my $data=$sth2->fetchrow_hashref; > $sth2->finish; >@@ -144,7 +149,10 @@ if ($op eq 'add_form') { > checked => $data->{'checked'}, > rank => $data->{'rank'}, > syntax => $data->{'syntax'}, >- encoding => $data->{'encoding'} ); >+ encoding => $data->{'encoding'}, >+ srufields => $data->{srufields}, >+ add_xslt => $data->{add_xslt}, >+ ); > > # END $OP eq DELETE_CONFIRM > ################## DELETE_CONFIRMED ################################## >@@ -174,7 +182,10 @@ if ($op eq 'add_form') { > checked => $results->[$i]{'checked'}, > rank => $results->[$i]{'rank'}, > syntax => $results->[$i]{'syntax'}, >- encoding => $results->[$i]{'encoding'}); >+ encoding => $results->[$i]{'encoding'}, >+ srufields => $results->[$i]{srufields}, >+ add_xslt => $results->[$i]{add_xslt}, >+ ); > push @loop, \%row; > > } >diff --git a/cataloguing/z3950_search.pl b/cataloguing/z3950_search.pl >index b12a9c9..256cb05 100755 >--- a/cataloguing/z3950_search.pl >+++ b/cataloguing/z3950_search.pl >@@ -1,6 +1,5 @@ > #!/usr/bin/perl > >-# This is a completely new Z3950 clients search using async ZOOM -TG 02/11/06 > # Copyright 2000-2002 Katipo Communications > # > # This file is part of Koha. >@@ -19,58 +18,19 @@ > # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > > use strict; >-#use warnings; FIXME - Bug 2505 >+use warnings; >+ > use CGI; > > use C4::Auth; > use C4::Output; >-use C4::Biblio; > use C4::Context; > use C4::Breeding; >-use C4::Koha; >-use C4::Charset; >-use ZOOM; >- >-my $input = new CGI; >-my $dbh = C4::Context->dbh; >-my $error = $input->param('error'); >-my $biblionumber = $input->param('biblionumber') || 0; >-my $frameworkcode = $input->param('frameworkcode'); >-my $title = $input->param('title'); >-my $author = $input->param('author'); >-my $isbn = $input->param('isbn'); >-my $issn = $input->param('issn'); >-my $lccn = $input->param('lccn'); >-my $lccall = $input->param('lccall'); >-my $subject = $input->param('subject'); >-my $dewey = $input->param('dewey'); >-my $controlnumber = $input->param('controlnumber'); >-my $stdid = $input->param('stdid'); >-my $srchany = $input->param('srchany'); >-my $random = $input->param('random') || rand(1000000000); # this var is not useful anymore just kept for rel2_2 compatibility >-my $op = $input->param('op'); >-my $numberpending; >-my $attr = ''; >-my $term; >-my $host; >-my $server; >-my $database; >-my $port; >-my $marcdata; >-my @encoding; >-my @results; >-my $count; >-my $record; >-my $oldbiblio; >-my $errmsg; >-my @serverloop = (); >-my @serverhost; >-my @servername; >-my @breeding_loop = (); > >-my $DEBUG = 0; # if set to 1, many debug message are send on syslog. >+#------------------------------------------------------------------------------- > >-my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ >+my $input= new CGI; >+my ($template, $loggedinuser, $cookie ) = get_template_and_user({ > template_name => "cataloguing/z3950_search.tmpl", > query => $input, > type => "intranet", >@@ -78,222 +38,49 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ > flagsrequired => { catalogue => 1 }, > debug => 1, > }); >+$template->param( frameworkcode => $input->param('frameworkcode')||'' ); > >-$template->param( frameworkcode => $frameworkcode, ); >- >-if ( $op ne "do_search" ) { >- my $sth = $dbh->prepare("select id,host,name,checked from z3950servers order by host"); >- $sth->execute(); >- my $serverloop = $sth->fetchall_arrayref( {} ); >- $template->param( >- isbn => $isbn, >- issn => $issn, >- lccn => $lccn, >- lccall => $lccall, >- title => $title, >- author => $author, >- controlnumber=> $controlnumber, >- stdid => $stdid, >- srchany => $srchany, >- serverloop => $serverloop, >- opsearch => "search", >- biblionumber => $biblionumber, >- ); >- output_html_with_http_headers $input, $cookie, $template->output; >+my $op= $input->param('op')||''; >+if($op ne "do_search") { >+ show_search_form(); > } > else { >- my @id = $input->param('id'); >- >- if ( not defined @id ) { >- # empty server list -> report and exit >- $template->param( emptyserverlist => 1 ); >- output_html_with_http_headers $input, $cookie, $template->output; >- exit; >- } >- >- my @oConnection; >- my @oResult; >- my @errconn; >- my $s = 0; >- my $query; >- my $nterms; >- if ($isbn || $issn) { >- $term=$isbn if ($isbn); >- $term=$issn if ($issn); >- $query .= " \@or \@attr 1=8 \"$term\" \@attr 1=7 \"$term\" "; >- $nterms++; >- } >- if ($title) { >- utf8::decode($title); >- $query .= " \@attr 1=4 \"$title\" "; >- $nterms++; >- } >- if ($author) { >- utf8::decode($author); >- $query .= " \@attr 1=1003 \"$author\" "; >- $nterms++; >- } >- if ($dewey) { >- $query .= " \@attr 1=16 \"$dewey\" "; >- $nterms++; >- } >- if ($subject) { >- utf8::decode($subject); >- $query .= " \@attr 1=21 \"$subject\" "; >- $nterms++; >- } >- if ($lccn) { >- $query .= " \@attr 1=9 $lccn "; >- $nterms++; >- } >- if ($lccall) { >- $query .= " \@attr 1=16 \@attr 2=3 \@attr 3=1 \@attr 4=1 \@attr 5=1 \@attr 6=1 \"$lccall\" "; >- $nterms++; >- } >- if ($controlnumber) { >- $query .= " \@attr 1=12 \"$controlnumber\" "; >- $nterms++; >- } >- if ($stdid) { >- $query .= " \@attr 1=1007 \"$stdid\" "; >- $nterms++; >- } >- if ($srchany) { >- $query .= " \@attr 1=1016 \"$srchany\" "; >- $nterms++; >- } >-for my $i (1..$nterms-1) { >- $query = "\@and " . $query; >+ run_search(); > } >-warn "query ".$query if $DEBUG; >- >- foreach my $servid (@id) { >- my $sth = $dbh->prepare("select * from z3950servers where id=?"); >- $sth->execute($servid); >- while ( $server = $sth->fetchrow_hashref ) { >- warn "serverinfo ".join(':',%$server) if $DEBUG; >- my $option1 = new ZOOM::Options(); >- $option1->option('async' => 1); >- $option1->option('elementSetName', 'F'); >- $option1->option('databaseName', $server->{db}); >- $option1->option('user', $server->{userid} ) if $server->{userid}; >- $option1->option('password', $server->{password}) if $server->{password}; >- $option1->option('preferredRecordSyntax', $server->{syntax}); >- $oConnection[$s] = create ZOOM::Connection($option1) >- || $DEBUG >- && warn( "" . $oConnection[$s]->errmsg() ); >- warn( "server data", $server->{name}, $server->{port} ) if $DEBUG; >- $oConnection[$s]->connect( $server->{host}, $server->{port} ) >- || $DEBUG >- && warn( "" . $oConnection[$s]->errmsg() ); >- $serverhost[$s] = $server->{host}; >- $servername[$s] = $server->{name}; >- $encoding[$s] = ($server->{encoding}?$server->{encoding}:"iso-5426"); >- $s++; >- } ## while fetch >- } # foreach >- my $nremaining = $s; >- my $firstresult = 1; >+output_html_with_http_headers $input, $cookie, $template->output; > >- for ( my $z = 0 ; $z < $s ; $z++ ) { >- warn "doing the search" if $DEBUG; >- $oResult[$z] = $oConnection[$z]->search_pqf($query) >- || $DEBUG >- && warn( "somthing went wrong: " . $oConnection[$s]->errmsg() ); >+#------------------------------------------------------------------------------- > >- # $oResult[$z] = $oConnection[$z]->search_pqf($query); >- } >- >- AGAIN: >- my $k; >- my $event; >- while ( ( $k = ZOOM::event( \@oConnection ) ) != 0 ) { >- $event = $oConnection[ $k - 1 ]->last_event(); >- warn( "connection ", $k - 1, ": event $event (", >- ZOOM::event_str($event), ")\n" ) >- if $DEBUG; >- last if $event == ZOOM::Event::ZEND; >- } >- >- if ( $k != 0 ) { >- $k--; >- warn $serverhost[$k] if $DEBUG; >- my ( $error, $errmsg, $addinfo, $diagset ) = >- $oConnection[$k]->error_x(); >- if ($error) { >- if ($error =~ m/^(10000|10007)$/ ) { >- push(@errconn, {'server' => $serverhost[$k]}); >- } >- $DEBUG and warn "$k $serverhost[$k] error $query: $errmsg ($error) $addinfo\n"; >- } >- else { >- my $numresults = $oResult[$k]->size(); >- my $i; >- my $result = ''; >- if ( $numresults > 0 ) { >- for ($i = 0; $i < (($numresults < 20) ? $numresults : 20); $i++) { >- my $rec = $oResult[$k]->record($i); >- if ($rec) { >- my $marcrecord; >- $marcdata = $rec->raw(); >- >- my ($charset_result, $charset_errors); >- ($marcrecord, $charset_result, $charset_errors) = >- MarcToUTF8Record($marcdata, C4::Context->preference('marcflavour'), $encoding[$k]); >-####WARNING records coming from Z3950 clients are in various character sets MARC8,UTF8,UNIMARC etc >-## In HEAD i change everything to UTF-8 >-# In rel2_2 i am not sure what encoding is so no character conversion is done here >-##Add necessary encoding changes to here -TG >- my $oldbiblio = TransformMarcToKoha( $dbh, $marcrecord, "" ); >- $oldbiblio->{isbn} =~ s/ |-|\.//g if $oldbiblio->{isbn}; >- # pad | and ( with spaces to allow line breaks in the HTML >- $oldbiblio->{isbn} =~ s/\|/ \| /g if $oldbiblio->{isbn}; >- $oldbiblio->{isbn} =~ s/\(/ \(/g if $oldbiblio->{isbn}; >+sub show_search_form { >+ my $dbh= C4::Context->dbh; >+ my $sth= $dbh->prepare("select id,host,name,checked from z3950servers order by host"); >+ $sth->execute(); >+ my $serverloop = $sth->fetchall_arrayref( {} ); >+ $template->param( >+ biblionumber => $input->param('biblionumber') || 0, >+ serverloop => $serverloop, >+ opsearch => "search", >+ title => $input->param('title')||'', >+ isbn => $input->param('isbn')||'', >+ lccall => $input->param('lccall')||'', >+ controlnumber=> $input->param('controlnumber')||'', >+ srchany => $input->param('srchany')||'', >+ author => $input->param('author')||'', >+ subject => $input->param('subject')||'', >+ dewey => $input->param('dewey')||'', >+ stdid => $input->param('stdid')||'', >+ ); >+} > >- $oldbiblio->{issn} =~ s/ |-|\.//g if $oldbiblio->{issn}; >- # pad | and ( with spaces to allow line breaks in the HTML >- $oldbiblio->{issn} =~ s/\|/ \| /g if $oldbiblio->{issn}; >- $oldbiblio->{issn} =~ s/\(/ \(/g if $oldbiblio->{issn}; >- my ( >- $notmarcrecord, $alreadyindb, $alreadyinfarm, >- $imported, $breedingid >- ) >- = ImportBreeding( $marcdata, 2, $serverhost[$k], $encoding[$k], $random, 'z3950' ); >- my %row_data; >- $row_data{server} = $servername[$k]; >- $row_data{isbn} = $oldbiblio->{isbn}; >- $row_data{lccn} = $oldbiblio->{lccn}; >- $row_data{title} = $oldbiblio->{title}; >- $row_data{author} = $oldbiblio->{author}; >- $row_data{date} = $oldbiblio->{copyrightdate}; >- $row_data{edition} = $oldbiblio->{editionstatement}; >- $row_data{breedingid} = $breedingid; >- $row_data{biblionumber} = $biblionumber; >- push( @breeding_loop, \%row_data ); >- >- } else { >- push(@breeding_loop,{'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1,'biblionumber'=>-1}); >- } # $rec >- } >- } #$numresults >- } >- } # if $k !=0 >- $numberpending = $nremaining - 1; >- $template->param( >- breeding_loop => \@breeding_loop, >- server => $servername[$k], >- numberpending => $numberpending, >- biblionumber => $biblionumber, >- errconn => \@errconn >- ); >- >- output_html_with_http_headers $input, $cookie, $template->output if $numberpending == 0; >+#------------------------------------------------------------------------------- > >- # print $template->output if $firstresult !=1; >- $firstresult++; >+sub run_search { >+ my ($breedingref, $error_ref)= C4::Breeding::z3950_search($input); >+ $template->param( >+ breeding_loop => $breedingref, >+ biblionumber => $input->param('biblionumber') || 0, >+ errconn => $error_ref, >+ ); >+} > >- MAYBE_AGAIN: >- if ( --$nremaining > 0 ) { >- goto AGAIN; >- } >-} ## if op=search >+#------------------------------------------------------------------------------- >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt >index e565acf..c215115 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt >@@ -226,6 +226,8 @@ > [% END %] > </select> > </li> >+ <li><label for="srufields">SRU Fields: </label><input type="text" size="80" name="srufields" id="srufields" value="[% srufields %]"/></li> >+ <li><label for="add_xslt">Additional XSLT: </label><input type="text" size="40" name="add_xslt" id="add_xslt" value="[% add_xslt %]"/></li> > </ol> > </fieldset> > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21toUNIMARC.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21toUNIMARC.xsl >new file mode 100644 >index 0000000..a5d4faa >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21toUNIMARC.xsl >@@ -0,0 +1,1187 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<!-- >+Copyright 2011 BibLibre. >+This file is part of Koha. >+Koha is free software; you can redistribute it and/or modify it under the >+terms of the GNU General Public License as published by the Free Software >+Foundation; either version 2 of the License, or (at your option) any later >+version. >+Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+You should have received a copy of the GNU General Public License along >+with Koha; if not, write to the Free Software Foundation, Inc., >+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+--> >+<xsl:stylesheet xmlns:marc="http://www.loc.gov/MARC21/slim" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> >+ <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> >+ <xsl:template match="/"> >+ <collection> >+ <xsl:for-each select="marc:record"> >+ <record >+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >+ xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/ standards/marcxml/schema/MARC21slim.xsd" >+ xmlns="http://www.loc.gov/MARC21/slim"> >+ <xsl:variable name="leader" select="leader" /> >+ <leader> >+ <!-- A calculer, mais comment ? --> >+ <xsl:variable name="len">00000</xsl:variable> >+ <xsl:variable name="stat"> >+ <xsl:choose> >+ <xsl:when test="substring(leader,6,1) = 'a'">p</xsl:when> >+ <xsl:otherwise><xsl:value-of select="substring(leader,6,1)" /></xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:variable name="type"> >+ <xsl:choose> >+ <xsl:when test="substring(leader,7,1) = 'o'">m</xsl:when> >+ <xsl:when test="substring(leader,7,1) = 'r'">n</xsl:when> >+ <xsl:otherwise><xsl:value-of select="substring(leader,7,1)" /></xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:variable name="biblvl"> >+ <xsl:choose> >+ <xsl:when test="substring(leader,8,1) = 'b'">m</xsl:when> >+ <xsl:when test="substring(leader,8,1) = 'd'">m</xsl:when> >+ <xsl:otherwise><xsl:value-of select="substring(leader,8,1)" /></xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <!-- A calculer, mais comment ? --> >+ <xsl:variable name="baod">00000</xsl:variable> >+ <xsl:variable name="enclvl"> >+ <xsl:choose> >+ <xsl:when test="substring(leader,18,1) = '8'">2</xsl:when> >+ <xsl:when test="substring(leader,17,1) = '5'">3</xsl:when> >+ <xsl:when test="substring(leader,18,1) = '7'">3</xsl:when> >+ <xsl:otherwise><xsl:value-of select="substring(leader,18,1)" /></xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:variable name="dcf"> >+ <xsl:choose> >+ <xsl:when test="substring(leader,19,1) = ' '">n</xsl:when> >+ <xsl:otherwise><xsl:value-of select="' '" /></xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:value-of select="concat($len,$stat,$type,$biblvl,' 22',$baod,$enclvl,$dcf,' 45 ')" /> >+ </leader> >+ <xsl:for-each select="marc:controlfield[@tag='001']"> >+ <controlfield tag="001"><xsl:value-of select="text()" /></controlfield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:controlfield[@tag='005']"> >+ <controlfield tag="005"><xsl:value-of select="text()" /></controlfield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:controlfield[@tag='008']"> >+ <!-- FIXME: Dummy indicators --> >+ <datafield tag="100"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <subfield code="a"> >+ <xsl:variable name="deof"> >+ <xsl:choose> >+ <xsl:when test="substring(text(),1,2) < 70"> >+ <xsl:value-of select="concat('20',substring(text(),1,6))" /> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:value-of select="concat('19',substring(text(),1,6))" /> >+ </xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:variable name="topd" select="substring(text(),7,1)" /> >+ <xsl:variable name="d1" select="substring(text(),8,4)" /> >+ <xsl:variable name="d2" select="substring(text(),12,4)" /> >+ <xsl:variable name="il"> >+ <xsl:choose> >+ <xsl:when test="substring(text(),23,1) = 'a'">b||</xsl:when> >+ <xsl:when test="substring(text(),23,1) = 'b'">c||</xsl:when> >+ <xsl:when test="substring(text(),23,1) = 'j'">a||</xsl:when> >+ <xsl:when test="substring(text(),23,1) = 'c'">d||</xsl:when> >+ <xsl:when test="substring(text(),23,1) = 'd'">e||</xsl:when> >+ <xsl:when test="substring(text(),23,1) = 'e'">k||</xsl:when> >+ <xsl:when test="substring(text(),23,1) = 'g'">m||</xsl:when> >+ <xsl:when test="substring(text(),23,1) = '|'">|||</xsl:when> >+ <xsl:when test="substring(text(),23,1) = ' '">u||</xsl:when> >+ <xsl:otherwise>u||</xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:variable name="gpc"> >+ <xsl:choose> >+ <xsl:when test="substring(text(),29,1) = 'f'">a</xsl:when> >+ <xsl:when test="substring(text(),29,1) = 's'">b</xsl:when> >+ <xsl:when test="substring(text(),29,1) = 'l'">d</xsl:when> >+ <xsl:when test="substring(text(),29,1) = 'c'">e</xsl:when> >+ <xsl:when test="substring(text(),29,1) = 'i'">f</xsl:when> >+ <xsl:when test="substring(text(),29,1) = 'z'">g</xsl:when> >+ <xsl:when test="substring(text(),29,1) = 'o'">h</xsl:when> >+ <xsl:when test="substring(text(),29,1) = 'u'">u</xsl:when> >+ <xsl:when test="substring(text(),29,1) = ' '">y</xsl:when> >+ <xsl:when test="substring(text(),29,1) = 'z'">z</xsl:when> >+ <xsl:when test="substring(text(),29,1) = '|'">|</xsl:when> >+ <xsl:otherwise>y</xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:variable name="mrc"> >+ <xsl:choose> >+ <xsl:when test="substring(text(),39,1) = ' '">0</xsl:when> >+ <xsl:otherwise>1</xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:variable name="loc"> >+ <xsl:choose> >+ <xsl:when test="datafield[@tag='040']/subfield[@code='b']"><xsl:value-of select="marc:datafield[@tag='040']/subfield[@code='b']" /></xsl:when> >+ <xsl:otherwise><xsl:value-of select="' '" /></xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:variable name="tc"> >+ <xsl:choose> >+ <xsl:when test="substring(text(),39,1) = 'o'">b</xsl:when> >+ <xsl:otherwise>y</xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <!-- Demander ànicomo pour les 2 variables suivantes --> >+ <xsl:variable name="cs"><xsl:value-of select="' '" /></xsl:variable> >+ <xsl:variable name="acs"><xsl:value-of select="' '" /></xsl:variable> >+ <xsl:variable name="aot" select="substring(text(),34,1)" /> >+ <xsl:value-of select="concat($deof,$topd,$d1,$d2,$il,$gpc,$mrc,$loc,$tc,$cs,$acs,$aot)" /> >+ </subfield> >+ </datafield> >+ <datafield tag="105"> >+ <!-- Difficile de faire un bel algo pour les deux variables suivantes --> >+ <subfield code="a"> >+ <xsl:variable name="ic"><xsl:value-of select="' '" /></xsl:variable> >+ <xsl:variable name="focc"><xsl:value-of select="' '" /></xsl:variable> >+ <xsl:variable name="cc"><xsl:value-of select="substring(text(),30,1)" /></xsl:variable> >+ <xsl:variable name="fi"><xsl:value-of select="substring(text(),31,1)" /></xsl:variable> >+ <xsl:variable name="ii"><xsl:value-of select="substring(text(),32,1)" /></xsl:variable> >+ <xsl:variable name="lc"> >+ <xsl:choose> >+ <xsl:when test="substring(text(),34,1) = '1'">a</xsl:when> >+ <xsl:otherwise>|</xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:variable name="bc"> >+ <xsl:choose> >+ <xsl:when test="substring(text(),35,1) = ' '">y</xsl:when> >+ <xsl:otherwise><xsl:value-of select="substring(text(),35,1)" /></xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:value-of select="concat($ic,$focc,$cc,$fi,$ii,$lc,$bc)" /> >+ </subfield> >+ </datafield> >+ <datafield tag="106"> >+ <subfield code="a"> >+ <xsl:choose> >+ <xsl:when test="substring(text(),24,1) = ' '">y</xsl:when> >+ <xsl:otherwise><xsl:value-of select="substring(text(),24,1)" /></xsl:otherwise> >+ </xsl:choose> >+ </subfield> >+ </datafield> >+ <datafield tag="110"> >+ <subfield code="a"> >+ <xsl:variable name="tos"> >+ <xsl:choose> >+ <xsl:when test="substring(text(),22,1) = 'p'">a</xsl:when> >+ <xsl:when test="substring(text(),22,1) = 'm'">b</xsl:when> >+ <xsl:when test="substring(text(),22,1) = 'n'">c</xsl:when> >+ <xsl:when test="substring(text(),22,1) = ' '">z</xsl:when> >+ <xsl:when test="substring(text(),22,1) = '|'">|</xsl:when> >+ <xsl:otherwise>z</xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:variable name="foi"> >+ <xsl:choose> >+ <xsl:when test="substring(text(),19,1) = 'd'">a</xsl:when> >+ <xsl:when test="substring(text(),19,1) = 'c'">b</xsl:when> >+ <xsl:when test="substring(text(),19,1) = 'w'">c</xsl:when> >+ <xsl:when test="substring(text(),19,1) = 'e'">d</xsl:when> >+ <xsl:when test="substring(text(),19,1) = 's'">e</xsl:when> >+ <xsl:when test="substring(text(),19,1) = 'm'">f</xsl:when> >+ <xsl:when test="substring(text(),19,1) = 'b'">g</xsl:when> >+ <xsl:when test="substring(text(),19,1) = 'q'">h</xsl:when> >+ <xsl:when test="substring(text(),19,1) = 't'">i</xsl:when> >+ <xsl:when test="substring(text(),19,1) = 'f'">j</xsl:when> >+ <xsl:when test="substring(text(),19,1) = 'a'">k</xsl:when> >+ <xsl:when test="substring(text(),19,1) = 'g'">l</xsl:when> >+ <xsl:when test="substring(text(),19,1) = 'h'">m</xsl:when> >+ <xsl:when test="substring(text(),19,1) = 'i'">n</xsl:when> >+ <xsl:when test="substring(text(),19,1) = 'j'">o</xsl:when> >+ <xsl:when test="substring(text(),19,1) = 'u'">u</xsl:when> >+ <xsl:when test="substring(text(),19,1) = ' '">y</xsl:when> >+ <xsl:when test="substring(text(),19,1) = 'z'">z</xsl:when> >+ <xsl:when test="substring(text(),19,1) = '|'">|</xsl:when> >+ <xsl:when test="substring(text(),19,1) = 'n'">|</xsl:when> >+ <xsl:otherwise>y</xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:variable name="r"> >+ <xsl:choose> >+ <xsl:when test="substring(text(),20,1) = 'r'">a</xsl:when> >+ <xsl:when test="substring(text(),20,1) = 'n'">b</xsl:when> >+ <xsl:when test="substring(text(),20,1) = 'u'">u</xsl:when> >+ <xsl:when test="substring(text(),20,1) = 'x'">y</xsl:when> >+ <xsl:when test="substring(text(),20,1) = '|'">|</xsl:when> >+ <xsl:when test="substring(text(),20,1) = ' '">|</xsl:when> >+ <xsl:otherwise>u</xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:variable name="tomc"> >+ <xsl:choose> >+ <xsl:when test="substring(text(),25,1) = 'b'">a</xsl:when> >+ <xsl:when test="substring(text(),25,1) = 'c'">b</xsl:when> >+ <xsl:when test="substring(text(),25,1) = 'i'">c</xsl:when> >+ <xsl:when test="substring(text(),25,1) = 'a'">d</xsl:when> >+ <xsl:when test="substring(text(),25,1) = 'd'">e</xsl:when> >+ <xsl:when test="substring(text(),25,1) = 'e'">f</xsl:when> >+ <xsl:when test="substring(text(),25,1) = 'r'">g</xsl:when> >+ <xsl:when test="substring(text(),25,1) = 'y'">h</xsl:when> >+ <xsl:when test="substring(text(),25,1) = 's'">i</xsl:when> >+ <xsl:when test="substring(text(),25,1) = 'p'">j</xsl:when> >+ <xsl:when test="substring(text(),25,1) = 'o'">k</xsl:when> >+ <xsl:when test="substring(text(),25,1) = 'l'">l</xsl:when> >+ <xsl:when test="substring(text(),25,1) = 'w'">m</xsl:when> >+ <xsl:when test="substring(text(),25,1) = 'g'">n</xsl:when> >+ <xsl:when test="substring(text(),25,1) = 'v'">o</xsl:when> >+ <xsl:when test="substring(text(),25,1) = 'h'">p</xsl:when> >+ <xsl:when test="substring(text(),25,1) = 'n'">r</xsl:when> >+ <xsl:when test="substring(text(),25,1) = ' '">z</xsl:when> >+ <xsl:when test="substring(text(),25,1) = '|'">|</xsl:when> >+ <xsl:otherwise>z</xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:variable name="nocc"><xsl:value-of select="substring(text(),26,3)" /></xsl:variable> >+ <xsl:variable name="ci"><xsl:value-of select="substring(text(),30,1)" /></xsl:variable> >+ <xsl:variable name="tpa">|</xsl:variable> >+ <xsl:variable name="iac">|</xsl:variable> >+ <xsl:variable name="cia">|</xsl:variable> >+ <xsl:value-of select="concat($tos,$foi,$r,$tomc,$nocc,$ci,$tpa,$iac,$cia)" /> >+ </subfield> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='020']"> >+ <datafield tag="010"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="b"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='c']"><subfield code="d"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="z"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='022']"> >+ <datafield tag="011"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <!--<xsl:for-each select="marc:subfield[@code='?']"><subfield code="b"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <!--<xsl:for-each select="marc:subfield[@code='?']"><subfield code="d"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <xsl:for-each select="marc:subfield[@code='y']"><subfield code="z"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <!--<xsl:for-each select="marc:subfield[@code='z']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ </datafield> >+ </xsl:for-each> >+ <!--<xsl:for-each select="marc:datafield[@tag='024']"> >+ <datafield tag="012"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each>--> >+ <xsl:for-each select="marc:datafield[@tag='015']"> >+ <datafield tag="020"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='2']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='a']"> >+ <subfield code="b"><xsl:value-of select="text()" /></subfield> >+ <subfield code="z"><xsl:value-of select="text()" /></subfield> >+ </xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='017']"> >+ <datafield tag="021"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="b"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='086']"> >+ <datafield tag="22"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='2']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="b"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="z"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='030']"> >+ <datafield tag="040"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="z"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='028']"> >+ <datafield tag="071"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2"> >+ <xsl:choose> >+ <xsl:when test="@ind2 = 0">0</xsl:when> >+ <xsl:otherwise>1</xsl:otherwise> >+ </xsl:choose> >+ </xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="b"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='041']"> >+ <datafield tag="101"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="d"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='d']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='e']"><subfield code="h"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='f']"><subfield code="e"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="i"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='h']"><subfield code="c"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='044']"> >+ <datafield tag="102"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <!--<xsl:for-each select="marc:subfield[@code='b']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='245']"> >+ <datafield tag="200"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"> >+ <subfield code="a"><xsl:value-of select="text()" /></subfield> >+ <xsl:if test="contains(text(),' = ')"> >+ <subfield code="d"><xsl:value-of select="concat('=',substring-after(text(),' =' ))" /></subfield> >+ </xsl:if> >+ </xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="e"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='c']"> >+ <xsl:choose> >+ <xsl:when test="contains(text(),' / ')"> >+ <subfield code="f"><xsl:value-of select="substring-before(text(),' / ')" /></subfield> >+ <subfield code="g"><xsl:value-of select="substring-after(text(),' / ')" /></subfield> >+ </xsl:when> >+ <xsl:otherwise> >+ <subfield code="f"><xsl:value-of select="text()" /></subfield> >+ </xsl:otherwise> >+ </xsl:choose> >+ </xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='n']"><subfield code="h"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='p']"><subfield code="i"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ <!-- FIXME --> >+ <!-- >+ <datafield tag="204"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='h']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ --> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='250']"> >+ <datafield tag="205"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='254']"> >+ <datafield tag="208"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='260']"> >+ <datafield tag="210"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="c"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='c']"><subfield code="d"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='e']"><subfield code="e"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='f']"><subfield code="g"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="h"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='263']"> >+ <datafield tag="211"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='300']"> >+ <datafield tag="215"> >+ <xsl:choose> >+ <xsl:when test="@ind = 1"><xsl:attribute name="ind1">0</xsl:attribute></xsl:when> >+ <xsl:otherwise><xsl:attribute name="ind1">1</xsl:attribute></xsl:otherwise> >+ </xsl:choose> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="c"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='c']"><subfield code="d"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='e']"><subfield code="e"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='490']"> >+ <datafield tag="225"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='v']"><subfield code="v"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='256']"> >+ <datafield tag="230"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='500']"> >+ <datafield tag="300"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='525']"> >+ <datafield tag="300"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='555']"> >+ <datafield tag="300"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='504']"> >+ <datafield tag="320"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='505']"> >+ <datafield tag="327"> >+ <!-- FIXME: Dummy indicators --> >+ <!--<xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute>--> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <!--<xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute>--> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <subfield code="a">bla</subfield> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='502']"> >+ <datafield tag="328"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='520']"> >+ <datafield tag="330"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='524']"> >+ <datafield tag="332"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='521']"> >+ <datafield tag="333"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='500']"> >+ <datafield tag="336"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='538']"> >+ <datafield tag="337"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='037']"> >+ <datafield tag="345"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="b"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='f']"><subfield code="c"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='c']"><subfield code="d"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='760']"> >+ <datafield tag="410"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='w']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="v"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='762']"> >+ <datafield tag="411"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='w']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="v"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='770']"> >+ <datafield tag="421"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='w']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="v"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='772']"> >+ <datafield tag="422"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='w']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="v"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='777']"> >+ <datafield tag="423"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='w']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="v"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='780']"> >+ <datafield tag="430"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='w']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="v"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='785']"> >+ <datafield tag="440"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='w']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="v"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='775']"> >+ <datafield tag="451"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='w']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="v"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='776']"> >+ <datafield tag="452"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='w']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="v"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='767']"> >+ <datafield tag="453"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='w']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="v"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='765']"> >+ <datafield tag="454"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='w']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="v"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='787']"> >+ <datafield> >+ <xsl:choose> >+ <xsl:when test="contains(subfield[@code='i'],'Reproduction of:')"><xsl:attribute name="tag" select="455" /></xsl:when> >+ <xsl:when test="contains(subfield[@code='i'],'Reproduced as:')"><xsl:attribute name="tag" select="456" /></xsl:when> >+ <xsl:when test="contains(subfield[@code='i'],'Item reviewed:')"><xsl:attribute name="tag" select="470" /></xsl:when> >+ <xsl:otherwise> >+ <xsl:attribute name="tag" select="488" /> >+ </xsl:otherwise> >+ </xsl:choose> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='w']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="v"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='774']"> >+ <datafield> >+ <xsl:choose> >+ <xsl:when test="subfield[@code='i']"> >+ <xsl:attribute name="tag" select="462" /> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:attribute name="tag" select="461" /> >+ </xsl:otherwise> >+ </xsl:choose> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='w']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="v"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='773']"> >+ <datafield tag="463"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='w']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="v"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='774']"> >+ <datafield tag="464"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='w']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="v"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='730']"> >+ <datafield tag="500"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='d']"><subfield code="n"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='f']"><subfield code="k"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="n"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='k']"><subfield code="j"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='l']"><subfield code="m"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='m']"><subfield code="r"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='n']"><subfield code="h"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='o']"><subfield code="w"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='p']"><subfield code="i"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='r']"><subfield code="u"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='s']"><subfield code="q"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='243']"> >+ <datafield tag="501"> >+ <xsl:attribute name="ind1">1</xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='k']"><subfield code="e"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='f']"><subfield code="k"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='l']"><subfield code="m"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='247']"> >+ <datafield tag="520"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="e"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='n']"><subfield code="h"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='p']"><subfield code="i"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="n"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='f']"><subfield code="j"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='222']"> >+ <datafield tag="530"> >+ <xsl:attribute name="ind1">0</xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="b"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='210']"> >+ <datafield tag="531"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="b"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='246']"> >+ <datafield tag="532"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2">0</xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='242']"> >+ <datafield tag="541"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="e"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='n']"><subfield code="h"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='p']"><subfield code="i"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='y']"><subfield code="z"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='773']"> >+ <datafield tag="545"> >+ <xsl:attribute name="ind1"> >+ <xsl:choose> >+ <xsl:when test="@ind1 = 0">1</xsl:when> >+ <xsl:otherwise>0</xsl:otherwise> >+ </xsl:choose> >+ </xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='610']"> >+ <datafield tag="601"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"> >+ <subfield code="a"><xsl:value-of select="text()" /></subfield> >+ <subfield code="c"><xsl:value-of select="substring-before(substring-after(text(),'('),')')" /></subfield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="b"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='c']"><subfield code="e"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='d']"><subfield code="f"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='e']"><subfield code="b"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <!--<xsl:for-each select="marc:subfield[@code='f']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <!--<xsl:for-each select="marc:subfield[@code='g']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <xsl:for-each select="marc:subfield[@code='k']"><subfield code="j"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <!--<xsl:for-each select="marc:subfield[@code='l']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <!--<xsl:for-each select="marc:subfield[@code='m']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <xsl:for-each select="marc:subfield[@code='n']"><subfield code="d"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <!--<xsl:for-each select="marc:subfield[@code='o']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <!--<xsl:for-each select="marc:subfield[@code='p']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <!--<xsl:for-each select="marc:subfield[@code='r']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <!--<xsl:for-each select="marc:subfield[@code='s']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <!--<xsl:for-each select="marc:subfield[@code='t']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <!--<xsl:for-each select="marc:subfield[@code='u']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='y']"><subfield code="z"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <!--<xsl:for-each select="marc:subfield[@code='?']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='611']"> >+ <datafield tag="601"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"> >+ <subfield code="a"><xsl:value-of select="text()" /></subfield> >+ <subfield code="c"><xsl:value-of select="substring-before(substring-after(text(),'('),')')" /></subfield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='c']"><subfield code="e"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='d']"><subfield code="f"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='e']"><subfield code="b"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <!--<xsl:for-each select="marc:subfield[@code='f']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <!--<xsl:for-each select="marc:subfield[@code='g']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <xsl:for-each select="marc:subfield[@code='k']"><subfield code="j"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <!--<xsl:for-each select="marc:subfield[@code='l']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <xsl:for-each select="marc:subfield[@code='n']"><subfield code="d"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <!--<xsl:for-each select="marc:subfield[@code='p']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <!--<xsl:for-each select="marc:subfield[@code='s']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <!--<xsl:for-each select="marc:subfield[@code='u']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='y']"><subfield code="z"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <!--<xsl:for-each select="marc:subfield[@code='?']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='630']"> >+ <datafield tag="605"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <!--<xsl:for-each select="marc:subfield[@code='d']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <xsl:for-each select="marc:subfield[@code='f']"><subfield code="k"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="n"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='k']"><subfield code="j"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='l']"><subfield code="m"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='m']"><subfield code="r"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='n']"><subfield code="h"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='o']"><subfield code="w"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='p']"><subfield code="i"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='r']"><subfield code="u"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='s']"><subfield code="q"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <!--<xsl:for-each select="marc:subfield[@code='t']"><subfield code="?"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='y']"><subfield code="z"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <!--<xsl:for-each select="marc:subfield[@code='?']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='600']"> >+ <datafield tag="600"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"> >+ <xsl:choose> >+ <xsl:when test="@ind1 = 0">0</xsl:when> >+ <xsl:otherwise>1</xsl:otherwise> >+ </xsl:choose> >+ </xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"> >+ <subfield code="a"><xsl:value-of select="substring-before(text(),', ')" /></subfield> >+ <subfield code="b"><xsl:value-of select="substring-after(text(),', ')" /></subfield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='c']"><subfield code="c"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="d"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='d']"><subfield code="f"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='y']"><subfield code="z"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='2']"><subfield code="2"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ <datafield tag="602"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='t']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='y']"><subfield code="z"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='2']"><subfield code="2"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='630']"> >+ <datafield tag="605"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='n']"><subfield code="h"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='p']"><subfield code="i"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='f']"><subfield code="k"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='k']"><subfield code="l"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='l']"><subfield code="m"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='g']"><subfield code="n"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='s']"><subfield code="q"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='r']"><subfield code="r"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='n']"><subfield code="s"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='o']"><subfield code="t"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='r']"><subfield code="u"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='y']"><subfield code="z"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='2']"><subfield code="2"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='650']"> >+ <datafield tag="606"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='y']"><subfield code="z"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='2']"><subfield code="2"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='651']"> >+ <datafield tag="607"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"> >+ <subfield code="a"><xsl:value-of select="substring-before(text(),', ')" /></subfield> >+ <subfield code="b"><xsl:value-of select="substring-after(text(),', ')" /></subfield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='x']"><subfield code="x"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='z']"><subfield code="y"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='y']"><subfield code="z"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='2']"><subfield code="2"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='653']"> >+ <datafield tag="610"> >+ <xsl:attribute name="ind1"> >+ <xsl:choose> >+ <xsl:when test="@ind1 = ' '">0</xsl:when> >+ <xsl:otherwise><xsl:value-of select="@ind1" /></xsl:otherwise> >+ </xsl:choose> >+ </xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='752']"> >+ <datafield tag="620"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield"><subfield code="@code"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='753']"> >+ <datafield tag="626"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield"><subfield code="@code"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='043']"> >+ <datafield tag="660"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield"><subfield code="@code"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='045']"> >+ <datafield tag="661"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='886']"> >+ <datafield tag="670"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="b"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="c"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='2']"><subfield code="d"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='080']"> >+ <datafield tag="675"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='082']"> >+ <datafield tag="676"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='2']"><subfield code="v"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='050']"> >+ <datafield tag="680"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="b"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='084']"> >+ <datafield tag="686"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="b"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='2']"><subfield code="2"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='100']"> >+ <datafield tag="700"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"> >+ <subfield code="a"><xsl:value-of select="substring-before(text(),', ')" /></subfield> >+ <subfield code="b"><xsl:value-of select="substring-after(text(),', ')" /></subfield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="d"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='c']"><subfield code="c"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='d']"><subfield code="f"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='e']"><subfield code="4"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='q']"><subfield code="g"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='u']"><subfield code="p"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <!--<xsl:for-each select="marc:subfield[@code='?']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <xsl:for-each select="marc:subfield[@code='4']"><subfield code="4"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='700']"> >+ <datafield tag="701"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"> >+ <subfield code="a"><xsl:value-of select="substring-before(text(),', ')" /></subfield> >+ <subfield code="b"><xsl:value-of select="substring-after(text(),', ')" /></subfield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="d"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='c']"><subfield code="c"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='d']"><subfield code="f"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='e']"><subfield code="4"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='q']"><subfield code="g"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='u']"><subfield code="p"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <!--<xsl:for-each select="marc:subfield[@code='?']"><subfield code="3"><xsl:value-of select="text()" /></subfield></xsl:for-each>--> >+ <xsl:for-each select="marc:subfield[@code='4']"><subfield code="4"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='110']"> >+ <datafield tag="710"> >+ <xsl:attribute name="ind1">0</xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="b"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='n']"><subfield code="d"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='c']"><subfield code="e"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='d']"><subfield code="f"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='u']"><subfield code="p"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='4']"><subfield code="4"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='111']"> >+ <datafield tag="710"> >+ <xsl:attribute name="ind1">1</xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='e']"><subfield code="b"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='n']"><subfield code="d"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='c']"><subfield code="e"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='d']"><subfield code="f"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='u']"><subfield code="p"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='4']"><subfield code="4"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='710']"> >+ <datafield tag="711"> >+ <xsl:attribute name="ind1">0</xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='b']"><subfield code="b"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='n']"><subfield code="d"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='c']"><subfield code="e"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='d']"><subfield code="f"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='u']"><subfield code="p"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='4']"><subfield code="4"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='711']"> >+ <datafield tag="711"> >+ <xsl:attribute name="ind1">1</xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='e']"><subfield code="b"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='n']"><subfield code="d"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='c']"><subfield code="e"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='d']"><subfield code="f"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='u']"><subfield code="p"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='4']"><subfield code="4"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='100']"> >+ <datafield tag="720"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='d']"><subfield code="f"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='4']"><subfield code="4"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='700']"> >+ <datafield tag="721"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='d']"><subfield code="f"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ <xsl:for-each select="marc:subfield[@code='4']"><subfield code="4"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:controlfield[@tag='008']"> >+ <datafield tag="802"> >+ <xsl:attribute name="ind1"><xsl:value-of select="' '" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="' '" /></xsl:attribute> >+ <subfield code="a"> >+ <xsl:choose> >+ <xsl:when test="substring(text(),21,1) = '0'">00</xsl:when> >+ <xsl:when test="substring(text(),21,1) = '1'">01</xsl:when> >+ <xsl:when test="substring(text(),21,1) = '4'">04</xsl:when> >+ <xsl:when test="substring(text(),21,1) = '#'">uu</xsl:when> >+ <xsl:when test="substring(text(),21,1) = 'z'">zz</xsl:when> >+ <xsl:otherwise>zz</xsl:otherwise> >+ </xsl:choose> >+ </subfield> >+ </datafield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='590']"> >+ <datafield tag="900"> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1" /></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2" /></xsl:attribute> >+ <xsl:for-each select="marc:subfield[@code='a']"><subfield code="a"><xsl:value-of select="text()" /></subfield></xsl:for-each> >+ </datafield> >+ </xsl:for-each> >+ </record> >+ </xsl:for-each> >+ </collection> >+ </xsl:template> >+</xsl:stylesheet> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCtoMARC21.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCtoMARC21.xsl >new file mode 100644 >index 0000000..8fcd420 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCtoMARC21.xsl >@@ -0,0 +1,523 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<!-- >+Copyright 2011 Rijksmuseum. >+This file is part of Koha. >+Koha is free software; you can redistribute it and/or modify it under the >+terms of the GNU General Public License as published by the Free Software >+Foundation; either version 2 of the License, or (at your option) any later >+version. >+Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+You should have received a copy of the GNU General Public License along >+with Koha; if not, write to the Free Software Foundation, Inc., >+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+--> >+<!-- >+NOTE: This stylesheet converts UNIMARC to MARC21. >+IMPORTANT: Please note that MARC21 and UNIMARC are different in restrictions >+for tags and subfields to be repeatable. In this stylesheet this difference >+implies the careful use of if and value-of on one side and for-each and copy-of >+on the other side!! >+FIXME: Currently, it only converts the most important MARC fields. Add more! >+--> >+<xsl:stylesheet xmlns:marc="http://www.loc.gov/MARC21/slim" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> >+ <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> >+ <xsl:template match="/"> >+ <collection> >+ <xsl:apply-templates/> >+ </collection> >+ </xsl:template> >+ >+ <xsl:template match="marc:record"> >+ <record> >+ <xsl:call-template name="leader"/> >+ <xsl:call-template name="copy_control"> >+ <xsl:with-param name="tagno">001</xsl:with-param> >+ </xsl:call-template> >+ <xsl:call-template name="control005"/> >+ <xsl:call-template name="control008"/> >+ >+ <xsl:call-template name="isbn_issn"/> >+ <xsl:call-template name="author"/> >+ <xsl:call-template name="author_corp"/> >+ <xsl:call-template name="title"/> >+ <xsl:call-template name="edition"/> >+ <xsl:call-template name="publication"/> >+ <xsl:call-template name="physicaldesc"/> >+ <xsl:call-template name="note_general"/> >+ <xsl:call-template name="subject_person"/> >+ <xsl:call-template name="subject_topic"/> >+ <xsl:call-template name="subject_geo"/> >+ <xsl:call-template name="subject_uncontrolled"/> >+ <xsl:call-template name="pers_name"/> >+ <xsl:call-template name="corp_name"/> >+ </record> >+ </xsl:template> >+ >+ <!-- Named templates --> >+ >+ <xsl:template name="leader"> >+ <xsl:variable name="leader" select="marc:leader"/> >+ <leader> >+ <xsl:text>00000na</xsl:text> >+ <xsl:choose> >+ <xsl:when test="contains('cms',substring($leader,8,1))"> >+ <xsl:value-of select="substring($leader,8,1)"/> >+ </xsl:when> >+ <xsl:otherwise><xsl:text>m</xsl:text></xsl:otherwise> >+ </xsl:choose> >+ <xsl:text> a2200000u</xsl:text> >+ <xsl:choose> >+ <xsl:when test="contains('i ',substring($leader,19,1))"> >+ <xsl:text>i</xsl:text> >+ </xsl:when> >+ <xsl:when test="substring($leader,19,1)='n'"> >+ <xsl:text> </xsl:text> >+ </xsl:when> >+ <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise> >+ </xsl:choose> >+ <xsl:text> 4500</xsl:text> >+ </leader> >+ </xsl:template> >+ >+ <xsl:template name="control005"> >+ <xsl:choose> >+ <xsl:when test="marc:controlfield[@tag='005']"> >+ <xsl:copy-of select="marc:controlfield[@tag='005']"/> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:if test="marc:datafield[@tag='801']/marc:subfield[@code='c']"> >+ <controlfield tag="005"> >+ <xsl:value-of select="marc:datafield[@tag='801']/marc:subfield[@code='c']"/> >+ </controlfield> >+ </xsl:if> >+ </xsl:otherwise> >+ </xsl:choose> >+ </xsl:template> >+ >+ <xsl:template name="control008"> >+ <!-- FIXME: Some conversions here are simplified: >+ Processing of pubdate type >+ Material dependent pos 18-34 >+ --> >+ <controlfield tag="008"> >+ <xsl:value-of select="substring(marc:datafield[@tag='100']/marc:subfield[@code='a'],3,6)"/> >+ <xsl:choose> >+ <xsl:when test="substring(marc:leader,8,1)='s'"> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:text>s</xsl:text> >+ <xsl:value-of select="substring(marc:datafield[@tag='100']/marc:subfield[@code='a'],10,4)"/> >+ <xsl:text> </xsl:text> >+ </xsl:otherwise> >+ <xsl:value-of select="translate(substring(marc:datafield[@tag='100']/marc:subfield[@code='a'],9,1),'abc','cdu')"/> >+ <xsl:value-of select="substring(marc:datafield[@tag='100']/marc:subfield[@code='a'],10,8)"/> >+ </xsl:choose> >+ <!-- pos 15-17 place publication; 102a is two char code --> >+ <xsl:choose> >+ <xsl:when test="marc:datafield[@tag='102']/marc:subfield[@code='a']"> >+ <xsl:value-of select="substring(concat(marc:datafield[@tag='102']/marc:subfield[@code='a'],' '),1,3)"/> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:text>xx </xsl:text> >+ </xsl:otherwise> >+ </xsl:choose> >+ <!-- FIXME: pos 18-34 depending on material type --> >+ <xsl:text>|||||||||||||||||</xsl:text> >+ <!-- pos 35-37 language --> >+ <xsl:value-of select="substring(concat(marc:datafield[@tag='101']/marc:subfield[@code='a'],' '),1,3)"/> >+ <!-- pos 38,39 modified, cataloging source --> >+ <xsl:text> d</xsl:text> >+ </controlfield> >+ </xsl:template> >+ >+ <xsl:template name="isbn_issn"> >+ <xsl:if test="marc:datafield[@tag='010']"> >+ <datafield tag="020" ind1=" " ind2=" "> >+ <subfield code="a"> >+ <xsl:value-of select="marc:datafield[@tag='010']/marc:subfield[@code='a']"/> >+ </subfield> >+ <xsl:if test="marc:datafield[@tag='010']/marc:subfield[@code='b']"> >+ <subfield code="b"> >+ <xsl:value-of select="marc:datafield[@tag='010']/marc:subfield[@code='b']"/> >+ </subfield> >+ </xsl:if> >+ <xsl:if test="marc:datafield[@tag='010']/marc:subfield[@code='d']"> >+ <subfield code="c"> >+ <xsl:value-of select="marc:datafield[@tag='010']/marc:subfield[@code='d']"/> >+ </subfield> >+ </xsl:if> >+ <xsl:copy-of select="marc:datafield[@tag='010']/marc:subfield[@code='z']"/> >+ </datafield> >+ </xsl:if> >+ <xsl:if test="marc:datafield[@tag='011']"> >+ <datafield tag="022" ind1=" " ind2=" "> >+ <subfield code="a"> >+ <xsl:value-of select="marc:datafield[@tag='011']/marc:subfield[@code='a']"/> >+ </subfield> >+ <xsl:copy-of select="marc:datafield[@tag='011']/marc:subfield[@code='z']"/> >+ </datafield> >+ </xsl:if> >+ </xsl:template> >+ >+ <xsl:template name="author"> >+ <xsl:if test="marc:datafield[@tag='700']"> >+ <datafield tag="100"> >+ <!-- 100c only is R --> >+ <xsl:call-template name="copy_indicators"><xsl:with-param name="tagno">700</xsl:with-param></xsl:call-template> >+ <subfield code="a"> >+ <xsl:value-of select="marc:datafield[@tag='700']/marc:subfield[@code='a']"/> >+ <xsl:if test="marc:datafield[@tag='700']/marc:subfield[@code='b']"> >+ <xsl:text>, </xsl:text> >+ <xsl:value-of select="marc:datafield[@tag='700']/marc:subfield[@code='b']"/> >+ </xsl:if> >+ </subfield> >+ <xsl:if test="marc:datafield[@tag='700']/marc:subfield[@code='d']"> >+ <subfield code='b'> >+ <xsl:value-of select="marc:datafield[@tag='700']/marc:subfield[@code='d']"/> >+ </subfield> >+ </xsl:if> >+ <xsl:copy-of select="marc:datafield[@tag='700']/marc:subfield[@code='c']"/> >+ <xsl:if test="marc:datafield[@tag='700']/marc:subfield[@code='f']"> >+ <subfield code='d'> >+ <xsl:value-of select="marc:datafield[@tag='700']/marc:subfield[@code='f']"/> >+ </subfield> >+ </xsl:if> >+ <xsl:if test="marc:datafield[@tag='700']/marc:subfield[@code='g']"> >+ <subfield code='q'> >+ <xsl:value-of select="marc:datafield[@tag='700']/marc:subfield[@code='g']"/> >+ </subfield> >+ </xsl:if> >+ </datafield> >+ </xsl:if> >+ </xsl:template> >+ >+ <xsl:template name="author_corp"> >+ <xsl:if test="marc:datafield[@tag='710']"> >+ <datafield> >+ <xsl:variable name="type" select="marc:datafield[@tag='710']/@ind1"/> >+ <xsl:choose> >+ <xsl:when test="$type=1"> >+ <xsl:attribute name="tag">111</xsl:attribute> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:attribute name="tag">110</xsl:attribute> >+ </xsl:otherwise> >+ </xsl:choose> >+ <xsl:attribute name="ind1"> >+ <xsl:value-of select="marc:datafield[@tag='710']/@ind2"/> >+ </xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:text> </xsl:text></xsl:attribute> >+ >+ <subfield code="a"> >+ <xsl:value-of select="marc:datafield[@tag='710']/marc:subfield[@code='a']"/> >+ <xsl:for-each select="marc:datafield[@tag='710']/marc:subfield[@code='c']"> >+ <xsl:text>, </xsl:text> >+ <xsl:value-of select="."/> >+ </xsl:for-each> >+ </subfield> >+ <xsl:copy-of select="marc:datafield[@tag='710']/marc:subfield[@code='b']"/> >+ <xsl:if test="marc:datafield[@tag='710']/marc:subfield[@code='e']"> >+ <subfield code='c'> >+ <xsl:value-of select="marc:datafield[@tag='710']/marc:subfield[@code='e']"/> >+ </subfield> >+ </xsl:if> >+ <xsl:if test="marc:datafield[@tag='710']/marc:subfield[@code='f']"> >+ <subfield code='d'> >+ <xsl:value-of select="marc:datafield[@tag='710']/marc:subfield[@code='f']"/> >+ </subfield> >+ </xsl:if> >+ <xsl:if test="marc:datafield[@tag='710']/marc:subfield[@code='d']"> >+ <subfield code='n'> >+ <xsl:value-of select="marc:datafield[@tag='710']/marc:subfield[@code='d']"/> >+ </subfield> >+ </xsl:if> >+ <xsl:if test="marc:datafield[@tag='710']/marc:subfield[@code='p']"> >+ <subfield code='u'> >+ <xsl:value-of select="marc:datafield[@tag='710']/marc:subfield[@code='p']"/> >+ </subfield> >+ </xsl:if> >+ <xsl:copy-of select="marc:datafield[@tag='710']/marc:subfield[@code='4']"/> >+ </datafield> >+ </xsl:if> >+ </xsl:template> >+ >+ <xsl:template name="title"> >+ <datafield tag="245"> >+ <!-- 245abc are NR, 245np are R --> >+ <xsl:call-template name="copy_indicators"><xsl:with-param name="tagno">200</xsl:with-param></xsl:call-template> >+ <subfield code="a"> >+ <xsl:value-of select="marc:datafield[@tag='200']/marc:subfield[@code='a']"/> >+ </subfield> >+ >+ <xsl:variable name="tagd" select="marc:datafield[@tag='200']/marc:subfield[@code='d']"/> >+ <xsl:variable name="tage" select="marc:datafield[@tag='200']/marc:subfield[@code='e']"/> >+ <xsl:if test="$tagd!='' or $tage!=''"> >+ <subfield code="b"> >+ <xsl:value-of select="$tagd"/> >+ <xsl:for-each select="marc:datafield[@tag='200']/marc:subfield[@code='e']"> >+ <xsl:text> : </xsl:text> >+ <xsl:value-of select="."/> >+ </xsl:for-each> >+ </subfield> >+ </xsl:if> >+ >+ <xsl:variable name="tagf" select="marc:datafield[@tag='200']/marc:subfield[@code='f']"/> >+ <xsl:variable name="tagg" select="marc:datafield[@tag='200']/marc:subfield[@code='g']"/> >+ <xsl:if test="$tagf!='' or $tagg!=''"> >+ <subfield code="c"> >+ <xsl:value-of select="$tagf"/> >+ <xsl:for-each select="marc:datafield[@tag='200']/marc:subfield[@code='g']"> >+ <xsl:text> ; </xsl:text> >+ <xsl:value-of select="."/> >+ </xsl:for-each> >+ </subfield> >+ </xsl:if> >+ >+ <xsl:for-each select="marc:datafield[@tag='200']/marc:subfield[@code='h']"> >+ <subfield code="n"><xsl:value-of select="."/></subfield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='200']/marc:subfield[@code='i']"> >+ <subfield code="p"><xsl:value-of select="."/></subfield> >+ </xsl:for-each> >+ </datafield> >+ </xsl:template> >+ >+ <xsl:template name="edition"> >+ <xsl:if test="marc:datafield[@tag='205']"> >+ <datafield tag="250" ind1=" " ind2=" "> >+ <!-- 250 a is NR --> >+ <xsl:copy-of select="marc:datafield[@tag='205'][1]/marc:subfield[@code='a'][1]"/> >+ <xsl:if test="marc:datafield[@tag='205']/marc:subfield[@code='f']"> >+ <subfield code='b'> >+ <xsl:value-of select="marc:datafield[@tag='205']/marc:subfield[@code='f']"/> >+ </subfield> >+ </xsl:if> >+ </datafield> >+ </xsl:if> >+ </xsl:template> >+ >+ <xsl:template name="publication"> >+ <xsl:if test="marc:datafield[@tag='210']"> >+ <datafield tag="260" ind1=" " ind2=" "> >+ <!-- 260 abc are repeatable: use for loops --> >+ <xsl:copy-of select="marc:datafield[@tag='210']/marc:subfield[@code='a']"/> >+ <xsl:for-each select="marc:datafield[@tag='210']/marc:subfield[@code='c']"> >+ <subfield code='b'> >+ <xsl:value-of select="."/> >+ </subfield> >+ </xsl:for-each> >+ <xsl:for-each select="marc:datafield[@tag='210']/marc:subfield[@code='d']"> >+ <subfield code='c'> >+ <xsl:value-of select="."/> >+ </subfield> >+ </xsl:for-each> >+ >+ <!-- 260 efg are not-repeatable: take the first element only --> >+ <xsl:copy-of select="marc:datafield[@tag='210']/marc:subfield[@code='e'][1]"/> >+ <xsl:if test="marc:datafield[@tag='210']/marc:subfield[@code='g']"> >+ <subfield code='f'> >+ <xsl:value-of select="marc:datafield[@tag='210']/marc:subfield[@code='g']"/> >+ </subfield> >+ </xsl:if> >+ <xsl:if test="marc:datafield[@tag='210']/marc:subfield[@code='h']"> >+ <subfield code='g'> >+ <xsl:value-of select="marc:datafield[@tag='210']/marc:subfield[@code='h']"/> >+ </subfield> >+ </xsl:if> >+ </datafield> >+ </xsl:if> >+ </xsl:template> >+ >+ <xsl:template name="physicaldesc"> >+ <xsl:for-each select="marc:datafield[@tag='215']"> >+ <!-- 300ac are R, 300be are NR --> >+ <datafield tag="300" ind1=" " ind2=" "> >+ <xsl:copy-of select="marc:subfield[@code='a']"/> >+ <xsl:if test="marc:subfield[@code='c']"> >+ <subfield code='b'> >+ <xsl:value-of select="marc:subfield[@code='c']"/> >+ </subfield> >+ </xsl:if> >+ <xsl:for-each select="marc:subfield[@code='d']"> >+ <subfield code='c'> >+ <xsl:value-of select="."/> >+ </subfield> >+ </xsl:for-each> >+ <xsl:copy-of select="marc:subfield[@code='e'][1]"/> >+ </datafield> >+ </xsl:for-each> >+ </xsl:template> >+ >+ <xsl:template name="note_general"> >+ <xsl:for-each select="marc:datafield[@tag='300']"> >+ <!-- 500a is R --> >+ <datafield tag="500" ind1=" " ind2=" "> >+ <xsl:copy-of select="marc:subfield[@code='a']"/> >+ </datafield> >+ </xsl:for-each> >+ </xsl:template> >+ >+ <xsl:template name="subject_person"> >+ <xsl:for-each select="marc:datafield[@tag='600']"> >+ <!-- only MARC21 600c is R --> >+ <datafield tag="600"> >+ <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="marc:subfield[@code='a'][1]"/> >+ <xsl:if test="marc:subfield[@code='d']"> >+ <subfield code='b'> >+ <xsl:value-of select="marc:subfield[@code='d']"/> >+ </subfield> >+ </xsl:if> >+ <xsl:copy-of select="marc:subfield[@code='c']"/> >+ <xsl:if test="marc:subfield[@code='f']"> >+ <subfield code='d'> >+ <xsl:value-of select="marc:subfield[@code='f']"/> >+ </subfield> >+ </xsl:if> >+ <xsl:if test="marc:subfield[@code='b']"> >+ <subfield code='q'> >+ <xsl:value-of select="marc:subfield[@code='b']"/> >+ </subfield> >+ </xsl:if> >+ </datafield> >+ </xsl:for-each> >+ </xsl:template> >+ >+ <xsl:template name="subject_topic"> >+ <xsl:for-each select="marc:datafield[@tag='606']"> >+ <!-- 650a is NR --> >+ <datafield tag="650" ind1=" " ind2="4"> >+ <xsl:copy-of select="marc:subfield[@code='a'][1]"/> >+ </datafield> >+ </xsl:for-each> >+ </xsl:template> >+ >+ <xsl:template name="subject_geo"> >+ <xsl:for-each select="marc:datafield[@tag='607']"> >+ <!-- 651a is NR --> >+ <datafield tag="651" ind1=" " ind2="4"> >+ <xsl:copy-of select="marc:subfield[@code='a'][1]"/> >+ </datafield> >+ </xsl:for-each> >+ </xsl:template> >+ >+ <xsl:template name="subject_uncontrolled"> >+ <xsl:for-each select="marc:datafield[@tag='610']"> >+ <!-- 653a is R --> >+ <datafield tag="653"> >+ <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="marc:subfield[@code='a']"/> >+ </datafield> >+ </xsl:for-each> >+ </xsl:template> >+ >+ <xsl:template name="pers_name"> >+ <xsl:for-each select="marc:datafield[@tag='701' or @tag='702']"> >+ <datafield tag="700"> >+ <!-- 700c only is R --> >+ <xsl:attribute name="ind1"><xsl:value-of select="@ind1"/></xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:value-of select="@ind2"/></xsl:attribute> >+ <subfield code="a"> >+ <xsl:value-of select="marc:subfield[@code='a']"/> >+ <xsl:if test="marc:subfield[@code='b']"> >+ <xsl:text>, </xsl:text> >+ <xsl:value-of select="marc:subfield[@code='b']"/> >+ </xsl:if> >+ </subfield> >+ <xsl:if test="marc:subfield[@code='d']"> >+ <subfield code='b'> >+ <xsl:value-of select="marc:subfield[@code='d']"/> >+ </subfield> >+ </xsl:if> >+ <xsl:copy-of select="marc:subfield[@code='c']"/> >+ <xsl:if test="marc:subfield[@code='f']"> >+ <subfield code='d'> >+ <xsl:value-of select="marc:subfield[@code='f']"/> >+ </subfield> >+ </xsl:if> >+ <xsl:if test="marc:subfield[@code='g']"> >+ <subfield code='q'> >+ <xsl:value-of select="marc:subfield[@code='g']"/> >+ </subfield> >+ </xsl:if> >+ </datafield> >+ </xsl:for-each> >+ </xsl:template> >+ >+ <xsl:template name="corp_name"> >+ <xsl:for-each select="marc:datafield[@tag='711' or @tag='712']"> >+ <datafield> >+ <xsl:variable name="type" select="@ind1"/> >+ <xsl:choose> >+ <xsl:when test="$type=1"> >+ <xsl:attribute name="tag">711</xsl:attribute> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:attribute name="tag">710</xsl:attribute> >+ </xsl:otherwise> >+ </xsl:choose> >+ <xsl:attribute name="ind1"> >+ <xsl:value-of select="@ind2"/> >+ </xsl:attribute> >+ <xsl:attribute name="ind2"><xsl:text> </xsl:text></xsl:attribute> >+ >+ <subfield code="a"> >+ <xsl:value-of select="marc:subfield[@code='a']"/> >+ <xsl:for-each select="marc:subfield[@code='c']"> >+ <xsl:text>, </xsl:text> >+ <xsl:value-of select="."/> >+ </xsl:for-each> >+ </subfield> >+ <xsl:copy-of select="marc:subfield[@code='b']"/> >+ <xsl:if test="marc:subfield[@code='e']"> >+ <subfield code='c'> >+ <xsl:value-of select="marc:subfield[@code='e']"/> >+ </subfield> >+ </xsl:if> >+ <xsl:if test="marc:subfield[@code='f']"> >+ <subfield code='d'> >+ <xsl:value-of select="marc:subfield[@code='f']"/> >+ </subfield> >+ </xsl:if> >+ <xsl:if test="marc:subfield[@code='d']"> >+ <subfield code='n'> >+ <xsl:value-of select="marc:subfield[@code='d']"/> >+ </subfield> >+ </xsl:if> >+ <xsl:if test="marc:subfield[@code='p']"> >+ <subfield code='u'> >+ <xsl:value-of select="marc:subfield[@code='p']"/> >+ </subfield> >+ </xsl:if> >+ <xsl:copy-of select="marc:subfield[@code='4']"/> >+ </datafield> >+ </xsl:for-each> >+ </xsl:template> >+ >+ <!-- And some utility functions --> >+ >+ <xsl:template name="copy_control"> >+ <xsl:param name="tagno"/> >+ <xsl:if test="marc:controlfield[@tag=$tagno]"> >+ <controlfield> >+ <xsl:attribute name="tag"><xsl:value-of select="$tagno"/></xsl:attribute> >+ <xsl:value-of select="marc:controlfield[@tag=$tagno]" /> >+ </controlfield> >+ </xsl:if> >+ </xsl:template> >+ >+ <xsl:template name="copy_indicators"> >+ <xsl:param name="tagno"/> >+ <xsl:attribute name="ind1"> >+ <xsl:value-of select="marc:datafield[@tag=$tagno]/@ind1"/> >+ </xsl:attribute> >+ <xsl:attribute name="ind2"> >+ <xsl:value-of select="marc:datafield[@tag=$tagno]/@ind2"/> >+ </xsl:attribute> >+ </xsl:template> >+ >+</xsl:stylesheet> >-- >1.6.0.6 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6536
:
4540
|
4541
|
4959
|
6901
|
6919
|
6920
|
6924
|
13462
|
26169
|
26170
|
26171
|
26172
|
29754
|
29755
|
29756
|
29779
|
29780
|
29788
|
29790
|
29791
|
29812
|
29813
|
29814
|
29815
|
29816
|
29817
|
29818
|
29819
|
30189
|
30190
|
30191
|
30192
|
30193
|
30194
|
30900
|
30901
|
30902
|
30903
|
30904
|
30905
|
30906
|
30907
|
30929
|
30930
|
30931
|
30932
|
30933
|
30934
|
30935
|
30936
|
31046
|
31048
|
31137
|
31193
|
31194
|
31195
|
31227
|
31247
|
31248
|
37264