@@ -, +, @@ cataloguing plugin attachments, there is an example XSL file) a new one) XSLT output (if using the example file it should be a link saying "Authority #") --- authorities/auth_finder.pl | 26 +++++++++++++++++++ .../authorities/searchresultlist-auth.tt | 8 +++++- 2 files changed, 33 insertions(+), 1 deletion(-) --- a/authorities/auth_finder.pl +++ a/authorities/auth_finder.pl @@ -23,10 +23,13 @@ use CGI qw ( -utf8 ); use C4::Output qw( output_html_with_http_headers ); use C4::Auth qw( get_template_and_user ); use C4::Context; +use C4::Languages; use Koha::SearchEngine::Search; use Koha::SearchEngine::QueryBuilder; use Koha::Authority::Types; +use Koha::Authorities; +use Koha::XSLT::Base; my $query = CGI->new; my $op = $query->param('op') || ''; @@ -132,6 +135,29 @@ if ( $op eq "do_search" ) { $to = ( ( $startfrom + 1 ) * $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; $template->param( orderby => $orderby, --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt @@ -76,7 +76,13 @@ [% FOREACH resul IN result %] - [% PROCESS authresult summary=resul.summary authid=resul.authid auth_preview=1 %] + + [% IF resul.html %] + [% resul.html | $raw %] + [% ELSE %] + [% PROCESS authresult summary=resul.summary authid=resul.authid auth_preview=1 %] + [% END %] + [% resul.summary.label | html %] [% resul.used | html %] times [% IF Koha.Preference('ShowHeadingUse') %] --