Bugzilla – Attachment 194730 Details for
Bug 38425
Add links to full texts based on identifiers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38425: Add external links based on PIDs
Bug-38425-Add-external-links-based-on-PIDs.patch (text/plain), 37.32 KB, created by
Alexander Wagner
on 2026-03-06 13:46:12 UTC
(
hide
)
Description:
Bug 38425: Add external links based on PIDs
Filename:
MIME Type:
Creator:
Alexander Wagner
Created:
2026-03-06 13:46:12 UTC
Size:
37.32 KB
patch
obsolete
>From 034ab4732172e3db61174bf441e17d00eb6e85f9 Mon Sep 17 00:00:00 2001 >From: Alexander Wagner <alexander.wagner@desy.de> >Date: Fri, 6 Mar 2026 12:18:26 +0000 >Subject: [PATCH] Bug 38425: Add external links based on PIDs > >Render some (common) persistent identifiers from field 024 (Marc21) or >field 017 (UNIMARC) as links to external resources. To this end evaluate >`$2` and the appropriate resolver URL. Currently implemented values for >`$2`: arXiv, doi, inspire, openlibrary, pmc, pmid, handle. > >Test plan: > >1. Open intranet interface and edit any record >2. Add PIDs to your records. For Marc21 use `024 7_` > for UNIMARC use `017 7_` with the following subfield layout: > - $2 doi $a 10.1103/grxd-71sk > - $2 doi $a 10.3204/PUBDB-2025-05454 > - $2 pmid $a 29942120 > - $2 pmc $a PMC6005330 > - $2 arxiv $a arxiv:2411.05889 > - $2 inspire $a 2835154 > - $2 openlibrary $a OL27448W > - $2 hdl $a 2128/34598 > (May be all or any combination. The values of $a would not matter, > the above just gives valid links to the external system in question.) >3. Check intranet detail display of the record: nothing appears >4. Check OPAC detail display of the record: nothing appears >5. Apply the patch >6. Check intranet detail display of the record. Depending on the PIDs in > the record lines for each type get added, if a PID does not exist no > line is added, values in 024/017 that are not handled are ignored and > do not trigger any output. Each line gives the type of the PID in > front and separated list of all ids of this type expressed as > clickable links in line with the usual display of Koha. E.g. > ``` > DOI: 10.1103/grxd-71sk | 10.3204/PUBDB-2025-05454 > PMID: 29942120 > ``` >7. Check OPAC detail display of the record. It will show a similar list > of ids clickable and resolving to the appropriate exteral system. > >Technical notes: >- The whole section of links crated is encapsulated in > `<span class="results_summary resource_list_doi">` >- Each line of a given PID group (e.g. doi) is encapsulated in > `<span class="results_summary resource_list_doi">` > where the last term gives the type of the id in question >- The individual elements of the generated `<ul>` are expressed as > `<li class="resource_doi">` > >to allow for styling (incl. supression) via CSS. > >Sponsored-by: Deutsches Elektronen-Synchrotron DESY, Library >Signed-off-by: Alexander Wagner <alexander.wagner@desy.de> >--- > .../prog/css/src/staff-global.scss | 21 --- > .../en/xslt/MARC21slim2intranetDetail.xsl | 156 +++++++++-------- > .../en/xslt/UNIMARCslim2intranetDetail.xsl | 160 ++++++++--------- > .../en/xslt/MARC21slim2OPACDetail.xsl | 155 +++++++++-------- > .../en/xslt/UNIMARCslim2OPACDetail.xsl | 163 +++++++++--------- > 5 files changed, 324 insertions(+), 331 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >index aa8bcd31bb..032f4a8ad7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >+++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >@@ -5159,24 +5159,3 @@ div .suggestion_note { > text-align: left; > } > */ >-// Repeatable fields display (Bug 30148) >-.resource_list { >- display: inline-block; >- margin: 0; >- padding-left: 0; >- >- li { >- display: inline-block; >- white-space: nowrap; >- >- &::after { >- content: " | "; >- } >- >- &:last-child { >- &::after { >- content: ""; >- } >- } >- } >-} >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >index da08dd115d..1e5dcca652 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >@@ -15,6 +15,7 @@ > <xsl:apply-templates/> > </xsl:template> > >+ > <xsl:template match="marc:record"> > > <!-- Option: Display Alternate Graphic Representation (MARC 880) --> >@@ -961,83 +962,58 @@ > </xsl:if> > > <!-- Add links based on persistent identifiers Bug 38425 --> >- <xsl:if test="marc:datafield[@tag=024]"> >+ <xsl:if test="marc:datafield[@tag=024]/marc:subfield[@code='2'][ >+ . = 'doi' or >+ . = 'pmid' or >+ . = 'pmc' or >+ . = 'arxiv' or >+ . = 'inspire' or >+ . = 'openlibrary' or >+ . = 'hdl' >+ ]"> > <span class="results_summary pid_links"> >- <span class="label">External resource(s): </span> >- <ul class="resource_list"> >- <xsl:for-each select="marc:datafield[@tag=024]/marc:subfield[@code='2']"> >- <xsl:choose> >- <xsl:when test=". = 'doi'"> >- <li> >- <span class="label">doi:</span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://doi.org/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'pmid'"> >- <li> >- <span class="label">PMID: </span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://pubmed.ncbi.nlm.nih.gov/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'pmc'"> >- <li> >- <span class="label">PMCID: </span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://pmc.ncbi.nlm.nih.gov/articles/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'arxiv'"> >- <li> >- <!-- arXiv-ids are `arxiv:1234.5678` is redundant >- <span class="label">arXiv:</span> >- --> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://arxiv.org/abs/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'inspire'"> >- <li> >- <span class="label">inspire: </span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://inspirehep.net/literature/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'openlibrary'"> >- <li> >- <span class="label">OpenLibrary: </span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://openlibrary.org/works/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- </xsl:choose> >- </xsl:for-each> >- </ul> >+ <!-- Process each pid type --> >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'doi'"/> >+ <xsl:with-param name="label" select="'DOI: '"/> >+ <xsl:with-param name="url-prefix" select="'https://doi.org/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'pmid'"/> >+ <xsl:with-param name="label" select="'PMID: '"/> >+ <xsl:with-param name="url-prefix" select="'https://pubmed.ncbi.nlm.nih.gov/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'pmc'"/> >+ <xsl:with-param name="label" select="'PMC: '"/> >+ <xsl:with-param name="url-prefix" select="'https://pmc.ncbi.nlm.nih.gov/articles/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'arxiv'"/> >+ <xsl:with-param name="label" select="'arXiv: '"/> >+ <xsl:with-param name="url-prefix" select="'https://arxiv.org/abs/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'inspire'"/> >+ <xsl:with-param name="label" select="'iNSPIRE: '"/> >+ <xsl:with-param name="url-prefix" select="'https://inspirehep.net/literature/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'openlibrary'"/> >+ <xsl:with-param name="label" select="'Open Library: '"/> >+ <xsl:with-param name="url-prefix" select="'https://openlibrary.org/works/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'hdl'"/> >+ <xsl:with-param name="label" select="'Handle: '"/> >+ <xsl:with-param name="url-prefix" select="'https://hdl.handle.net/'"/> >+ </xsl:call-template> > </span> > </xsl:if> > >@@ -2024,6 +2000,34 @@ > </a> > </xsl:template> > >+ <!-- Template for PID links, cf Bug 38425 --> >+ <xsl:template name="show-pid-link"> >+ <xsl:param name="type"/> >+ <xsl:param name="label"/> >+ <xsl:param name="url-prefix"/> >+ >+ <xsl:variable name="values" select="marc:datafield[@tag=024]/marc:subfield[@code='2'][. = $type]/../marc:subfield[@code='a']"/> >+ >+ <xsl:if test="$values"> >+ <span class="results_summary resource_list_{$type}"> >+ <xsl:if test="$label"> >+ <span class="label"> >+ <xsl:value-of select="$label"/> >+ </span> >+ </xsl:if> >+ <ul class="resource_list"> >+ <xsl:for-each select="$values"> >+ <li class="resource_{$type}"> >+ <a class="resource_link" href="{$url-prefix}{str:encode-uri(current(), true())}"> >+ <xsl:value-of select="current()"/> >+ </a> >+ </li> >+ </xsl:for-each> >+ </ul> >+ </span> >+ </xsl:if> >+ </xsl:template> >+ > <!-- #1807 Strip unwanted parenthesis from subjects for searching --> > <xsl:template name="subfieldSelectSubject"> > <xsl:param name="codes"/> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl >index 0ca1f18524..7d09a8bf23 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl >@@ -25,85 +25,60 @@ > <xsl:variable name="AuthorLinkSortOrder" select="marc:sysprefs/marc:syspref[@name='AuthorLinkSortOrder']"/> > > <!-- Add links based on persistent identifiers Bug 38425 --> >- <xsl:if test="marc:datafield[@tag=017]"> >- <span class="results_summary pid_links"> >- <span class="label">External resource(s): </span> >- <ul class="resource_list"> >- <xsl:for-each select="marc:datafield[@tag=017]/marc:subfield[@code='2']"> >- <xsl:choose> >- <xsl:when test=". = 'doi'"> >- <li> >- <span class="label">doi:</span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://doi.org/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'pmid'"> >- <li> >- <span class="label">PMID: </span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://pubmed.ncbi.nlm.nih.gov/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'pmc'"> >- <li> >- <span class="label">PMCID: </span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://pmc.ncbi.nlm.nih.gov/articles/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'arxiv'"> >- <li> >- <!-- arXiv-ids are `arxiv:1234.5678` is redundant >- <span class="label">arXiv:</span> >- --> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://arxiv.org/abs/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'inspire'"> >- <li> >- <span class="label">inspire: </span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://inspirehep.net/literature/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'openlibrary'"> >- <li> >- <span class="label">OpenLibrary: </span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://openlibrary.org/works/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- </xsl:choose> >- </xsl:for-each> >- </ul> >- </span> >- </xsl:if> >+ <xsl:if test="marc:datafield[@tag=017]/marc:subfield[@code='2'][ >+ . = 'doi' or >+ . = 'pmid' or >+ . = 'pmc' or >+ . = 'arxiv' or >+ . = 'inspire' or >+ . = 'openlibrary' or >+ . = 'hdl' >+ ]"> >+ <span class="results_summary pid_links"> >+ <!-- Process each pid type --> >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'doi'"/> >+ <xsl:with-param name="label" select="'DOI: '"/> >+ <xsl:with-param name="url-prefix" select="'https://doi.org/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'pmid'"/> >+ <xsl:with-param name="label" select="'PMID: '"/> >+ <xsl:with-param name="url-prefix" select="'https://pubmed.ncbi.nlm.nih.gov/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'pmc'"/> >+ <xsl:with-param name="label" select="'PMC: '"/> >+ <xsl:with-param name="url-prefix" select="'https://pmc.ncbi.nlm.nih.gov/articles/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'arxiv'"/> >+ <xsl:with-param name="label" select="'arXiv: '"/> >+ <xsl:with-param name="url-prefix" select="'https://arxiv.org/abs/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'inspire'"/> >+ <xsl:with-param name="label" select="'iNSPIRE: '"/> >+ <xsl:with-param name="url-prefix" select="'https://inspirehep.net/literature/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'openlibrary'"/> >+ <xsl:with-param name="label" select="'Open Library: '"/> >+ <xsl:with-param name="url-prefix" select="'https://openlibrary.org/works/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'hdl'"/> >+ <xsl:with-param name="label" select="'Handle: '"/> >+ <xsl:with-param name="url-prefix" select="'https://hdl.handle.net/'"/> >+ </xsl:call-template> >+ </span> >+ </xsl:if> > > <xsl:if test="marc:datafield[@tag=200]"> > <xsl:for-each select="marc:datafield[@tag=200]"> >@@ -589,4 +564,31 @@ > <xsl:value-of select="substring($str,1,string-length($str)-1)"/> > </xsl:template> > >+ <!-- Template for PID links, cf Bug 38425 --> >+ <xsl:template name="show-pid-link"> >+ <xsl:param name="type"/> >+ <xsl:param name="label"/> >+ <xsl:param name="url-prefix"/> >+ >+ <xsl:variable name="values" select="marc:datafield[@tag=174]/marc:subfield[@code='2'][. = $type]/../marc:subfield[@code='a']"/> >+ >+ <xsl:if test="$values"> >+ <span class="results_summary resource_list_{$type}"> >+ <xsl:if test="$label"> >+ <span class="label"> >+ <xsl:value-of select="$label"/> >+ </span> >+ </xsl:if> >+ <ul class="resource_list"> >+ <xsl:for-each select="$values"> >+ <li class="resource_{$type}"> >+ <a class="resource_link" href="{$url-prefix}{str:encode-uri(current(), true())}"> >+ <xsl:value-of select="current()"/> >+ </a> >+ </li> >+ </xsl:for-each> >+ </ul> >+ </span> >+ </xsl:if> >+ </xsl:template> > </xsl:stylesheet> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >index b20333a818..6b1b920ae4 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >@@ -1064,83 +1064,58 @@ > > > <!-- Add links based on persistent identifiers Bug 38425 --> >- <xsl:if test="marc:datafield[@tag=024]"> >+ <xsl:if test="marc:datafield[@tag=024]/marc:subfield[@code='2'][ >+ . = 'doi' or >+ . = 'pmid' or >+ . = 'pmc' or >+ . = 'arxiv' or >+ . = 'inspire' or >+ . = 'openlibrary' or >+ . = 'hdl' >+ ]"> > <span class="results_summary pid_links"> >- <span class="label">External resource(s): </span> >- <ul class="resource_list"> >- <xsl:for-each select="marc:datafield[@tag=024]/marc:subfield[@code='2']"> >- <xsl:choose> >- <xsl:when test=". = 'doi'"> >- <li> >- <span class="label">doi:</span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://doi.org/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'pmid'"> >- <li> >- <span class="label">PMID: </span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://pubmed.ncbi.nlm.nih.gov/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'pmc'"> >- <li> >- <span class="label">PMCID: </span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://pmc.ncbi.nlm.nih.gov/articles/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'arxiv'"> >- <li> >- <!-- arXiv-ids are `arxiv:1234.5678` is redundant >- <span class="label">arXiv:</span> >- --> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://arxiv.org/abs/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'inspire'"> >- <li> >- <span class="label">inspire: </span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://inspirehep.net/literature/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'openlibrary'"> >- <li> >- <span class="label">OpenLibrary: </span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://openlibrary.org/works/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- </xsl:choose> >- </xsl:for-each> >- </ul> >+ <!-- Process each pid type --> >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'doi'"/> >+ <xsl:with-param name="label" select="'DOI: '"/> >+ <xsl:with-param name="url-prefix" select="'https://doi.org/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'pmid'"/> >+ <xsl:with-param name="label" select="'PMID: '"/> >+ <xsl:with-param name="url-prefix" select="'https://pubmed.ncbi.nlm.nih.gov/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'pmc'"/> >+ <xsl:with-param name="label" select="'PMC: '"/> >+ <xsl:with-param name="url-prefix" select="'https://pmc.ncbi.nlm.nih.gov/articles/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'arxiv'"/> >+ <xsl:with-param name="label" select="'arXiv: '"/> >+ <xsl:with-param name="url-prefix" select="'https://arxiv.org/abs/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'inspire'"/> >+ <xsl:with-param name="label" select="'iNSPIRE: '"/> >+ <xsl:with-param name="url-prefix" select="'https://inspirehep.net/literature/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'openlibrary'"/> >+ <xsl:with-param name="label" select="'Open Library: '"/> >+ <xsl:with-param name="url-prefix" select="'https://openlibrary.org/works/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'hdl'"/> >+ <xsl:with-param name="label" select="'Handle: '"/> >+ <xsl:with-param name="url-prefix" select="'https://hdl.handle.net/'"/> >+ </xsl:call-template> > </span> > </xsl:if> > >@@ -2289,4 +2264,32 @@ > </xsl:otherwise> > </xsl:choose> > </xsl:template> >+ >+ <!-- Template for PID links, cf Bug 38425 --> >+ <xsl:template name="show-pid-link"> >+ <xsl:param name="type"/> >+ <xsl:param name="label"/> >+ <xsl:param name="url-prefix"/> >+ >+ <xsl:variable name="values" select="marc:datafield[@tag=024]/marc:subfield[@code='2'][. = $type]/../marc:subfield[@code='a']"/> >+ >+ <xsl:if test="$values"> >+ <span class="results_summary resource_list_{$type}"> >+ <xsl:if test="$label"> >+ <span class="label"> >+ <xsl:value-of select="$label"/> >+ </span> >+ </xsl:if> >+ <ul class="resource_list"> >+ <xsl:for-each select="$values"> >+ <li class="resource_{$type}"> >+ <a class="resource_link" href="{$url-prefix}{str:encode-uri(current(), true())}"> >+ <xsl:value-of select="current()"/> >+ </a> >+ </li> >+ </xsl:for-each> >+ </ul> >+ </span> >+ </xsl:if> >+ </xsl:template> > </xsl:stylesheet> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl >index 55abf2adc6..34ad6f6dd8 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl >@@ -27,85 +27,61 @@ > <xsl:variable name="AuthorLinkSortOrder" select="marc:sysprefs/marc:syspref[@name='AuthorLinkSortOrder']"/> > > <!-- Add links based on persistent identifiers Bug 38425 --> >- <xsl:if test="marc:datafield[@tag=017]"> >- <span class="results_summary pid_links"> >- <span class="label">External resource(s): </span> >- <ul class="resource_list"> >- <xsl:for-each select="marc:datafield[@tag=017]/marc:subfield[@code='2']"> >- <xsl:choose> >- <xsl:when test=". = 'doi'"> >- <li> >- <span class="label">doi:</span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://doi.org/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'pmid'"> >- <li> >- <span class="label">PMID: </span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://pubmed.ncbi.nlm.nih.gov/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'pmc'"> >- <li> >- <span class="label">PMCID: </span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://pmc.ncbi.nlm.nih.gov/articles/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'arxiv'"> >- <li> >- <!-- arXiv-ids are `arxiv:1234.5678` is redundant >- <span class="label">arXiv:</span> >- --> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://arxiv.org/abs/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'inspire'"> >- <li> >- <span class="label">inspire: </span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://inspirehep.net/literature/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- <xsl:when test=". = 'openlibrary'"> >- <li> >- <span class="label">OpenLibrary: </span> >- <xsl:for-each select="../marc:subfield[@code='a']"> >- <a> >- <xsl:attribute name="href">https://openlibrary.org/works/<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute> >- <xsl:value-of select="current()" /> >- </a> >- </xsl:for-each> >- </li> >- </xsl:when> >- </xsl:choose> >- </xsl:for-each> >- </ul> >- </span> >- </xsl:if> >+ <xsl:if test="marc:datafield[@tag=017]/marc:subfield[@code='2'][ >+ . = 'doi' or >+ . = 'pmid' or >+ . = 'pmc' or >+ . = 'arxiv' or >+ . = 'inspire' or >+ . = 'openlibrary' or >+ . = 'hdl' >+ ]"> >+ <span class="results_summary pid_links"> >+ <!-- Process each pid type --> >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'doi'"/> >+ <xsl:with-param name="label" select="'DOI: '"/> >+ <xsl:with-param name="url-prefix" select="'https://doi.org/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'pmid'"/> >+ <xsl:with-param name="label" select="'PMID: '"/> >+ <xsl:with-param name="url-prefix" select="'https://pubmed.ncbi.nlm.nih.gov/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'pmc'"/> >+ <xsl:with-param name="label" select="'PMC: '"/> >+ <xsl:with-param name="url-prefix" select="'https://pmc.ncbi.nlm.nih.gov/articles/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'arxiv'"/> >+ <xsl:with-param name="label" select="'arXiv: '"/> >+ <xsl:with-param name="url-prefix" select="'https://arxiv.org/abs/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'inspire'"/> >+ <xsl:with-param name="label" select="'iNSPIRE: '"/> >+ <xsl:with-param name="url-prefix" select="'https://inspirehep.net/literature/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'openlibrary'"/> >+ <xsl:with-param name="label" select="'Open Library: '"/> >+ <xsl:with-param name="url-prefix" select="'https://openlibrary.org/works/'"/> >+ </xsl:call-template> >+ >+ <xsl:call-template name="show-pid-link"> >+ <xsl:with-param name="type" select="'hdl'"/> >+ <xsl:with-param name="label" select="'Handle: '"/> >+ <xsl:with-param name="url-prefix" select="'https://hdl.handle.net/'"/> >+ </xsl:call-template> >+ </span> >+ </xsl:if> >+ > > <xsl:if test="marc:datafield[@tag=200]"> > <xsl:for-each select="marc:datafield[@tag=200]"> >@@ -737,4 +713,33 @@ > <xsl:value-of select="substring($str,1,string-length($str)-1)"/> > </xsl:template> > >+ <!-- Template for PID links, cf Bug 38425 --> >+ <xsl:template name="show-pid-link"> >+ <xsl:param name="type"/> >+ <xsl:param name="label"/> >+ <xsl:param name="url-prefix"/> >+ >+ <xsl:variable name="values" select="marc:datafield[@tag=017]/marc:subfield[@code='2'][. = $type]/../marc:subfield[@code='a']"/> >+ >+ <xsl:if test="$values"> >+ <span class="results_summary resource_list_{$type}"> >+ <xsl:if test="$label"> >+ <span class="label"> >+ <xsl:value-of select="$label"/> >+ </span> >+ </xsl:if> >+ <ul class="resource_list"> >+ <xsl:for-each select="$values"> >+ <li class="resource_{$type}"> >+ <a class="resource_link" href="{$url-prefix}{str:encode-uri(current(), true())}"> >+ <xsl:value-of select="current()"/> >+ </a> >+ </li> >+ </xsl:for-each> >+ </ul> >+ </span> >+ </xsl:if> >+ </xsl:template> >+ >+ > </xsl:stylesheet> >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38425
:
174425
|
181900
|
181974
|
181975
|
186234
| 194730