[Koha-patches] [PATCH 1/2] Bug 12829: (MARC21) properly skip 020z when rendering ISBN for normal record display

Tomas Cohen Arazi tomascohen at gmail.com
Tue Aug 26 23:51:01 CEST 2014


Currently, 020$z oocurences are not shown, but the XSLT logic used is
introducing punctuation characters for those $z occurences.

This patch adds a check for the existence of subfield a, and skips otherwise.

To test:
- Create/have a record with 020$z (one or more) but no 020$a.
- Open the detail page for the record (on both OPAC and staff).
=> FAIL: the ISBN label and ';' and '.' characters incorrectly shown.
- Repeat mixing with 020$a occurences to notice the bug.
- Apply the patch, reload
=> SUCCES: ISBN label shows only on the presence of a 020$a, and 020$z are skipped.
- Sign off :-D

Regards
To+
---
 .../prog/en/xslt/MARC21slim2intranetDetail.xsl         | 16 +++++++++++-----
 .../bootstrap/en/xslt/MARC21slim2OPACDetail.xsl        | 18 +++++++++++-------
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
index 003f528..daab51b 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
@@ -378,15 +378,21 @@
         </span>
        </xsl:if>
 
-       <xsl:if test="marc:datafield[@tag=020]">
+       <xsl:if test="marc:datafield[@tag=020]/marc:subfield[@code='a']">
         <span class="results_summary isbn"><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:if test="marc:subfield[@code='a']">
+            <span property="isbn">
+              <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>
+            </span>
+          </xsl:if>
         </xsl:for-each>
         </span>
-        </xsl:if>
+       </xsl:if>
 
         <xsl:if test="marc:datafield[@tag=022]">
         <span class="results_summary issn"><span class="label">ISSN: </span>
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
index 6e22599..c4532ea 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
@@ -415,17 +415,21 @@
         </span>
        </xsl:if>
 
-       <xsl:if test="marc:datafield[@tag=020]">
+       <xsl:if test="marc:datafield[@tag=020]/marc:subfield[@code='a']">
         <span class="results_summary isbn"><span class="label">ISBN: </span>
         <xsl:for-each select="marc:datafield[@tag=020]">
-        <span property="isbn">
-        <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>
-        </span>
+          <xsl:if test="marc:subfield[@code='a']">
+            <span property="isbn">
+              <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>
+            </span>
+          </xsl:if>
         </xsl:for-each>
         </span>
-        </xsl:if>
+       </xsl:if>
 
         <xsl:if test="marc:datafield[@tag=022]">
         <span class="results_summary issn"><span class="label">ISSN: </span>
-- 
1.9.1



More information about the Koha-patches mailing list