Bug 8665: DOM indexing fails to index some bib records
authorJared Camins-Esakov <jcamins@cpbibliography.com>
Thu, 4 Oct 2012 12:52:48 +0000 (08:52 -0400)
committerPaul Poulain <paul.poulain@biblibre.com>
Mon, 29 Oct 2012 18:12:38 +0000 (19:12 +0100)
Use a user-specified field for z:id.

This patch also fixes an excess space before the index in the MARC21
biblio index definitions, which someone fixed in the generated file
but not in the source file it should have been fixed in.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Elliott Davis <elliott@bywatersolutions.com>
etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml
etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl
etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml
etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl
etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml
etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl
etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl

index 4599728..5a34eb2 100644 (file)
@@ -6,6 +6,7 @@ run the following command:
 authority-zebra-indexdefs.xsl`
 -->
 <kohaidx:index_defs xmlns:kohaidx="http://www.koha-community.org/schemas/index-defs">
+  <id>marc:controlfield[@tag='001']</id>
   <!-- variables -->
   <kohaidx:var name="form_subdivision_subfield">v</kohaidx:var>
   <kohaidx:var name="general_subdivision_subfield">x</kohaidx:var>
index 1bafa16..5c80c2c 100644 (file)
@@ -27,10 +27,10 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
     </xslo:if>
   </xslo:template>
   <xslo:template match="marc:record">
-    <xslo:variable name="controlField001" select="normalize-space(marc:controlfield[@tag='001'])"/>
+    <xslo:variable name="idfield" select="normalize-space(marc:controlfield[@tag='001'])"/>
     <z:record type="update">
       <xslo:attribute name="z:id">
-        <xslo:value-of select="$controlField001"/>
+        <xslo:value-of select="$idfield"/>
       </xslo:attribute>
       <xslo:apply-templates/>
       <xslo:apply-templates mode="index_subfields"/>
@@ -1122,7 +1122,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
       <xslo:value-of select="normalize-space($raw_heading)"/>
     </z:index>
   </xslo:template>
-  <xslo:template mode="index_heading_conditional" match="marc:datafield[@tag='450']">
+  <xslo:template mode="index_heading_conditional">
     <xslo:if test="substring(marc:subfield[@code='w']/text(), 2, 1)">
       <z:index name="Previous-heading-see-from:p">
         <xslo:variable name="raw_heading">
index 9219000..14443d6 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <kohaidx:index_defs xmlns:kohaidx="http://www.koha-community.org/schemas/index-defs">
   <!--record.abs line 40: xelm /record/leader llength:w:range(data,0,5),rtype:w:range(data,6,1),Bib-level:w:range(data,7,1)-->
+  <id>marc:datafield[@tag='999']/marc:subfield[@code='c']</id>
   <index_leader xmlns="http://www.koha-community.org/schemas/index-defs" offset="0" length="5">
     <target_index>llength:w</target_index>
   </index_leader>
   </index_subfields>
   <!--record.abs line 286: melm 952$3      materials-specified -->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="3">
-    <target_index>materials-specified :w</target_index>
+    <target_index>materials-specified:w</target_index>
   </index_subfields>
   <!--record.abs line 287: melm 952$4      damaged:n,damaged:w-->
   <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="4">
index 06b7882..14f299e 100644 (file)
@@ -13,6 +13,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
   <xslo:template match="text()" mode="index_subfields"/>
   <xslo:template match="text()" mode="index_data_field"/>
   <xslo:template match="text()" mode="index_heading"/>
+  <xslo:template match="text()" mode="index_heading_conditional"/>
   <xslo:template match="text()" mode="index_match_heading"/>
   <xslo:template match="text()" mode="index_subject_thesaurus"/>
   <xslo:template match="/">
@@ -26,15 +27,16 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
     </xslo:if>
   </xslo:template>
   <xslo:template match="marc:record">
-    <xslo:variable name="controlField001" select="normalize-space(marc:controlfield[@tag='001'])"/>
+    <xslo:variable name="idfield" select="normalize-space(marc:datafield[@tag='999']/marc:subfield[@code='c'])"/>
     <z:record type="update">
       <xslo:attribute name="z:id">
-        <xslo:value-of select="$controlField001"/>
+        <xslo:value-of select="$idfield"/>
       </xslo:attribute>
       <xslo:apply-templates/>
       <xslo:apply-templates mode="index_subfields"/>
       <xslo:apply-templates mode="index_data_field"/>
       <xslo:apply-templates mode="index_heading"/>
+      <xslo:apply-templates mode="index_heading_conditional"/>
       <xslo:apply-templates mode="index_match_heading"/>
       <xslo:apply-templates mode="index_subject_thesaurus"/>
     </z:record>
index 6870469..8eecf1c 100644 (file)
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <kohaidx:index_defs xmlns:kohaidx="http://www.koha-community.org/schemas/index-defs">
+  <id>marc:controlfield[@tag='001']</id>
   <!--record.abs line 24: melm 001        Local-number,Local-number:n-->
   <index_control_field xmlns="http://www.koha-community.org/schemas/index-defs" tag="001">
     <target_index>Local-number:w</target_index>
index feeda35..46e190f 100644 (file)
@@ -13,6 +13,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
   <xslo:template match="text()" mode="index_subfields"/>
   <xslo:template match="text()" mode="index_data_field"/>
   <xslo:template match="text()" mode="index_heading"/>
+  <xslo:template match="text()" mode="index_heading_conditional"/>
   <xslo:template match="text()" mode="index_match_heading"/>
   <xslo:template match="text()" mode="index_subject_thesaurus"/>
   <xslo:template match="/">
@@ -26,15 +27,16 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
     </xslo:if>
   </xslo:template>
   <xslo:template match="marc:record">
-    <xslo:variable name="controlField001" select="normalize-space(marc:controlfield[@tag='001'])"/>
+    <xslo:variable name="idfield" select="normalize-space(marc:controlfield[@tag='001'])"/>
     <z:record type="update">
       <xslo:attribute name="z:id">
-        <xslo:value-of select="$controlField001"/>
+        <xslo:value-of select="$idfield"/>
       </xslo:attribute>
       <xslo:apply-templates/>
       <xslo:apply-templates mode="index_subfields"/>
       <xslo:apply-templates mode="index_data_field"/>
       <xslo:apply-templates mode="index_heading"/>
+      <xslo:apply-templates mode="index_heading_conditional"/>
       <xslo:apply-templates mode="index_match_heading"/>
       <xslo:apply-templates mode="index_subject_thesaurus"/>
     </z:record>
index 2316d3f..47c47a7 100644 (file)
@@ -49,9 +49,11 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
             </xslo:template>
 
             <xslo:template match="marc:record">
-                <xslo:variable name="controlField001" select="normalize-space(marc:controlfield[@tag='001'])"/>
+                <xslo:variable name="idfield">
+                    <xsl:attribute name="select">normalize-space(<xsl:value-of select="//id"/>)</xsl:attribute>
+                </xslo:variable>
                 <z:record type="update">
-                    <xslo:attribute name="z:id"><xslo:value-of select="$controlField001"/></xslo:attribute>
+                    <xslo:attribute name="z:id"><xslo:value-of select="$idfield"/></xslo:attribute>
                     <xslo:apply-templates/>
                     <xslo:apply-templates mode="index_subfields"/>
                     <xslo:apply-templates mode="index_data_field"/>