Bugzilla – Attachment 4667 Details for
Bug 6590
Removing hyphens from ISBN and ISSN when cataloging a biblio
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Removing hyphens from isbn and issn
0035-Bug-6590-Removing-hyphens-from-isbn-and-issn.patch (text/plain), 26.38 KB, created by
Juan Romay Sieira
on 2011-07-19 11:35:43 UTC
(
hide
)
Description:
Removing hyphens from isbn and issn
Filename:
MIME Type:
Creator:
Juan Romay Sieira
Created:
2011-07-19 11:35:43 UTC
Size:
26.38 KB
patch
obsolete
>From 68502710bee2ac6cf9389703ced51f48da58233b Mon Sep 17 00:00:00 2001 >From: Juan Romay Sieira <juan.sieira@xercode.es> >Date: Tue, 19 Jul 2011 13:23:41 +0200 >Subject: [PATCH 35/35] [Bug 6590] - Removing hyphens from isbn and issn. > It removes hyphens from isbn and issn when zebra operations are executed and with rebuild_zebra.pl >Content-Type: text/plain; charset="utf-8" > >--- > C4/Search.pm | 2 +- > admin/systempreferences.pl | 1 + > installer/data/mysql/de-DE/mandatory/sysprefs.sql | 1 + > installer/data/mysql/en/mandatory/sysprefs.sql | 1 + > .../1-Obligatoire/unimarc_standard_systemprefs.sql | 1 + > installer/data/mysql/it-IT/necessari/sysprefs.sql | 1 + > .../data/mysql/nb-NO/1-Obligatorisk/sysprefs.sql | 1 + > installer/data/mysql/pl-PL/mandatory/sysprefs.sql | 1 + > ...m_preferences_full_optimal_for_install_only.sql | 1 + > ...m_preferences_full_optimal_for_install_only.sql | 1 + > installer/data/mysql/updatedatabase.pl | 7 ++ > .../en/modules/admin/preferences/cataloguing.pref | 6 ++ > misc/bin/zebraqueue_daemon.pl | 33 ++++++++++ > misc/cronjobs/zebraqueue_start.pl | 33 ++++++++++ > misc/migration_tools/rebuild_zebra.pl | 63 ++++++++++++++++++++ > .../xsl/RemoveISBN-ISSNHyphensMARC21.xsl | 56 +++++++++++++++++ > .../xsl/RemoveISBN-ISSNHyphensUNIMARC.xsl | 56 +++++++++++++++++ > 17 files changed, 264 insertions(+), 1 deletions(-) > create mode 100644 misc/migration_tools/xsl/RemoveISBN-ISSNHyphensMARC21.xsl > create mode 100644 misc/migration_tools/xsl/RemoveISBN-ISSNHyphensUNIMARC.xsl > >diff --git a/C4/Search.pm b/C4/Search.pm >index c3cff65..069c55e 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -1164,7 +1164,7 @@ sub buildQuery { > $weight_fields, $fuzzy_enabled, > $remove_stopwords > ) = ( 0, 0, 0, 0, 0 ); >- >+ $operand =~ s/-//g if (C4::Context->preference("IsbnIssnRemoveHyphens")); > } > > if(not $index){ >diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl >index 87ecac4..884eafb 100755 >--- a/admin/systempreferences.pl >+++ b/admin/systempreferences.pl >@@ -153,6 +153,7 @@ $tabsysprefs{'item-level_itypes'} = "Cataloging"; > $tabsysprefs{OpacSuppression} = "Cataloging"; > $tabsysprefs{SpineLabelFormat} = "Cataloging"; > $tabsysprefs{SpineLabelAutoPrint} = "Cataloging"; >+$tabsysprefs{IsbnIssnRemoveHyphens} = "Cataloging"; > > # Circulation > $tabsysprefs{maxoutstanding} = "Circulation"; >diff --git a/installer/data/mysql/de-DE/mandatory/sysprefs.sql b/installer/data/mysql/de-DE/mandatory/sysprefs.sql >index 6eb67a3..6fe546a 100755 >--- a/installer/data/mysql/de-DE/mandatory/sysprefs.sql >+++ b/installer/data/mysql/de-DE/mandatory/sysprefs.sql >@@ -314,3 +314,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems' ,'','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/O pacHiddenItems.txt for more informations.','','Textarea'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice'); >+INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('IsbnIssnRemoveHyphens', '0', '', 'Remove or not hyphens from ISBN and ISSN', 'YesNo'); >diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql >index 0abf9d8..3b26b1a 100755 >--- a/installer/data/mysql/en/mandatory/sysprefs.sql >+++ b/installer/data/mysql/en/mandatory/sysprefs.sql >@@ -314,3 +314,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice'); >+INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('IsbnIssnRemoveHyphens', '0', '', 'Remove or not hyphens from ISBN and ISSN', 'YesNo'); >diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql >index 59a258f..cc59963 100755 >--- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql >+++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql >@@ -315,3 +315,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice'); >+INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('IsbnIssnRemoveHyphens', '0', '', 'Remove or not hyphens from ISBN and ISSN', 'YesNo'); >diff --git a/installer/data/mysql/it-IT/necessari/sysprefs.sql b/installer/data/mysql/it-IT/necessari/sysprefs.sql >index dcdf0ee..35b2790 100755 >--- a/installer/data/mysql/it-IT/necessari/sysprefs.sql >+++ b/installer/data/mysql/it-IT/necessari/sysprefs.sql >@@ -301,3 +301,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/O pacHiddenItems.txt for more informations.','','Textarea'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice'); >+INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('IsbnIssnRemoveHyphens', '0', '', 'Remove or not hyphens from ISBN and ISSN', 'YesNo'); >diff --git a/installer/data/mysql/nb-NO/1-Obligatorisk/sysprefs.sql b/installer/data/mysql/nb-NO/1-Obligatorisk/sysprefs.sql >index ca71769..1fbc993 100644 >--- a/installer/data/mysql/nb-NO/1-Obligatorisk/sysprefs.sql >+++ b/installer/data/mysql/nb-NO/1-Obligatorisk/sysprefs.sql >@@ -321,3 +321,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','','free'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the Staff client','','free'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all subdivisions for subject tracings.','1','YesNo'); >+INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('IsbnIssnRemoveHyphens', '0', '', 'Remove or not hyphens from ISBN and ISSN', 'YesNo'); >diff --git a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql >index 58ba035..0493267 100755 >--- a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql >+++ b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql >@@ -313,3 +313,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice'); >+INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('IsbnIssnRemoveHyphens', '0', '', 'Remove or not hyphens from ISBN and ISSN', 'YesNo'); >diff --git a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql >index 54c533c..53fb173 100755 >--- a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql >+++ b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql >@@ -368,3 +368,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice'); >+INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('IsbnIssnRemoveHyphens', '0', '', 'Remove or not hyphens from ISBN and ISSN', 'YesNo'); >diff --git a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql b/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql >index 9f095ab..0dbebe1 100755 >--- a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql >+++ b/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql >@@ -393,3 +393,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/O pacHiddenItems.txt for more informations.','','Textarea'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice'); >+INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('IsbnIssnRemoveHyphens', '0', '', 'Remove or not hyphens from ISBN and ISSN', 'YesNo'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 8fb9656..975b64f 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -4370,6 +4370,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > SetVersion($DBversion); > } > >+$DBversion = "3.05.00.XXX"; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do("INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('IsbnIssnRemoveHyphens', '0', '', 'Remove or not hyphens from ISBN and ISSN', 'YesNo');"); >+ print "Upgrade to $DBversion done (Add SysPref to remove hyphens or not into isbn and issn)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 DropAllForeignKeys($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >index 4fc1305..0632cab 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >@@ -84,6 +84,12 @@ Cataloging: > annual: generated in the form <year>-0001, <year>-0002. > hbyymmincr: generated in the form <branchcode>yymm0001. > "OFF": not generated automatically. >+ - >+ - pref: IsbnIssnRemoveHyphens >+ choices: >+ yes: "Remove" >+ no: "Don't remove" >+ - hyphens from ISBN and ISSN > Display: > - > - 'Separate multiple displayed authors, series or subjects with ' >diff --git a/misc/bin/zebraqueue_daemon.pl b/misc/bin/zebraqueue_daemon.pl >index 6181a94..4529584 100755 >--- a/misc/bin/zebraqueue_daemon.pl >+++ b/misc/bin/zebraqueue_daemon.pl >@@ -227,6 +227,39 @@ sub process_update { > my $marcxml; > if ($server eq "biblioserver") { > my $marc = GetMarcBiblio($record_number); >+ # >+ if ($marc && C4::Context->preference("IsbnIssnRemoveHyphens")){ >+ my $isbn; >+ my $issn; >+ my $encoding = C4::Context->preference("marcflavour"); >+ if ( $encoding eq 'UNIMARC' ) { >+ foreach my $f010 ($marc->field('010')) { >+ if ( $f010->subfield('a') ) { >+ $isbn = $f010->subfield('a'); >+ $isbn =~ s/-//g; >+ $f010->update( 'a' => $isbn ); >+ } >+ } >+ foreach my $f011 ($marc->field('011')) { >+ if ( $f011->subfield('a') ) { >+ $issn = $f011->subfield('a'); >+ $issn =~ s/-//g; >+ $f011->update( 'a' => $issn ); >+ } >+ } >+ } elsif ($encoding eq 'MARC21' || $encoding eq 'NORMARC') { >+ foreach my $f020 ($marc->field('020')) { >+ $isbn = $f020->subfield('a'); >+ $isbn =~ s/-//g; >+ $f020->update( 'a' => $isbn ); >+ } >+ foreach my $f022 ($marc->field('022')) { >+ $issn = $f022->subfield('a'); >+ $issn =~ s/-//g; >+ $f022->update( 'a' => $issn ); >+ } >+ } >+ } > $marcxml = $marc->as_xml_record() if $marc; > } > elsif ($server eq "authorityserver") { >diff --git a/misc/cronjobs/zebraqueue_start.pl b/misc/cronjobs/zebraqueue_start.pl >index ea84156..99c62e8 100755 >--- a/misc/cronjobs/zebraqueue_start.pl >+++ b/misc/cronjobs/zebraqueue_start.pl >@@ -58,6 +58,39 @@ while (($id,$biblionumber,$operation,$server)=$readsth->fetchrow){ > # get the XML > if ($server eq "biblioserver") { > my $marc = GetMarcBiblio($biblionumber); >+ # >+ if ($marc && C4::Context->preference("IsbnIssnRemoveHyphens")){ >+ my $isbn; >+ my $issn; >+ my $encoding = C4::Context->preference("marcflavour"); >+ if ( $encoding eq 'UNIMARC' ) { >+ foreach my $f010 ($marc->field('010')) { >+ if ( $f010->subfield('a') ) { >+ $isbn = $f010->subfield('a'); >+ $isbn =~ s/-//g; >+ $f010->update( 'a' => $isbn ); >+ } >+ } >+ foreach my $f011 ($marc->field('011')) { >+ if ( $f011->subfield('a') ) { >+ $issn = $f011->subfield('a'); >+ $issn =~ s/-//g; >+ $f011->update( 'a' => $issn ); >+ } >+ } >+ } elsif ($encoding eq 'MARC21' || $encoding eq 'NORMARC') { >+ foreach my $f020 ($marc->field('020')) { >+ $isbn = $f020->subfield('a'); >+ $isbn =~ s/-//g; >+ $f020->update( 'a' => $isbn ); >+ } >+ foreach my $f022 ($marc->field('022')) { >+ $issn = $f022->subfield('a'); >+ $issn =~ s/-//g; >+ $f022->update( 'a' => $issn ); >+ } >+ } >+ } > $marcxml = $marc->as_xml_record() if $marc; > } elsif ($server eq "authorityserver") { > $marcxml =C4::AuthoritiesMarc::GetAuthorityXML($biblionumber); >diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl >index dadf43f..193f03b 100755 >--- a/misc/migration_tools/rebuild_zebra.pl >+++ b/misc/migration_tools/rebuild_zebra.pl >@@ -320,6 +320,7 @@ sub export_marc_records_from_sth { > ? GetXmlBiblio( $record_number ) > : GetAuthorityXML( $record_number ); > if ($record_type eq 'biblio'){ >+ $marcxml = fix_isbn_hyphens($marcxml, 1) if C4::Context->preference("IsbnIssnRemoveHyphens"); > my @items = GetItemsInfo($record_number); > if (@items){ > my $record = MARC::Record->new; >@@ -433,6 +434,7 @@ sub get_corrected_marc_record { > > if (defined $marc) { > fix_leader($marc); >+ $marc = fix_isbn_hyphens($marc, 0) if C4::Context->preference("IsbnIssnRemoveHyphens"); > if ($record_type eq 'biblio') { > my $succeeded = fix_biblio_ids($marc, $record_number); > return unless $succeeded; >@@ -572,6 +574,67 @@ sub fix_unimarc_100 { > } > } > >+sub fix_isbn_hyphens { >+ my $data = shift; >+ my $isxml = shift; >+ >+ my $isbn; >+ my $issn; >+ my $encoding = C4::Context->preference("marcflavour"); >+ >+ if ( $encoding eq 'UNIMARC' ) { >+ unless ($isxml){ >+ foreach my $f010 ($data->field('010')) { >+ $isbn = $f010->subfield('a'); >+ $isbn =~ s/-//g; >+ $f010->update( 'a' => $isbn ); >+ } >+ foreach my $f011 ($data->field('011')) { >+ if ( $f011->subfield('a') ) { >+ $issn = $f011->subfield('a'); >+ $issn =~ s/-//g; >+ $f011->update( 'a' => $issn ); >+ } >+ } >+ }else{ >+ my $parser = XML::LibXML->new(); >+ $parser->recover_silently(1); >+ my $xslt = XML::LibXSLT->new(); >+ my $source = $parser->parse_string($data); >+ >+ my $style_doc = $parser->parse_file("$kohadir/misc/migration_tools/xsl/RemoveISBN-ISSNHyphensUNIMARC.xsl"); >+ my $stylesheet = $xslt->parse_stylesheet($style_doc); >+ my $result_parse = $stylesheet->transform($source); >+ $data = $stylesheet->output_string($result_parse); >+ } >+ } elsif ($encoding eq 'MARC21' || $encoding eq 'NORMARC') { >+ unless ($isxml){ >+ foreach my $f020 ($data->field('020')) { >+ $isbn = $f020->subfield('a'); >+ $isbn =~ s/-//g; >+ $f020->update( 'a' => $isbn ); >+ } >+ foreach my $f022 ($data->field('022')) { >+ $issn = $f022->subfield('a'); >+ $issn =~ s/-//g; >+ $f022->update( 'a' => $issn ); >+ } >+ }else{ >+ my $parser = XML::LibXML->new(); >+ $parser->recover_silently(1); >+ my $xslt = XML::LibXSLT->new(); >+ my $source = $parser->parse_string($data); >+ >+ my $style_doc = $parser->parse_file("$kohadir/misc/migration_tools/xsl/RemoveISBN-ISSNHyphensMARC21.xsl"); >+ my $stylesheet = $xslt->parse_stylesheet($style_doc); >+ my $result_parse = $stylesheet->transform($source); >+ $data = $stylesheet->output_string($result_parse); >+ } >+ } >+ >+ return $data; >+} >+ > sub do_indexing { > my ($record_type, $op, $record_dir, $reset_index, $noshadow, $record_format, $zebraidx_log_opt) = @_; > >diff --git a/misc/migration_tools/xsl/RemoveISBN-ISSNHyphensMARC21.xsl b/misc/migration_tools/xsl/RemoveISBN-ISSNHyphensMARC21.xsl >new file mode 100644 >index 0000000..c8a7eb5 >--- /dev/null >+++ b/misc/migration_tools/xsl/RemoveISBN-ISSNHyphensMARC21.xsl >@@ -0,0 +1,56 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pz="http://www.indexdata.com/pazpar2/1.0" xmlns:marc="http://www.loc.gov/MARC21/slim"> >+ <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/> >+ >+ <xsl:template name="replace-string"> >+ <xsl:param name="text" /> >+ <xsl:param name="from" /> >+ <xsl:param name="to" /> >+ >+ <xsl:choose> >+ <xsl:when test="contains($text, $from)"> >+ <xsl:variable name="before" select="substring-before($text, $from)" /> >+ <xsl:variable name="after" select="substring-after($text, $from)" /> >+ <xsl:variable name="prefix" select="concat($before, $to)" /> >+ <xsl:value-of select="$before" /> >+ <xsl:value-of select="$to" /> >+ <xsl:call-template name="replace-string"> >+ <xsl:with-param name="text" select="$after" /> >+ <xsl:with-param name="from" select="$from" /> >+ <xsl:with-param name="to" select="$to" /> >+ </xsl:call-template> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:value-of select="$text" /> >+ </xsl:otherwise> >+ </xsl:choose> >+ </xsl:template> >+ >+ <xsl:template match="node()|@*"> >+ <xsl:copy> >+ <xsl:apply-templates select="node()|@*"/> >+ </xsl:copy> >+ </xsl:template> >+ >+ <xsl:template match="marc:record/marc:datafield[@tag='020']/marc:subfield[@code='a']"> >+ <xsl:copy> >+ <xsl:attribute name="code">a</xsl:attribute> >+ <xsl:call-template name="replace-string"> >+ <xsl:with-param name="text" select="text()"/> >+ <xsl:with-param name="from" select="'-'"/> >+ <xsl:with-param name="to" select="''"/> >+ </xsl:call-template> >+ </xsl:copy> >+ </xsl:template> >+ >+ <xsl:template match="marc:record/marc:datafield[@tag='022']/marc:subfield[@code='a']"> >+ <xsl:copy> >+ <xsl:attribute name="code">a</xsl:attribute> >+ <xsl:call-template name="replace-string"> >+ <xsl:with-param name="text" select="text()"/> >+ <xsl:with-param name="from" select="'-'"/> >+ <xsl:with-param name="to" select="''"/> >+ </xsl:call-template> >+ </xsl:copy> >+ </xsl:template> >+</xsl:stylesheet> >\ No newline at end of file >diff --git a/misc/migration_tools/xsl/RemoveISBN-ISSNHyphensUNIMARC.xsl b/misc/migration_tools/xsl/RemoveISBN-ISSNHyphensUNIMARC.xsl >new file mode 100644 >index 0000000..fe50382 >--- /dev/null >+++ b/misc/migration_tools/xsl/RemoveISBN-ISSNHyphensUNIMARC.xsl >@@ -0,0 +1,56 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pz="http://www.indexdata.com/pazpar2/1.0" xmlns:marc="http://www.loc.gov/MARC21/slim"> >+ <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/> >+ >+ <xsl:template name="replace-string"> >+ <xsl:param name="text" /> >+ <xsl:param name="from" /> >+ <xsl:param name="to" /> >+ >+ <xsl:choose> >+ <xsl:when test="contains($text, $from)"> >+ <xsl:variable name="before" select="substring-before($text, $from)" /> >+ <xsl:variable name="after" select="substring-after($text, $from)" /> >+ <xsl:variable name="prefix" select="concat($before, $to)" /> >+ <xsl:value-of select="$before" /> >+ <xsl:value-of select="$to" /> >+ <xsl:call-template name="replace-string"> >+ <xsl:with-param name="text" select="$after" /> >+ <xsl:with-param name="from" select="$from" /> >+ <xsl:with-param name="to" select="$to" /> >+ </xsl:call-template> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:value-of select="$text" /> >+ </xsl:otherwise> >+ </xsl:choose> >+ </xsl:template> >+ >+ <xsl:template match="node()|@*"> >+ <xsl:copy> >+ <xsl:apply-templates select="node()|@*"/> >+ </xsl:copy> >+ </xsl:template> >+ >+ <xsl:template match="marc:record/marc:datafield[@tag='010']/marc:subfield[@code='a']"> >+ <xsl:copy> >+ <xsl:attribute name="code">a</xsl:attribute> >+ <xsl:call-template name="replace-string"> >+ <xsl:with-param name="text" select="text()"/> >+ <xsl:with-param name="from" select="'-'"/> >+ <xsl:with-param name="to" select="''"/> >+ </xsl:call-template> >+ </xsl:copy> >+ </xsl:template> >+ >+ <xsl:template match="marc:record/marc:datafield[@tag='011']/marc:subfield[@code='a']"> >+ <xsl:copy> >+ <xsl:attribute name="code">a</xsl:attribute> >+ <xsl:call-template name="replace-string"> >+ <xsl:with-param name="text" select="text()"/> >+ <xsl:with-param name="from" select="'-'"/> >+ <xsl:with-param name="to" select="''"/> >+ </xsl:call-template> >+ </xsl:copy> >+ </xsl:template> >+</xsl:stylesheet> >\ No newline at end of file >-- >1.7.1 >
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 6590
:
4637
|
4655
|
4656
| 4667