Koha 16.05 - XSLT (OpacDetails) - Help with XSLT stanza - Uniform Titles

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Koha 16.05 - XSLT (OpacDetails) - Help with XSLT stanza - Uniform Titles

Craig Butosi
Hi all,

Koha 16.05 on Ubuntu 14.04 (package install).

I'm working (ever so painfully slow) on a custom xslt stanza for our 240s. I want this field to be hyperlinked in the OPAC, so, I have this:

<!-- Uniform title -->
<xsl:if test="marc:datafield[@tag=240]">
<span class="results_summary uni_title">
<span class="label">Uniform title: </span>
<xsl:for-each select="marc:datafield[@tag=240]">
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9]">
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ut:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">adfghklmnoprs</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</a>
<xsl:choose>
<xsl:when test="position()=last()"></xsl:when>
<xsl:otherwise> | </xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</span>
</xsl:if>

However, the above only searches on $a of the 240, making the search far too broad. I would like to have it include most 240 subfields (i.e., adfghklmnoprs) on the search, so the latter is more targeted. How do I do that in this stanza? I've tried to edit:

 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ut:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>

to read

 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ut:<xsl:value-of select="marc:subfield[@code=' adfghklmnoprs ']"/></xsl:attribute>

to no avail.


Many thanks!

Craig Butosi, MA, MLIS, B Mus (Hons.)
LIBRARY SERVICES MANAGER
the royal conservatory
TELUS Centre for Performance and Learning
273 Bloor Street West
Toronto, ON M5S 1W2
416.408.2824 x338
www.rcmusic.ca<http://www.rcmusic.ca/>



Note: This email message and any attachments are intended only for the use of the individual to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the recipient of this email is not the intended recipient (or the employee or agent responsible for delivering the email to the intended recipient), you are hereby notified that any review, dissemination, distribution or copying or other use of this message is strictly prohibited. If you have received this communication in error, please notify the sender immediately by return email and delete this message and attachments from your system, thank you.
_______________________________________________
Koha mailing list  http://koha-community.org
[hidden email]
https://lists.katipo.co.nz/mailman/listinfo/koha
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Koha 16.05 - XSLT (OpacDetails) - Help with XSLT stanza - Uniform Titles

Craig Butosi
Hi all,

Had a 'Eureka!' moment. Posting for the community. The following works:

<!-- Uniform title -->
<xsl:if test="marc:datafield[@tag=240]">
<span class="results_summary uni_title">
<span class="label">Uniform title: </span>
<xsl:for-each select="marc:datafield[@tag=240]">
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9]">
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ut:<xsl:for-each select="marc:subfield">
    <xsl:if test="contains('adfghklmnoprst',@code)">
        <xsl:value-of select="text()"/>
            <xsl:text> </xsl:text>
    </xsl:if>
    </xsl:for-each>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">adfghklmnoprs</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</a>
<xsl:choose>
<xsl:when test="position()=last()"></xsl:when>
<xsl:otherwise> | </xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</span>
</xsl:if>

The code between the <xsl:otherwise> tags allows for all specified 240 subfields to be included in the search query: E.g., "http://yourdomain.org/cgi-bin/koha/opac-search.pl?q=ut:Sonata, piano, op. 26", instead of just "http:// yourdomain.org /cgi-bin/koha/opac-search.pl?q=ut:Sonata,"

C

Craig Butosi, MA, MLIS, B Mus (Hons.)
LIBRARY SERVICES MANAGER
the royal conservatory
TELUS Centre for Performance and Learning
273 Bloor Street West
Toronto, ON M5S 1W2
416.408.2824 x338
www.rcmusic.ca<http://www.rcmusic.ca/>

From: Craig Butosi
Sent: March-14-17 3:16 PM
To: [hidden email]
Subject: Koha 16.05 - XSLT (OpacDetails) - Help with XSLT stanza - Uniform Titles

Hi all,

Koha 16.05 on Ubuntu 14.04 (package install).

I'm working (ever so painfully slow) on a custom xslt stanza for our 240s. I want this field to be hyperlinked in the OPAC, so, I have this:

<!-- Uniform title -->
<xsl:if test="marc:datafield[@tag=240]">
<span class="results_summary uni_title">
<span class="label">Uniform title: </span>
<xsl:for-each select="marc:datafield[@tag=240]">
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9]">
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ut:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">adfghklmnoprs</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</a>
<xsl:choose>
<xsl:when test="position()=last()"></xsl:when>
<xsl:otherwise> | </xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</span>
</xsl:if>

However, the above only searches on $a of the 240, making the search far too broad. I would like to have it include most 240 subfields (i.e., adfghklmnoprs) on the search, so the latter is more targeted. How do I do that in this stanza? I've tried to edit:

 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ut:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>

to read

 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ut:<xsl:value-of select="marc:subfield[@code=' adfghklmnoprs ']"/></xsl:attribute>

to no avail.


Many thanks!

Craig Butosi, MA, MLIS, B Mus (Hons.)
LIBRARY SERVICES MANAGER
the royal conservatory
TELUS Centre for Performance and Learning
273 Bloor Street West
Toronto, ON M5S 1W2
416.408.2824 x338
www.rcmusic.ca<http://www.rcmusic.ca/>



Note: This email message and any attachments are intended only for the use of the individual to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the recipient of this email is not the intended recipient (or the employee or agent responsible for delivering the email to the intended recipient), you are hereby notified that any review, dissemination, distribution or copying or other use of this message is strictly prohibited. If you have received this communication in error, please notify the sender immediately by return email and delete this message and attachments from your system, thank you.
_______________________________________________
Koha mailing list  http://koha-community.org
[hidden email]
https://lists.katipo.co.nz/mailman/listinfo/koha
Loading...