Bug 35305

Summary: Add XSLT for authority details page in staff interface
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: MARC Authority data supportAssignee: Fridolin Somers <fridolin.somers>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: david, dcook, matthias.le-gac
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21330
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11083
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 35305: Add XSLT for authority details page in staff interface
Bug 35305: Add sample XSLT for UNIMARC authorities
Bug 35305: (follow-up) Fix identing

Description Fridolin Somers 2023-11-09 20:04:08 UTC
Like Bug 11083 for result display, allow XSLT for details display in staff interface
Comment 1 Fridolin Somers 2023-11-09 21:29:49 UTC
Created attachment 158772 [details] [review]
Bug 35305: Add XSLT for authority details page in staff interface

This adds a new system preference 'AuthorityXSLTDetailsDisplay'.
If set, authority MARCXML will be transformed using the XSLT
at the given filename or URL.
The HTML output will be displayed in place of tabs in details page.

The syspref value can contain {langcode} and {authtypecode} which will
be replaced by the appropriate value (resp. current language and
authority type code).

Test plan:
1) Apply patch and run updatedatabase
2) Search for an authority type GEOGR_NAME and view details page
3) Verify that display is not affected yet
4) Create an XSLT file (for example in /home/koha/xslt/en/GEOGR_NAME.xsl)
5) Set 'AuthorityXSLTDetailsDisplay' syspref value to :
   /home/koha/xslt/{langcode}/{authtypecode}.xsl
6) Refresh details page
7) Verify that display matches what you expect from your XSLT
8) Go to an authority of another type
9) Verify that the default display is used

Example of a minimal XSLT:

<?xml version='1.0' encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
 xmlns:marc="http://www.loc.gov/MARC21/slim"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output omit-xml-declaration="yes"/>
  <xsl:template match="marc:record">
    <xsl:element name="div">
      <xsl:attribute name="class">
        <xsl:text>authority-summary</xsl:text>
      </xsl:attribute>
      <xsl:value-of select="marc:datafield[@tag='151']/marc:subfield[@code='a']"/>
    </xsl:element>
  </xsl:template>
</xsl:stylesheet>
Comment 2 Fridolin Somers 2023-11-09 22:12:20 UTC
Created attachment 158775 [details] [review]
Bug 35305: Add sample XSLT for UNIMARC authorities

Also creates UNIMARCauthUtils.xsl to share templates with UNIMARCauthResults.xsl
Comment 3 Fridolin Somers 2023-11-10 02:06:15 UTC
Created attachment 158781 [details] [review]
Bug 35305: (follow-up) Fix identing
Comment 4 Matthias Le Gac 2024-01-09 15:30:24 UTC
The display match with the XSLT for type GEOGR_NAME but for the other types the default display isn't use, it's the XSLT display who is using.
Comment 5 Fridolin Somers 2024-03-14 09:00:36 UTC
(In reply to Matthias Le Gac from comment #4)
> The display match with the XSLT for type GEOGR_NAME but for the other types
> the default display isn't use, it's the XSLT display who is using.

Hi, could you explain more please ?

Using a XSLT file only for GEOGR_NAME is just an example, you may create a file per authority type or for UNIMARC use the sample file.
Comment 6 Matthias Le Gac 2024-04-11 20:56:55 UTC
(In reply to Fridolin Somers from comment #5)
> (In reply to Matthias Le Gac from comment #4)
> > The display match with the XSLT for type GEOGR_NAME but for the other types
> > the default display isn't use, it's the XSLT display who is using.
> 
> Hi, could you explain more please ?
> 
> Using a XSLT file only for GEOGR_NAME is just an example, you may create a
> file per authority type or for UNIMARC use the sample file.

What I meant was that when I go to the details of a GEOGR_NAME authority it looks just like what I specified in the XSL but it also has an impact on the details page of a PERSO_NAME authority and if I've understood the test plan correctly it shouldn't.