[Koha-bugs] [Bug 18540] New: koha-indexdefs-to-zebra.xsl introduces MARC21 stuff into UNIMARC xslts

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu May 4 16:21:05 CEST 2017


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18540

            Bug ID: 18540
           Summary: koha-indexdefs-to-zebra.xsl introduces MARC21 stuff
                    into UNIMARC xslts
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: Architecture, internals, and plumbing
          Assignee: gmcharlt at gmail.com
          Reporter: tomascohen at gmail.com
        QA Contact: testopia at bugs.koha-community.org

Bug 14332 introduced troubles because the koha-indexdefs-to-zebra.xsl is by no
means MARC21-only or even biblio-only.

To reproduce:
- On current master, run:
  $ xsltproc etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl
etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml >
etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl
- Run:
  $ git diff
=> FAIL: The following is added to
etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl, thus UNIMARC
field 245 is being sent to the Title index

@@ -42,6 +43,7 @@ definition file (probably something like
{biblio,authority}-koha-indexdefs.xml)
       <xslo:apply-templates mode="index_match_heading"/>
       <xslo:apply-templates mode="index_subject_thesaurus"/>
       <xslo:apply-templates mode="index_all"/>
+      <xslo:apply-templates mode="index_sort_tit"/>
     </z:record>
   </xslo:template>
   <xslo:template match="marc:controlfield[@tag='001']">
@@ -2681,6 +2683,19 @@ definition file (probably something like
{biblio,authority}-koha-indexdefs.xml)
       <xslo:value-of select="."/>
     </z:index>
   </xslo:template>
+  <xslo:template mode="index_sort_tit" match="marc:datafield[@tag='245']">
+    <xslo:variable name="chop">
+      <xslo:choose>
+        <xslo:when test="not(number(@ind2))">0</xslo:when>
+        <xslo:otherwise>
+          <xslo:value-of select="number(@ind2)"/>
+        </xslo:otherwise>
+      </xslo:choose>
+    </xslo:variable>
+    <z:index name="Title:s">
+      <xslo:value-of select="substring(marc:subfield[@code='a'], $chop+1)"/>
+    </z:index>
+  </xslo:template>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list