<xsl:variable name="start" select="position()"/>
<xsl:variable name="ends">
<xsl:for-each select="../marc:subfield[position() > $start]">
- <xsl:if test="@code=3 or @code=9 or @code=2">
+ <xsl:if test="@code=9">
<xsl:variable name="end" select="position() + $start"/>
<xsl:value-of select="$end"/>
<xsl:text>,</xsl:text>
</xsl:choose>
</xsl:variable>
<xsl:variable name="display">
- <xsl:for-each select="../marc:subfield[position() > $start and position() < $end]">
+ <xsl:for-each select="../marc:subfield[position() > $start and position() < $end and @code!=2 and @code!=3]">
<xsl:value-of select="."/>
<xsl:if test="not(position()=last())">
<xsl:text>, </xsl:text>
<xsl:text>/cgi-bin/koha/opac-search.pl?q=an:</xsl:text>
<xsl:value-of select="."/>
</xsl:attribute>
- <xsl:value-of select="$display"/>
+ <xsl:choose>
+ <xsl:when test="string-length($display) > 0">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="$display"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
</a>
<xsl:variable name="ncommas"
select="string-length($ends) - string-length(translate($ends, ',', ''))" />
</xsl:if>
</xsl:for-each>
</xsl:when>
- <xsl:otherwise>
+ <xsl:when test="marc:subfield[@code=a]">
<a>
<xsl:attribute name="href">
<xsl:text>/cgi-bin/koha/opac-search.pl?q=su:</xsl:text>
</xsl:with-param>
</xsl:call-template>
</a>
- </xsl:otherwise>
+ </xsl:when>
+ <xsl:otherwise/>
</xsl:choose>
<xsl:if test="not(position()=last())">
<xsl:text> | </xsl:text>