From 47c39a80da01afb40dc764242c313c5cc8ba4f95 Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Tue, 22 Dec 2020 15:41:53 +0100 Subject: [PATCH] Bug 19220: Allow XSLT processing for Z39.50 authority targets Test plan: 1) Apply the patch 2) Edit an authority Z3950/SRU source in Home > Administration > Z39.50/SRU servers 3) Add the path to an XSLT file in the "XSLT File(s) for transforming results" input, and save 4) Remove the content of the import_records table to avoid cache issues 5) Search for an authority with the "New from Z39.50/SRU" button in authorities home 6) Check that the XSLT transformation has been applied, both in results list and in the import window Here is an example XSLT which removes the 801 field from authorities: --- C4/Breeding.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/C4/Breeding.pm b/C4/Breeding.pm index 2a4ce3c..30264c5 100644 --- a/C4/Breeding.pm +++ b/C4/Breeding.pm @@ -549,6 +549,7 @@ sub Z3950SearchAuth { my $query; my $nterms=0; + my $xslh = Koha::XSLT::Base->new; my $marcflavour = C4::Context->preference('marcflavour'); my $marc_type = $marcflavour eq 'UNIMARC' ? 'UNIMARCAUTH' : $marcflavour; my $authid= $pars->{authid}; @@ -615,6 +616,8 @@ sub Z3950SearchAuth { } else { ( $marcrecord, $charset_result, $charset_errors ) = MarcToUTF8Record( $marcdata, $marc_type, $encoding[$k] ); } + my $error; + ( $marcrecord, $error ) = _do_xslt_proc($marcrecord, $servers[$k], $xslh); my $heading; my $heading_authtype_code; $heading_authtype_code = GuessAuthTypeCode($marcrecord); -- 2.7.4