[Koha-bugs] [Bug 14332] Skip title articles on Opac using ind2 of tag 245 (MARC21 only )

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Dec 2 21:13:34 CET 2016


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

Tomás Cohen Arazi <tomascohen at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tomascohen at gmail.com

--- Comment #8 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
This implementation is causing some 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