Description
Fridolin Somers
2023-11-09 20:04:08 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> Created attachment 158775 [details] [review] Bug 35305: Add sample XSLT for UNIMARC authorities Also creates UNIMARCauthUtils.xsl to share templates with UNIMARCauthResults.xsl Created attachment 158781 [details] [review] Bug 35305: (follow-up) Fix identing 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. (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. (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. (In reply to Matthias Le Gac from comment #6) > (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. Aaah OK, the test plan is wrong ;) Created attachment 167302 [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' system preference to : /home/koha/xslt/{langcode}/{authtypecode}.xsl 6) Refresh details page 7) Verify that display matches what you expect from the XSLT 8) Set 'AuthorityXSLTDetailsDisplay' system preference to : <path to sources>/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCauthDetails.xsl 8) Refresh details page 9) Verify that display matches what you expect from your XSLT 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> Created attachment 167303 [details] [review] Bug 35305: Add sample XSLT for UNIMARC authorities details page Also creates UNIMARCauthUtils.xsl to share templates with UNIMARCauthResults.xsl Created attachment 167304 [details] [review] Bug 35305: Add sample XSLT for UNIMARC authorities details page Also creates UNIMARCauthUtils.xsl to share templates with UNIMARCauthResults.xsl Created attachment 167305 [details] [review] Bug 35305: (follow-up) Fix identing Test plan changed to test also with the sample XSLT file Created attachment 167362 [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' system preference to : /home/koha/xslt/{langcode}/{authtypecode}.xsl 6) Refresh details page 7) Verify that display matches what you expect from the XSLT 8) Set 'AuthorityXSLTDetailsDisplay' system preference to : <path to sources>/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCauthDetails.xsl 8) Refresh details page 9) Verify that display matches what you expect from your XSLT 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> Created attachment 167363 [details] [review] Bug 35305: Add sample XSLT for UNIMARC authorities details page Also creates UNIMARCauthUtils.xsl to share templates with UNIMARCauthResults.xsl Signed-off-by: David Nind <david@davidnind.com> Created attachment 167364 [details] [review] Bug 35305: (follow-up) Fix identing Signed-off-by: David Nind <david@davidnind.com> Created attachment 173439 [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' system preference to : /home/koha/xslt/{langcode}/{authtypecode}.xsl 6) Refresh details page 7) Verify that display matches what you expect from the XSLT 8) Set 'AuthorityXSLTDetailsDisplay' system preference to : <path to sources>/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCauthDetails.xsl 8) Refresh details page 9) Verify that display matches what you expect from your XSLT 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: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 173440 [details] [review] Bug 35305: Add sample XSLT for UNIMARC authorities details page Also creates UNIMARCauthUtils.xsl to share templates with UNIMARCauthResults.xsl Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 173441 [details] [review] Bug 35305: (follow-up) Fix identing Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> I really would have liked to have see MARC21 sheets included here too but I'm not going to let that block us. Passing QA Pushed for 24.11! Well done everyone, thank you! Enhancement, no 24.05.x backport. |