</xsl:for-each>
</xsl:if>
+ <!-- 787 Other Relationship Entry -->
+ <xsl:if test="marc:datafield[@tag=787]">
+ <span class="results_summary other_relationship_entry"><span class="label">Other related works: </span>
+ <xsl:for-each select="marc:datafield[@tag=580]">
+ <span class="linking_complexity_note">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">a</xsl:with-param>
+ </xsl:call-template>
+ <xsl:text> </xsl:text>
+ </span>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=787]">
+ <span class="other_relationship_entry">
+ <xsl:variable name="f787">
+ <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">a_t</xsl:with-param>
+ </xsl:call-template></xsl:with-param></xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="marc:subfield[@code='i']">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">i</xsl:with-param>
+ </xsl:call-template>
+ <xsl:text>: </xsl:text>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
+ <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute>
+ <xsl:value-of select="$f787"/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="relation_query">
+ <xsl:text>ti,phr:(</xsl:text>
+ <xsl:call-template name="quote_search_term">
+ <xsl:with-param name="term"><xsl:value-of select="marc:subfield[@code='t']"/></xsl:with-param>
+ </xsl:call-template>
+ <xsl:text>)</xsl:text>
+ <xsl:if test="marc:subfield[@code='a']">
+ <xsl:text> AND au:(</xsl:text>
+ <xsl:call-template name="quote_search_term">
+ <xsl:with-param name="term">
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+ </xsl:variable>
+ <a>
+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="str:encode-uri($relation_query, true())" />
+ </xsl:attribute>
+ <xsl:value-of select="$f787"/>
+ </a>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="position()=last()"></xsl:when>
+ <xsl:otherwise><span class="separator"><xsl:text>; </xsl:text></span></xsl:otherwise>
+ </xsl:choose>
+ </span>
+ </xsl:for-each>
+ </span>
+ </xsl:if>
+
<!-- Indicate if record is suppressed in OPAC -->
<xsl:choose>
<xsl:when test="$OpacSuppression = 1 and marc:datafield[@tag=942][marc:subfield[@code='n'] = '1']">