From 1cc3f298222dbef0db5c32950c39063440f4e98a Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 9 May 2025 21:25:34 +0000 Subject: [PATCH] Bug 39860: Do not XSLT transform the custom content --- C4/XSLT.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 7d7cbfb8794..a961583c15b 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -240,7 +240,7 @@ sub XSLTParse4Display { $variables->{OpenURLResolverURL} = $biblio->get_openurl; } } - my $extracontentxml = ''; + my $extracontent = ''; # Check if we should add extra content based on system preference if ( C4::Context->preference('ExtraContentForXSLTDisplay') ) { @@ -248,8 +248,7 @@ sub XSLTParse4Display { my $scrubber = C4::Scrubber->new('staff'); my $extracontentvalue = C4::Context->preference('ExtraContentForXSLTDisplay'); my $extracontentproccessed = process_tt( $extracontentvalue, { record => $record } ); - my $cleanxml = $scrubber->scrub($extracontentproccessed); - $extracontentxml = qq{$cleanxml}; + $extracontent = $scrubber->scrub($extracontentproccessed); } # embed variables @@ -261,7 +260,7 @@ sub XSLTParse4Display { $varxml .= "\n"; my $sysxml = get_xslt_sysprefs(); - $xmlrecord =~ s/\<\/record\>/$itemsxml$extracontentxml$sysxml$varxml\<\/record\>/; + $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml\<\/record\>/; if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs $xmlrecord =~ s/\&amp;/\&/g; $xmlrecord =~ s/\&\;lt\;/\<\;/g; @@ -273,7 +272,10 @@ sub XSLTParse4Display { #If the xslt should fail, we will return undef (old behavior was #raw MARC) #Note that we did set do_not_return_source at object construction - return $engine->transform( $xmlrecord, $xslfilename ); #file or URL + my $transformed_xml = $engine->transform( $xmlrecord, $xslfilename ); + + my $concatenated_content = $transformed_xml . $extracontent; + return $concatenated_content; } =head2 buildKohaItemsNamespace -- 2.39.5