Bug 12725: Show RDA tag 264 on Intranet Results and Detail XSLT view (MARC21)
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Thu, 7 Aug 2014 07:55:49 +0000 (09:55 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Sat, 18 Oct 2014 13:28:39 +0000 (10:28 -0300)
As bugs 12724 and 12726 did on OPAC, this patch adds similar changes to
Intranet Results and Details XSLT view. It shows information from tag 264 on
the Publisher line of Intranet Results and Detail.

Test plan (see also bug 12742 and the rules mentioned there):
[1] Add tag 260 and some 264s to your MARC21 record.
[2] Check the display of Intranet Results.
[3] Check the display of Intranet Detail.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Results and detail show 264. I added 2 but only shows the second,
is that right?

[Reply from marcel:] Yes. Based on the rules described, it picks the most
'appropriate' 264.

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl
koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl

index 003f528..e7bf6d1 100644 (file)
             </xsl:call-template>
         </xsl:if>
 
-        <xsl:if test="marc:datafield[@tag=260]">
+        <!-- Publisher info and RDA related info from tags 260, 264 -->
+        <xsl:choose>
+        <xsl:when test="marc:datafield[@tag=260]">
         <span class="results_summary publisher"><span class="label">Publisher: </span>
             <xsl:for-each select="marc:datafield[@tag=260]">
                 <xsl:if test="marc:subfield[@code='a']">
                </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>
+            <xsl:if test="marc:datafield[@tag=264]">
+                <xsl:text>; </xsl:text>
+                <xsl:call-template name="showRDAtag264"/>
+            </xsl:if>
         </span>
-        </xsl:if>
+        </xsl:when>
+        <xsl:when test="marc:datafield[@tag=264]">
+            <span class="results_summary">
+                <xsl:call-template name="showRDAtag264"/>
+            </span>
+        </xsl:when>
+        </xsl:choose>
 
         <!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
         <xsl:if test="$display880">
index e27419d..b62c41b 100644 (file)
       </xsl:call-template>
     </xsl:if>
 
-    <xsl:if test="marc:datafield[@tag=260]">
+    <!-- Publisher info and RDA related info from tags 260, 264 -->
+    <xsl:choose>
+    <xsl:when test="marc:datafield[@tag=260]">
         <span class="results_summary publisher"><span class="label">Publisher: </span>
             <xsl:for-each select="marc:datafield[@tag=260]">
                 <xsl:if test="marc:subfield[@code='a']">
                 </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>
+            <xsl:if test="marc:datafield[@tag=264]">
+                <xsl:text>; </xsl:text>
+                <xsl:call-template name="showRDAtag264"/>
+            </xsl:if>
         </span>
-    </xsl:if>
+    </xsl:when>
+    <xsl:when test="marc:datafield[@tag=264]">
+        <span class="results_summary">
+            <xsl:call-template name="showRDAtag264"/>
+        </span>
+    </xsl:when>
+    </xsl:choose>
 
     <!-- Dissertation note -->
     <xsl:if test="marc:datafield[@tag=502]">
index 7334d03..c1b52f3 100644 (file)
                 </span>
             </xsl:if>
         </xsl:for-each>
+    </xsl:template>
+
+    <xsl:template name="showRDAtag264">
+    <!-- Function showRDAtag264 shows selected information from tag 264
+         on the Publisher line (used by OPAC Detail and Results)
+         Depending on how many tags you have, we will pick by preference
+         Publisher-latest or Publisher or 'Other'-latest or 'Other'
+         The preferred tag is saved in the fav variable and passed to a
+         helper named-template -->
+        <xsl:choose>
+            <xsl:when test="marc:datafield[@tag=264 and @ind1=3 and @ind2=1]">
+            <!-- ind1==3 means latest change -->
+            <!-- ind2==1 means Publisher -->
+              <xsl:variable name="fav" select="marc:datafield[@tag=264 and @ind1=3 and @ind2=1][1]"/>
+              <xsl:call-template name="showRDAtag264helper">
+                <xsl:with-param name="field" select="$fav"/>
+              </xsl:call-template>
+            </xsl:when>
+
+            <xsl:when test="marc:datafield[@tag=264 and @ind2=1]">
+              <xsl:variable name="fav" select="marc:datafield[@tag=264 and @ind2=1][last()]"/>
+              <xsl:call-template name="showRDAtag264helper">
+                <xsl:with-param name="field" select="$fav"/>
+              </xsl:call-template>
+            </xsl:when>
 
+            <xsl:when test="marc:datafield[@tag=264 and @ind1=3]">
+              <xsl:variable name="fav" select="marc:datafield[@tag=264 and @ind1=3][1]"/>
+              <xsl:call-template name="showRDAtag264helper">
+                <xsl:with-param name="field" select="$fav"/>
+              </xsl:call-template>
+            </xsl:when>
+
+            <xsl:otherwise>
+              <xsl:variable name="fav" select="marc:datafield[@tag=264][last()]"/>
+              <xsl:call-template name="showRDAtag264helper">
+                <xsl:with-param name="field" select="$fav"/>
+              </xsl:call-template>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <xsl:template name="showRDAtag264helper">
+        <xsl:param name="field"/>
+        <xsl:variable name="ind2" select="$field/@ind2"/>
+        <xsl:choose>
+            <xsl:when test="$ind2='0'">
+                <span class="label">Producer: </span>
+            </xsl:when>
+            <xsl:when test="$ind2='1'">
+                <span class="label">Publisher: </span>
+            </xsl:when>
+            <xsl:when test="$ind2='2'">
+                <span class="label">Distributor: </span>
+            </xsl:when>
+            <xsl:when test="$ind2='3'">
+                <span class="label">Manufacturer: </span>
+            </xsl:when>
+        </xsl:choose>
+        <xsl:value-of select="$field/marc:subfield[@code='a']"/>
+        <xsl:text> </xsl:text>
+        <xsl:value-of select="$field/marc:subfield[@code='b']"/>
+        <xsl:text> </xsl:text>
+        <xsl:value-of select="$field/marc:subfield[@code='c']"/>
     </xsl:template>
 
 </xsl:stylesheet>