Koha:XSLT Edits: Difference between revisions

From TSAS Library
Jump to: navigation, search
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:


==Enable Awards Search==
==Enable Awards Search==
[[File:Awards note OPAC link.png|300px]]
[[File:Awards note OPAC link.png|frame|right|OPAC with Award link]]


Makes Award notes (Marc field 586) a keyword search link in the OPAC. Note that this requires the addition of a nonstandard subfield "b" which holds the year. If that change is not needed/desired, remove lines 8–10 below.
Makes Award notes (Marc field 586) a keyword search link in the OPAC. Note that this requires the addition of a nonstandard subfield "b" which holds the year. If that change is not needed/desired, remove lines 8–10 below.


It is a good idea to make a copy of the XSLT file. Information on that here<ref>[http://blog.l2c2.co.in/index.php/2017/05/04/koha-and-the-magic-of-xslt-displaying-new-marc-fields-on-the-opac/ Koha and the “magic” of XSLT : displaying new MARC fields on the OPAC.]</ref>.
It is a good idea to make a copy of the XSLT file. Information on that here<ref>[http://blog.l2c2.co.in/index.php/2017/05/04/koha-and-the-magic-of-xslt-displaying-new-marc-fields-on-the-opac/ Koha and the “magic” of XSLT : displaying new MARC fields on the OPAC.]</ref>.
<syntaxhighlight lang="xslt" line="line">
 
<syntaxhighlight lang="html">
<xsl:if test="marc:datafield[@tag=586]">
<xsl:if test="marc:datafield[@tag=586]">
           <span class="results_summary awardsnote">
           <span class="results_summary awardsnote">
Line 27: Line 28:
==Resources==
==Resources==
<references />
<references />
[[Category:Koha]]

Latest revision as of 14:25, 25 April 2020

Excellent overview of XSLT in this context from U of Hartford[1]

Enable Awards Search

OPAC with Award link

Makes Award notes (Marc field 586) a keyword search link in the OPAC. Note that this requires the addition of a nonstandard subfield "b" which holds the year. If that change is not needed/desired, remove lines 8–10 below.

It is a good idea to make a copy of the XSLT file. Information on that here[2].

<xsl:if test="marc:datafield[@tag=586]">
           <span class="results_summary awardsnote">
               <xsl:if test="marc:datafield[@tag=586]/@ind1=' '">
                   <span class="label">Awards: </span>
               </xsl:if>
               <xsl:for-each select="marc:datafield[@tag=586]">
                  <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q="<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute><xsl:value-of select="marc:subfield[@code='a']"/></a>
                   <xsl:if test="marc:subfield[@code='b']">
                       <span class="separator"><xsl:text>, </xsl:text></span><xsl:value-of select="marc:subfield[@code='b']"/>
                   </xsl:if>
                   <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
               </xsl:for-each>
           </span>
       </xsl:if>


Resources