Bug 4506: Add links to other editions, some minor corrections
authorKatrin Fischer <Katrin.Fischer.83@web.de>
Sun, 26 Sep 2010 23:55:45 +0000 (01:55 +0200)
committerColin Campbell <colin.campbell@ptfs-europe.com>
Wed, 8 Dec 2010 12:45:10 +0000 (12:45 +0000)
A new label 'Other editions:' is added with links to other editions.
The link starts a search for control number from 775$w in index control number.

A check for existence of $w/001 is added to always provide a fallback to a search for the link text.

Take care of repeated 773 fields.

Signed-off-by: Colin Campbell <colin.campbell@ptfs-europe.com>
koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl

index 9218a12..10cfc36 100644 (file)
         <span class="results_summary"><span class="label">Volumes: </span>
             <a>
             <xsl:choose>
-            <xsl:when test="$UseControlNumber = '1'">
+            <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/></xsl:attribute>
             </xsl:when>
             <xsl:otherwise>
         <!-- Set -->
         <xsl:if test="$leader19='c'">
         <span class="results_summary"><span class="label">Set: </span>
+        <xsl:for-each select="marc:datafield[@tag=773]">
             <a>
             <xsl:choose>
-            <xsl:when test="$UseControlNumber = '1'">
-                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:value-of select="marc:datafield[@tag=773]/marc:subfield[@code='w']"/></xsl:attribute>
+            <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
+                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:value-of select="marc:subfield[@code='w']"/></xsl:attribute>
             </xsl:when>
             <xsl:otherwise>
-                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Title:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')"/></xsl:attribute>
+                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Title:<xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')"/></xsl:attribute>
             </xsl:otherwise>
             </xsl:choose>
-            <xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
+            <xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
             </a>
+            <xsl:choose>
+                <xsl:when test="position()=last()"></xsl:when>
+                <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
+            </xsl:choose>
+        </xsl:for-each>
         </span>
         </xsl:if>
 
         </xsl:for-each>
         </xsl:if>
 
+        <!--  775 Other Edition  -->
+        <xsl:if test="marc:datafield[@tag=775]">
+        <span class="results_summary"><span class="label">Other Editions: </span>
+        <xsl:for-each select="marc:datafield[@tag=775]">
+            <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>
+            <a>
+            <xsl:choose>
+            <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
+                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:value-of select="marc:subfield[@code='w']"/></xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Title:<xsl:value-of select="translate(marc:subfield[@code='t'], '.', '')"/></xsl:attribute>
+            </xsl:otherwise>
+            </xsl:choose>
+            <xsl:call-template name="subfieldSelect">
+                <xsl:with-param name="codes">t</xsl:with-param>
+            </xsl:call-template>
+            </a>
+            <xsl:choose>
+                <xsl:when test="position()=last()"></xsl:when>
+                <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
+            </xsl:choose>
+        </xsl:for-each>
+        </span>
+        </xsl:if>
+
         <!-- 780 -->
         <xsl:if test="marc:datafield[@tag=780]">
         <xsl:for-each select="marc:datafield[@tag=780]">
index 78a0a5c..726134c 100755 (executable)
         <span class="results_summary"><span class="label">Volumes: </span>
             <a>
             <xsl:choose>
-            <xsl:when test="$UseControlNumber = '1'">
+            <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/></xsl:attribute>
             </xsl:when>
             <xsl:otherwise>
         <!-- Set -->
         <xsl:if test="$leader19='c'">
         <span class="results_summary"><span class="label">Set: </span>
+        <xsl:for-each select="marc:datafield[@tag=773]">
             <a>
             <xsl:choose>
-            <xsl:when test="$UseControlNumber = '1'">
-                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:value-of select="marc:datafield[@tag=773]/marc:subfield[@code='w']"/></xsl:attribute>
+            <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
+                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:value-of select="marc:subfield[@code='w']"/></xsl:attribute>
             </xsl:when>
             <xsl:otherwise>
-                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Title:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')"/></xsl:attribute>
+                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Title:<xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')"/></xsl:attribute>
             </xsl:otherwise>
             </xsl:choose>
-            <xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
+            <xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
             </a>
+            <xsl:choose>
+                <xsl:when test="position()=last()"></xsl:when>
+                <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
+            </xsl:choose>
+        </xsl:for-each>
         </span>
         </xsl:if>
 
         </span>
         </xsl:if>
 
+        <!--  775 Other Edition  -->
+        <xsl:if test="marc:datafield[@tag=775]">
+        <span class="results_summary"><span class="label">Other Editions: </span>
+        <xsl:for-each select="marc:datafield[@tag=775]">
+            <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>
+            <a>
+            <xsl:choose>
+            <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
+                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:value-of select="marc:subfield[@code='w']"/></xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Title:<xsl:value-of select="translate(marc:subfield[@code='t'], '.', '')"/></xsl:attribute>
+            </xsl:otherwise>
+            </xsl:choose>
+            <xsl:call-template name="subfieldSelect">
+                <xsl:with-param name="codes">t</xsl:with-param>
+            </xsl:call-template>
+            </a>
+            <xsl:choose>
+                <xsl:when test="position()=last()"></xsl:when>
+                <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
+            </xsl:choose>
+        </xsl:for-each>
+        </span>
+        </xsl:if>
+
         <!-- 780 -->
         <xsl:if test="marc:datafield[@tag=780]">
         <xsl:for-each select="marc:datafield[@tag=780]">