diff --git a/authorities/authorities-home.pl b/authorities/authorities-home.pl
index d46f68d79a..2be064c1c2 100755
--- a/authorities/authorities-home.pl
+++ b/authorities/authorities-home.pl
@@ -28,11 +28,13 @@ use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_and_exit pagination_bar output_html_with_http_headers );
use C4::AuthoritiesMarc qw( DelAuthority );
use C4::Search::History;
+use C4::Languages;
use Koha::Authority::Types;
use Koha::SearchEngine::Search;
use Koha::SearchEngine::QueryBuilder;
use Koha::Token;
+use Koha::XSLT::Base;
use Koha::Z3950Servers;
my $query = CGI->new;
@@ -173,6 +175,29 @@ if ( $op eq "do_search" ) {
$to = $startfrom * $resultsperpage;
}
+ my $AuthorityXSLTResultsDisplay = C4::Context->preference('AuthorityXSLTResultsDisplay');
+ if ($results && $AuthorityXSLTResultsDisplay) {
+ my $lang = C4::Languages::getlanguage();
+ foreach my $result (@$results) {
+ my $authority = Koha::Authorities->find($result->{authid});
+ next unless $authority;
+
+ my $authtypecode = $authority->authtypecode;
+ my $xsl = $AuthorityXSLTResultsDisplay;
+ $xsl =~ s/\{langcode\}/$lang/g;
+ $xsl =~ s/\{authtypecode\}/$authtypecode/g;
+
+ my $xslt_engine = Koha::XSLT::Base->new;
+ my $output = $xslt_engine->transform({ xml => $authority->marcxml, file => $xsl });
+ if ($xslt_engine->err) {
+ warn "XSL transformation failed ($xsl): " . $xslt_engine->err;
+ next;
+ }
+
+ $result->{html} = $output;
+ }
+ }
+
$template->param( result => $results ) if $results;
my $max_result_window = $searcher->max_result_window;
diff --git a/installer/data/mysql/atomicupdate/add-syspref-AuthorityXSLTResultsDisplay.perl b/installer/data/mysql/atomicupdate/add-syspref-AuthorityXSLTResultsDisplay.perl
new file mode 100644
index 0000000000..728aee12af
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/add-syspref-AuthorityXSLTResultsDisplay.perl
@@ -0,0 +1,9 @@
+$DBversion = 'XXX';
+if (CheckVersion($DBversion)) {
+ $dbh->do(q{
+ INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES
+ ('AuthorityXSLTResultsDisplay','','','Enable XSL stylesheet control over authority results page display on intranet','Free')
+ });
+
+ NewVersion($DBversion, '11083', 'Add syspref AuthorityXSLTResultsDisplay');
+}
diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql
index 9a4cdbf72f..d6c978edc1 100644
--- a/installer/data/mysql/mandatory/sysprefs.sql
+++ b/installer/data/mysql/mandatory/sysprefs.sql
@@ -69,6 +69,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('AuthorityMergeLimit','50',NULL,'Maximum number of biblio records updated immediately when an authority record has been modified.','integer'),
('AuthorityMergeMode','loose','loose|strict','Authority merge mode','Choice'),
('AuthoritySeparator','--','10','Used to separate a list of authorities in a display. Usually --','free'),
+('AuthorityXSLTResultsDisplay','','','Enable XSL stylesheet control over authority results page display on intranet','Free'),
('AuthSuccessLog','0',NULL,'If enabled, log successful authentications','YesNo'),
('autoBarcode','OFF','incremental|annual|hbyymmincr|EAN13|OFF','Used to autogenerate a barcode: incremental will be of the form 1, 2, 3; annual of the form 2007-0001, 2007-0002; hbyymmincr of the form HB08010001 where HB=Home Branch','Choice'),
('AutoCreateAuthorities','0',NULL,'Automatically create authorities that do not exist when cataloging records.','YesNo'),
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref
index 10c41c581d..d840cfaa16 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref
@@ -1,5 +1,10 @@
Staff interface:
Appearance:
+ -
+ - 'Display authority results in the staff interface using XSLT stylesheet at: '
+ - pref: AuthorityXSLTResultsDisplay
+ class: file
+ - '
Options: