Bug 11083 - Authority search result display in staff interface should be XSLT driven
Summary: Authority search result display in staff interface should be XSLT driven
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Authority data support (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement with 10 votes (vote)
Assignee: Julian Maurice
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 21330
  Show dependency treegraph
 
Reported: 2013-10-20 16:16 UTC by Martin Renvoize
Modified: 2022-07-25 22:03 UTC (History)
11 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact: Caroline Cyr La Rose
Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/575
Text to go in the release notes:
This enhancement enables customising the authority search results summary in the staff interface using XSLT (for MARC21 and UNIMARC). Key features; - Use the new system preference AuthorityXSLTResultsDisplay to set the location of the XSLT file, either the full path to a file on the Koha server or a URL. - The system preference value can contain {langcode} and {authtypecode} which will be replaced by the appropriate value. - If errors occur, the custom XSLT file is ignored and the default summary is displayed.
Version(s) released in:
22.05.00


Attachments
Bug 11083: Add ability to generate authority summary using XSLT (7.62 KB, patch)
2021-06-02 12:59 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 11083: Add sample XSLT for UNIMARC authorities (25.16 KB, patch)
2021-12-24 08:39 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 11083: Add ability to generate authority summary using XSLT (7.78 KB, patch)
2022-02-01 17:00 UTC, David Nind
Details | Diff | Splinter Review
Bug 11083: Add sample XSLT for UNIMARC authorities (25.20 KB, patch)
2022-02-01 17:00 UTC, David Nind
Details | Diff | Splinter Review
Bug 11083: Add ability to generate authority summary using XSLT (7.84 KB, patch)
2022-03-27 00:39 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 11083: Add sample XSLT for UNIMARC authorities (25.26 KB, patch)
2022-03-27 00:39 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize 2013-10-20 16:16:58 UTC
When searching for authorities in the Staff Client, the results page is all pure template driven. This should be xslt driven like the biblio results pages such that authorities can be displayed correctly.
Comment 1 Vitor Fernandes 2019-05-31 11:30:05 UTC
This would be a great feature for Koha next version.
In my opinion authorities search results and authorities details should also be XSLT driven.

With this feature, we can have full control of the visualization of the following entities:

- OPAC - biblio records search results and details
- Staff client - biblio records client search results and details

- OPAC - authorities results and details
- Staff client - authorities search results and details

I also think that ISBD views sould be XSLT driven (bug 20406).
Comment 2 Julian Maurice 2021-06-02 12:59:27 UTC
Created attachment 121537 [details] [review]
Bug 11083: Add ability to generate authority summary using XSLT

This patch only affects authority search results in the staff interface.
It adds a new system preference AuthorityXSLTResultsDisplay. If set,
each authority search result MARCXML will be transformed using the XSLT
at the given filename or URL. The output will be displayed in place of
the default summary.
If errors occur, the XSLT is ignored and the default summary is
displayed.

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. Verify that authority search results are not affected yet.
3. Create an XSLT file (for instance in
/home/koha/xslt/en/GEOGR_NAME.xsl)
4. Set AuthorityXSLTResultsDisplay syspref value to
/home/koha/xslt/{langcode}/{authtypecode}.xsl
5. Do an authority search that returns GEOGR_NAME results. Verify that
the summary matches what you expect from your XSLT
6. Do an authority search that returns authorities of other types.
Verify that the default summary is displayed.

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 3 David Cook 2021-06-03 02:12:34 UTC
I wonder sometimes if we should be getting away from using the XSLTs as they seem slow.
Comment 4 Katrin Fischer 2021-06-03 16:40:12 UTC
I really like the idea of this as currently there is no way to customize the result lists.
Comment 5 Katrin Fischer 2021-06-03 16:40:57 UTC
Julian - will you provide a sample file for UNIMARC?
Comment 6 Julian Maurice 2021-12-24 08:39:46 UTC
Created attachment 128913 [details] [review]
Bug 11083: Add sample XSLT for UNIMARC authorities
Comment 7 Julian Maurice 2021-12-24 08:41:14 UTC
(In reply to Katrin Fischer from comment #5)
> Julian - will you provide a sample file for UNIMARC?

It took 6 months, but here it is ;)
Comment 8 David Nind 2022-02-01 17:00:47 UTC
Created attachment 130051 [details] [review]
Bug 11083: Add ability to generate authority summary using XSLT

This patch only affects authority search results in the staff interface.
It adds a new system preference AuthorityXSLTResultsDisplay. If set,
each authority search result MARCXML will be transformed using the XSLT
at the given filename or URL. The output will be displayed in place of
the default summary.
If errors occur, the XSLT is ignored and the default summary is
displayed.

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. Verify that authority search results are not affected yet.
3. Create an XSLT file (for instance in
/home/koha/xslt/en/GEOGR_NAME.xsl)
4. Set AuthorityXSLTResultsDisplay syspref value to
/home/koha/xslt/{langcode}/{authtypecode}.xsl
5. Do an authority search that returns GEOGR_NAME results. Verify that
the summary matches what you expect from your XSLT
6. Do an authority search that returns authorities of other types.
Verify that the default summary is displayed.

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>

Signed-off-by: David Nind <david@davidnind.com>
Comment 9 David Nind 2022-02-01 17:00:52 UTC
Created attachment 130052 [details] [review]
Bug 11083: Add sample XSLT for UNIMARC authorities

Signed-off-by: David Nind <david@davidnind.com>
Comment 10 David Nind 2022-02-01 17:06:05 UTC
Testing notes (koha-testing-docker):

- Tested using provided example XSLT files for MARC21 and UNIMARC.

- Visual differences in the authority search results that I noticed:
  . MARC21: removes the summary text
  . UNIMARC: adds bullet points in front of the summary text
Comment 11 Katrin Fischer 2022-03-27 00:39:20 UTC
Nice release notes :)

I notice that unlike other prefs the new pref has no "default" option that prefills the input field although there is a UNIMARC file submitted with this patch. Should we add one with a note that this is currently for UNIMARC only?

But not a blocker for me. I think this works nicely and gives a good base for more improvements later.

Do you plan to also make this available for the OPAC?
Comment 12 Katrin Fischer 2022-03-27 00:39:53 UTC
Created attachment 132269 [details] [review]
Bug 11083: Add ability to generate authority summary using XSLT

This patch only affects authority search results in the staff interface.
It adds a new system preference AuthorityXSLTResultsDisplay. If set,
each authority search result MARCXML will be transformed using the XSLT
at the given filename or URL. The output will be displayed in place of
the default summary.
If errors occur, the XSLT is ignored and the default summary is
displayed.

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. Verify that authority search results are not affected yet.
3. Create an XSLT file (for instance in
/home/koha/xslt/en/GEOGR_NAME.xsl)
4. Set AuthorityXSLTResultsDisplay syspref value to
/home/koha/xslt/{langcode}/{authtypecode}.xsl
5. Do an authority search that returns GEOGR_NAME results. Verify that
the summary matches what you expect from your XSLT
6. Do an authority search that returns authorities of other types.
Verify that the default summary is displayed.

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>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 13 Katrin Fischer 2022-03-27 00:39:58 UTC
Created attachment 132270 [details] [review]
Bug 11083: Add sample XSLT for UNIMARC authorities

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 14 Fridolin Somers 2022-04-08 13:51:58 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄