Koha/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
Katrin Fischer 455c87d96e Bug 5175: Publisher link breaks display, if no publisher exists
If there is no publisher the empty publisher link will break the record display
in staff and intranet.

This patch adds a check for existence of subfield b.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2010-11-21 10:40:57 +13:00

657 lines
31 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: MARC21slim2DC.xsl,v 1.1 2003/01/06 08:20:27 adam Exp $ -->
<xsl:stylesheet version="1.0"
xmlns:marc="http://www.loc.gov/MARC21/slim"
xmlns:items="http://www.koha-community.org/items"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="marc items">
<xsl:import href="MARC21slimUtils.xsl"/>
<xsl:output method = "xml" indent="yes" omit-xml-declaration = "yes" />
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="marc:record">
<!-- Option: Display Alternate Graphic Representation (MARC 880) -->
<xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/>
<xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
<xsl:variable name="OPACBaseURL" select="marc:sysprefs/marc:syspref[@name='OPACBaseURL']"/>
<xsl:variable name="leader" select="marc:leader"/>
<xsl:variable name="leader6" select="substring($leader,7,1)"/>
<xsl:variable name="leader7" select="substring($leader,8,1)"/>
<xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
<xsl:variable name="materialTypeCode">
<xsl:choose>
<xsl:when test="$leader6='a'">
<xsl:choose>
<xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
<xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">SE</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="$leader6='t'">BK</xsl:when>
<xsl:when test="$leader6='p'">MX</xsl:when>
<xsl:when test="$leader6='m'">CF</xsl:when>
<xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
<xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">VM</xsl:when>
<xsl:when test="$leader6='i' or $leader6='j'">MU</xsl:when>
<xsl:when test="$leader6='c' or $leader6='d'">PR</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:variable name="materialTypeLabel">
<xsl:choose>
<xsl:when test="$leader6='a'">
<xsl:choose>
<xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">Book</xsl:when>
<xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">Continuing Resource</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="$leader6='t'">Book</xsl:when>
<xsl:when test="$leader6='p'">Mixed Materials</xsl:when>
<xsl:when test="$leader6='m'">Computer File</xsl:when>
<xsl:when test="$leader6='e' or $leader6='f'">Map</xsl:when>
<xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">Visual Material</xsl:when>
<xsl:when test="$leader6='j'">Music</xsl:when>
<xsl:when test="$leader6='i'">Sound</xsl:when>
<xsl:when test="$leader6='c' or $leader6='d'">Score</xsl:when>
</xsl:choose>
</xsl:variable>
<!-- Title Statement -->
<!-- Alternate Graphic Representation (MARC 880) -->
<xsl:if test="$display880">
<h1 class="title">
<xsl:call-template name="m880Select">
<xsl:with-param name="basetags">245</xsl:with-param>
<xsl:with-param name="codes">abhfgknps</xsl:with-param>
</xsl:call-template>
</h1>
</xsl:if>
<xsl:if test="marc:datafield[@tag=245]">
<h1>
<xsl:for-each select="marc:datafield[@tag=245]">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">a</xsl:with-param>
</xsl:call-template>
<xsl:if test="marc:subfield[@code='b']">
<xsl:text> </xsl:text>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">b</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:if test="marc:subfield[@code='h']">
<xsl:text> </xsl:text>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">h</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">fgknps</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</h1>
</xsl:if>
<!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
<xsl:if test="$display880">
<h5 class="author">
<xsl:call-template name="m880Select">
<xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param>
<xsl:with-param name="codes">abc</xsl:with-param>
<xsl:with-param name="index">au</xsl:with-param>
<!-- do not use label 'by ' here, it would be repeated for every occurence of 100,110,111,700,710,711 -->
</xsl:call-template>
</h5>
</xsl:if>
<xsl:choose>
<xsl:when test="marc:datafield[@tag=100] or marc:datafield[@tag=110] or marc:datafield[@tag=111] or marc:datafield[@tag=700] or marc:datafield[@tag=710] or marc:datafield[@tag=711]">
<h5 class="author">by
<xsl:for-each select="marc:datafield[@tag=100 or @tag=700]">
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9]">
<xsl:attribute name="href">/cgi-bin/koha/catalogue/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/catalogue/search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="nameABCDQ"/></a>
<xsl:choose>
<xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=110 or @tag=710]">
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9]">
<xsl:attribute name="href">/cgi-bin/koha/catalogue/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/catalogue/search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="nameABCDN"/></a>
<xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=111 or @tag=711]">
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9]">
<xsl:attribute name="href">/cgi-bin/koha/catalogue/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/catalogue/search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="nameACDEQ"/></a>
<xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
</xsl:for-each>
</h5>
</xsl:when>
</xsl:choose>
<xsl:if test="$materialTypeCode!=''">
<span class="results_summary"><span class="label">Type: </span>
<xsl:element name="img"><xsl:attribute name="src">/intranet-tmpl/prog/img/famfamfam/<xsl:value-of select="$materialTypeCode"/>.png</xsl:attribute><xsl:attribute name="alt"></xsl:attribute></xsl:element>
<xsl:text> </xsl:text>
<xsl:value-of select="$materialTypeLabel"/>
</span>
</xsl:if>
<!--Series: Alternate Graphic Representation (MARC 880) -->
<xsl:if test="$display880">
<xsl:call-template name="m880Select">
<xsl:with-param name="basetags">440,490</xsl:with-param>
<xsl:with-param name="codes">av</xsl:with-param>
<xsl:with-param name="class">results_summary</xsl:with-param>
<xsl:with-param name="label">Series: </xsl:with-param>
<xsl:with-param name="index">se</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:if test="marc:datafield[@tag=440 or @tag=490]">
<span class="results_summary"><span class="label">Series: </span>
<xsl:for-each select="marc:datafield[@tag=440]">
<a href="/cgi-bin/koha/catalogue/search.pl?q=se:{marc:subfield[@code='a']}">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">av</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</a>
<xsl:text> </xsl:text><xsl:call-template name="part"/>
<xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=490]">
<a href="/cgi-bin/koha/catalogue/search.pl?q=se:{marc:subfield[@code='a']}">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">av</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</a>
<xsl:call-template name="part"/>
<xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
</xsl:for-each>
</span>
</xsl:if>
<!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
<xsl:if test="$display880">
<xsl:call-template name="m880Select">
<xsl:with-param name="basetags">260</xsl:with-param>
<xsl:with-param name="codes">abcg</xsl:with-param>
<xsl:with-param name="class">results_summary</xsl:with-param>
<xsl:with-param name="label">Publisher: </xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:if test="marc:datafield[@tag=260]">
<span class="results_summary"><span class="label">Publisher: </span>
<xsl:for-each select="marc:datafield[@tag=260]">
<xsl:if test="marc:subfield[@code='b']">
<a href="/cgi-bin/koha/catalogue/search.pl?q=pb:{marc:subfield[@code='b']}">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">b</xsl:with-param>
</xsl:call-template>
</a>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">acg</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
<xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
</xsl:for-each>
</span>
</xsl:if>
<!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
<xsl:if test="$display880">
<xsl:call-template name="m880Select">
<xsl:with-param name="basetags">250</xsl:with-param>
<xsl:with-param name="codes">ab</xsl:with-param>
<xsl:with-param name="class">results_summary</xsl:with-param>
<xsl:with-param name="label">Edition: </xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:if test="marc:datafield[@tag=250]">
<span class="results_summary"><span class="label">Edition: </span>
<xsl:for-each select="marc:datafield[@tag=250]">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">ab</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
<xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
</xsl:for-each>
</span>
</xsl:if>
<!-- Description: Alternate Graphic Representation (MARC 880) -->
<xsl:if test="$display880">
<xsl:call-template name="m880Select">
<xsl:with-param name="basetags">300</xsl:with-param>
<xsl:with-param name="codes">abceg</xsl:with-param>
<xsl:with-param name="class">results_summary</xsl:with-param>
<xsl:with-param name="label">Description: </xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:if test="marc:datafield[@tag=300]">
<span class="results_summary"><span class="label">Description: </span>
<xsl:for-each select="marc:datafield[@tag=300]">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">abceg</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
<xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
</xsl:for-each>
</span>
</xsl:if>
<xsl:if test="marc:datafield[@tag=020]">
<span class="results_summary"><span class="label">ISBN: </span>
<xsl:for-each select="marc:datafield[@tag=020]">
<xsl:variable name="isbn" select="marc:subfield[@code='a']"/>
<xsl:value-of select="marc:subfield[@code='a']"/>
<xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
</xsl:for-each>
</span>
</xsl:if>
<xsl:if test="marc:datafield[@tag=022]">
<span class="results_summary"><span class="label">ISSN: </span>
<xsl:for-each select="marc:datafield[@tag=022]">
<xsl:value-of select="marc:subfield[@code='a']"/>
<xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
</xsl:for-each>
</span>
</xsl:if>
<!-- Other Title Statement: Alternate Graphic Representation (MARC 880) -->
<xsl:if test="$display880">
<xsl:call-template name="m880Select">
<xsl:with-param name="basetags">246</xsl:with-param>
<xsl:with-param name="codes">abhfgnp</xsl:with-param>
<xsl:with-param name="class">results_summary</xsl:with-param>
<xsl:with-param name="label">Other Title: </xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:if test="marc:datafield[@tag=246]">
<span class="results_summary"><span class="label">Other Title: </span>
<xsl:for-each select="marc:datafield[@tag=246]">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">iabhfgnp</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
<xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
</xsl:for-each>
</span>
</xsl:if>
<!-- Uniform Title Statement: Alternate Graphic Representation (MARC 880) -->
<xsl:if test="$display880">
<xsl:call-template name="m880Select">
<xsl:with-param name="basetags">130,240</xsl:with-param>
<xsl:with-param name="codes">adfklmor</xsl:with-param>
<xsl:with-param name="class">results_summary</xsl:with-param>
<xsl:with-param name="label">Uniform Title: </xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
<span class="results_summary"><span class="label">Uniform titles: </span>
<xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
<xsl:variable name="str">
<xsl:for-each select="marc:subfield">
<xsl:if test="(contains('adfklmor',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))">
<xsl:value-of select="text()"/>
<xsl:text> </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:value-of select="substring($str,1,string-length($str)-1)"/>
</xsl:with-param>
</xsl:call-template>
<xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
</xsl:for-each>
</span>
</xsl:if>
<xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6']">
<span class="results_summary"><span class="label">Subject(s): </span>
<xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']">
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9]">
<xsl:attribute name="href">/cgi-bin/koha/catalogue/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/catalogue/search.pl?q=su:<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">abcdtvxyz</xsl:with-param>
<xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
<xsl:with-param name="subdivDelimiter">-- </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>
<xsl:if test="marc:datafield[@tag=856]">
<span class="results_summary"><span class="label">Online Resources: </span>
<xsl:for-each select="marc:datafield[@tag=856]">
<a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
<xsl:choose>
<xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">y3z</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
<xsl:choose>
<xsl:when test="$URLLinkText!=''">
<xsl:value-of select="$URLLinkText"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>Click here to access online</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</a>
<xsl:choose>
<xsl:when test="position()=last()"><xsl:text> </xsl:text></xsl:when>
<xsl:otherwise> | </xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</span>
</xsl:if>
<xsl:if test="marc:datafield[@tag=505]">
<xsl:for-each select="marc:datafield[@tag=505]">
<span class="results_summary">
<xsl:choose>
<xsl:when test="@ind1=0">
<span class="label">Contents:</span>
</xsl:when>
<xsl:when test="@ind1=1">
<span class="label">Incomplete contents:</span>
</xsl:when>
<xsl:when test="@ind1=1">
<span class="label">Partial contents:</span>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="@ind2=0">
<xsl:for-each select="marc:subfield[@code='t']">
<xsl:value-of select="marc:subfield[@code=t]"/> <xsl:value-of select="marc:subfield[@code=r]"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">au</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</span>
</xsl:for-each>
</xsl:if>
<!-- 780 -->
<xsl:if test="marc:datafield[@tag=780]">
<xsl:for-each select="marc:datafield[@tag=780]">
<span class="results_summary">
<xsl:choose>
<xsl:when test="@ind2=0">
<span class="label">Continues:</span>
</xsl:when>
<xsl:when test="@ind2=1">
<span class="label">Continues in part:</span>
</xsl:when>
<xsl:when test="@ind2=2">
<span class="label">Supersedes:</span>
</xsl:when>
<xsl:when test="@ind2=3">
<span class="label">Supersedes in part:</span>
</xsl:when>
<xsl:when test="@ind2=4">
<span class="label">Formed by the union: ... and: ...</span>
</xsl:when>
<xsl:when test="@ind2=5">
<span class="label">Absorbed:</span>
</xsl:when>
<xsl:when test="@ind2=6">
<span class="label">Absorbed in part:</span>
</xsl:when>
<xsl:when test="@ind2=7">
<span class="label">Separated from:</span>
</xsl:when>
</xsl:choose>
<xsl:variable name="f780">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">at</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
<xsl:value-of select="translate($f780, '()', '')"/>
</a>
</span>
<xsl:choose>
<xsl:when test="@ind1=0">
<span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:if>
<!-- 785 -->
<xsl:if test="marc:datafield[@tag=785]">
<xsl:for-each select="marc:datafield[@tag=785]">
<span class="results_summary">
<xsl:choose>
<xsl:when test="@ind2=0">
<span class="label">Continued by:</span>
</xsl:when>
<xsl:when test="@ind2=1">
<span class="label">Continued in part by:</span>
</xsl:when>
<xsl:when test="@ind2=2">
<span class="label">Superseded by:</span>
</xsl:when>
<xsl:when test="@ind2=3">
<span class="label">Superseded in part by:</span>
</xsl:when>
<xsl:when test="@ind2=4">
<span class="label">Absorbed by:</span>
</xsl:when>
<xsl:when test="@ind2=5">
<span class="label">Absorbed in part by:</span>
</xsl:when>
<xsl:when test="@ind2=6">
<span class="label">Split into .. and ...:</span>
</xsl:when>
<xsl:when test="@ind2=7">
<span class="label">Merged with ... to form ...</span>
</xsl:when>
<xsl:when test="@ind2=8">
<span class="label">Changed back to:</span>
</xsl:when>
</xsl:choose>
<xsl:variable name="f785">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">at</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
<xsl:value-of select="translate($f785, '()', '')"/>
</a>
</span>
</xsl:for-each>
</xsl:if>
<xsl:if test="$OPACBaseURL!=''">
<span class="results_summary"><span class="label">OPAC view: </span>
<a><xsl:attribute name="href">http://<xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:datafield[@tag=999]/marc:subfield[@code='c']"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute>Open in new window</a>.
</span>
</xsl:if>
</xsl:template>
<xsl:template name="nameABCDQ">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">aq</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="punctuation">
<xsl:text>:,;/ </xsl:text>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="termsOfAddress"/>
</xsl:template>
<xsl:template name="nameABCDN">
<xsl:for-each select="marc:subfield[@code='a']">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString" select="."/>
</xsl:call-template>
</xsl:for-each>
<xsl:for-each select="marc:subfield[@code='b']">
<xsl:value-of select="."/>
</xsl:for-each>
<xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">cdn</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="nameACDEQ">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">acdeq</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="termsOfAddress">
<xsl:if test="marc:subfield[@code='b' or @code='c']">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">bc</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="part">
<xsl:variable name="partNumber">
<xsl:call-template name="specialSubfieldSelect">
<xsl:with-param name="axis">n</xsl:with-param>
<xsl:with-param name="anyCodes">n</xsl:with-param>
<xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="partName">
<xsl:call-template name="specialSubfieldSelect">
<xsl:with-param name="axis">p</xsl:with-param>
<xsl:with-param name="anyCodes">p</xsl:with-param>
<xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:if test="string-length(normalize-space($partNumber))">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString" select="$partNumber"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="string-length(normalize-space($partName))">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString" select="$partName"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="specialSubfieldSelect">
<xsl:param name="anyCodes"/>
<xsl:param name="axis"/>
<xsl:param name="beforeCodes"/>
<xsl:param name="afterCodes"/>
<xsl:variable name="str">
<xsl:for-each select="marc:subfield">
<xsl:if test="contains($anyCodes, @code) or (contains($beforeCodes,@code) and following-sibling::marc:subfield[@code=$axis]) or (contains($afterCodes,@code) and preceding-sibling::marc:subfield[@code=$axis])">
<xsl:value-of select="text()"/>
<xsl:text> </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="substring($str,1,string-length($str)-1)"/>
</xsl:template>
</xsl:stylesheet>