Bug 3072: Add Heading-Main and Any to MARC21 DOM
authorJared Camins-Esakov <jcamins@bywatersolutions.com>
Sun, 17 Apr 2011 22:09:07 +0000 (18:09 -0400)
committerChris Nighswonger <chris.nighswonger@gmail.com>
Thu, 2 Jun 2011 17:32:50 +0000 (13:32 -0400)
The Heading-Main and Any indexes were not defined in the MARC21 authority DOM
rules, but was enabled by the fix for bug 5924. This patch adds the Heading-Main
and Any indexes to the MARC21 DOM authority configuration.

This is a revised patch, with the authority-zebra-indexdefs.xsl automatically
generated from authority-koha-indexdefs.xml. Note that Any is added by
koha-indexdefs-to-zebra.xsl rather than in the authority-koha-indexdefs.xml
file.

NOTE: This patch modifies the following files, which you will need to manually
update if you are using a dev install:
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/authorities/koha-indexdefs-to-zebra.xsl

You will also need to reindex your authorities for the changes in this patch to
take effect.

Signed-off-by: Jared Camins-Esakov <jcamins@bywatersolutions.com>
Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 79deeddc2ad6f09fddd7e200830b1a74a03374bc)

Signed-off-by: Chris Nighswonger <chris.nighswonger@gmail.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/authorities/koha-indexdefs-to-zebra.xsl

index 7b59be3..87d31bc 100644 (file)
@@ -59,11 +59,16 @@ authority-zebra-indexdefs.xsl`
     <kohaidx:target_index>Heading:p</kohaidx:target_index>
     <kohaidx:target_index>Heading:s</kohaidx:target_index>
   </kohaidx:index_heading>
+  <kohaidx:index_heading tag="100" subfields="a">
+    <kohaidx:target_index>Heading-Main:w</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:p</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:s</kohaidx:target_index>
+  </kohaidx:index_heading>
   <kohaidx:index_match_heading tag="100" subfields="abcdefghjklmnopqrstvxyz" subdivisions="vxyz">
     <kohaidx:target_index>Match-heading:p</kohaidx:target_index>
     <kohaidx:target_index>Match-heading:s</kohaidx:target_index>
   </kohaidx:index_match_heading>
-  
+
   <kohaidx:index_heading tag="400" subfields="abcdefghjklmnopqrstvxyz" subdivisions="vxyz">
     <kohaidx:target_index>Personal-name-see-from:w</kohaidx:target_index>
     <kohaidx:target_index>Personal-name-see-from:p</kohaidx:target_index>
@@ -99,6 +104,11 @@ authority-zebra-indexdefs.xsl`
     <kohaidx:target_index>Heading:p</kohaidx:target_index>
     <kohaidx:target_index>Heading:s</kohaidx:target_index>
   </kohaidx:index_heading>
+  <kohaidx:index_heading tag="110" subfields="a">
+    <kohaidx:target_index>Heading-Main:w</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:p</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:s</kohaidx:target_index>
+  </kohaidx:index_heading>
   <kohaidx:index_match_heading tag="110" subfields="abcdefghklmnoprstvxyz" subdivisions="vxyz">
     <kohaidx:target_index>Match-heading:p</kohaidx:target_index>
     <kohaidx:target_index>Match-heading:s</kohaidx:target_index>
@@ -139,6 +149,11 @@ authority-zebra-indexdefs.xsl`
     <kohaidx:target_index>Heading:p</kohaidx:target_index>
     <kohaidx:target_index>Heading:s</kohaidx:target_index>
   </kohaidx:index_heading>
+  <kohaidx:index_heading tag="111" subfields="a">
+    <kohaidx:target_index>Heading-Main:w</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:p</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:s</kohaidx:target_index>
+  </kohaidx:index_heading>
   <kohaidx:index_match_heading tag="111" subfields="acdefghjklnpqstvxyz" subdivisions="vxyz">
     <kohaidx:target_index>Match-heading:p</kohaidx:target_index>
     <kohaidx:target_index>Match-heading:s</kohaidx:target_index>
@@ -179,6 +194,11 @@ authority-zebra-indexdefs.xsl`
     <kohaidx:target_index>Heading:p</kohaidx:target_index>
     <kohaidx:target_index>Heading:s</kohaidx:target_index>
   </kohaidx:index_heading>
+  <kohaidx:index_heading tag="130" subfields="a">
+    <kohaidx:target_index>Heading-Main:w</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:p</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:s</kohaidx:target_index>
+  </kohaidx:index_heading>
   <kohaidx:index_match_heading tag="130" subfields="adfghklmnoprstvxyz" subdivisions="vxyz">
     <kohaidx:target_index>Match-heading:p</kohaidx:target_index>
     <kohaidx:target_index>Match-heading:s</kohaidx:target_index>
@@ -219,6 +239,11 @@ authority-zebra-indexdefs.xsl`
     <kohaidx:target_index>Heading:p</kohaidx:target_index>
     <kohaidx:target_index>Heading:s</kohaidx:target_index>
   </kohaidx:index_heading>
+  <kohaidx:index_heading tag="148" subfields="a">
+    <kohaidx:target_index>Heading-Main:w</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:p</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:s</kohaidx:target_index>
+  </kohaidx:index_heading>
   <kohaidx:index_match_heading tag="148" subfields="avxyz" subdivisions="vxyz">
     <kohaidx:target_index>Match-heading:p</kohaidx:target_index>
     <kohaidx:target_index>Match-heading:s</kohaidx:target_index>
@@ -260,6 +285,11 @@ authority-zebra-indexdefs.xsl`
     <kohaidx:target_index>Heading:p</kohaidx:target_index>
     <kohaidx:target_index>Heading:s</kohaidx:target_index>
   </kohaidx:index_heading>
+  <kohaidx:index_heading tag="150" subfields="a">
+    <kohaidx:target_index>Heading-Main:w</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:p</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:s</kohaidx:target_index>
+  </kohaidx:index_heading>
   <kohaidx:index_match_heading tag="150" subfields="abvxyz" subdivisions="vxyz">
     <kohaidx:target_index>Match-heading:p</kohaidx:target_index>
     <kohaidx:target_index>Match-heading:s</kohaidx:target_index>
@@ -300,6 +330,11 @@ authority-zebra-indexdefs.xsl`
     <kohaidx:target_index>Heading:p</kohaidx:target_index>
     <kohaidx:target_index>Heading:s</kohaidx:target_index>
   </kohaidx:index_heading>
+  <kohaidx:index_heading tag="151" subfields="a">
+    <kohaidx:target_index>Heading-Main:w</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:p</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:s</kohaidx:target_index>
+  </kohaidx:index_heading>
   <kohaidx:index_match_heading tag="151" subfields="avxyz" subdivisions="vxyz">
     <kohaidx:target_index>Match-heading:p</kohaidx:target_index>
     <kohaidx:target_index>Match-heading:s</kohaidx:target_index>
@@ -340,6 +375,11 @@ authority-zebra-indexdefs.xsl`
     <kohaidx:target_index>Heading:p</kohaidx:target_index>
     <kohaidx:target_index>Heading:s</kohaidx:target_index>
   </kohaidx:index_heading>
+  <kohaidx:index_heading tag="155" subfields="a">
+    <kohaidx:target_index>Heading-Main:w</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:p</kohaidx:target_index>
+    <kohaidx:target_index>Heading-Main:s</kohaidx:target_index>
+  </kohaidx:index_heading>
   <kohaidx:index_match_heading tag="155" subfields="avxyz" subdivisions="vxyz">
     <kohaidx:target_index>Match-heading:p</kohaidx:target_index>
     <kohaidx:target_index>Match-heading:s</kohaidx:target_index>
index 23989fc..5c37bc6 100644 (file)
@@ -169,6 +169,26 @@ authority-zebra-indexdefs.xsl` (substituting the appropriate file names).
       </xslo:variable>
       <xslo:value-of select="normalize-space($raw_heading)"/>
     </z:index>
+    <z:index name="Heading-Main:w Heading-Main:p Heading-Main:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('a', @code)" name="Heading-Main:w Heading-Main:p Heading-Main:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('', @code)">
+                  <xslo:text>--</xslo:text>
+                </xslo:when>
+                <xslo:otherwise>
+                  <xslo:value-of select="substring(' ', 1, 1)"/>
+                </xslo:otherwise>
+              </xslo:choose>
+            </xslo:if>
+            <xslo:value-of select="."/>
+          </xslo:if>
+        </xslo:for-each>
+      </xslo:variable>
+      <xslo:value-of select="normalize-space($raw_heading)"/>
+    </z:index>
   </xslo:template>
   <xslo:template mode="index_heading" match="marc:datafield[@tag='400']">
     <z:index name="Personal-name-see-from:w Personal-name-see-from:p Personal-name-see-from:s See-from:w See-from:p See-from:s">
@@ -235,6 +255,26 @@ authority-zebra-indexdefs.xsl` (substituting the appropriate file names).
       </xslo:variable>
       <xslo:value-of select="normalize-space($raw_heading)"/>
     </z:index>
+    <z:index name="Heading-Main:w Heading-Main:p Heading-Main:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('a', @code)" name="Heading-Main:w Heading-Main:p Heading-Main:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('', @code)">
+                  <xslo:text>--</xslo:text>
+                </xslo:when>
+                <xslo:otherwise>
+                  <xslo:value-of select="substring(' ', 1, 1)"/>
+                </xslo:otherwise>
+              </xslo:choose>
+            </xslo:if>
+            <xslo:value-of select="."/>
+          </xslo:if>
+        </xslo:for-each>
+      </xslo:variable>
+      <xslo:value-of select="normalize-space($raw_heading)"/>
+    </z:index>
   </xslo:template>
   <xslo:template mode="index_heading" match="marc:datafield[@tag='410']">
     <z:index name="Corporate-name-see-from:w Corporate-name-see-from:p Corporate-name-see-from:s See-from:w See-from:p See-from:s">
@@ -301,6 +341,26 @@ authority-zebra-indexdefs.xsl` (substituting the appropriate file names).
       </xslo:variable>
       <xslo:value-of select="normalize-space($raw_heading)"/>
     </z:index>
+    <z:index name="Heading-Main:w Heading-Main:p Heading-Main:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('a', @code)" name="Heading-Main:w Heading-Main:p Heading-Main:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('', @code)">
+                  <xslo:text>--</xslo:text>
+                </xslo:when>
+                <xslo:otherwise>
+                  <xslo:value-of select="substring(' ', 1, 1)"/>
+                </xslo:otherwise>
+              </xslo:choose>
+            </xslo:if>
+            <xslo:value-of select="."/>
+          </xslo:if>
+        </xslo:for-each>
+      </xslo:variable>
+      <xslo:value-of select="normalize-space($raw_heading)"/>
+    </z:index>
   </xslo:template>
   <xslo:template mode="index_heading" match="marc:datafield[@tag='411']">
     <z:index name="Meeting-name-see-from:w Meeting-name-see-from:p Meeting-name-see-from:s See-from:w See-from:p See-from:s">
@@ -367,6 +427,26 @@ authority-zebra-indexdefs.xsl` (substituting the appropriate file names).
       </xslo:variable>
       <xslo:value-of select="normalize-space($raw_heading)"/>
     </z:index>
+    <z:index name="Heading-Main:w Heading-Main:p Heading-Main:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('a', @code)" name="Heading-Main:w Heading-Main:p Heading-Main:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('', @code)">
+                  <xslo:text>--</xslo:text>
+                </xslo:when>
+                <xslo:otherwise>
+                  <xslo:value-of select="substring(' ', 1, 1)"/>
+                </xslo:otherwise>
+              </xslo:choose>
+            </xslo:if>
+            <xslo:value-of select="."/>
+          </xslo:if>
+        </xslo:for-each>
+      </xslo:variable>
+      <xslo:value-of select="normalize-space($raw_heading)"/>
+    </z:index>
   </xslo:template>
   <xslo:template mode="index_heading" match="marc:datafield[@tag='430']">
     <z:index name="Title-uniform-see-from:w Title-uniform-see-from:p Title-uniform-see-from:s See-from:w See-from:p See-from:s">
@@ -433,6 +513,26 @@ authority-zebra-indexdefs.xsl` (substituting the appropriate file names).
       </xslo:variable>
       <xslo:value-of select="normalize-space($raw_heading)"/>
     </z:index>
+    <z:index name="Heading-Main:w Heading-Main:p Heading-Main:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('a', @code)" name="Heading-Main:w Heading-Main:p Heading-Main:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('', @code)">
+                  <xslo:text>--</xslo:text>
+                </xslo:when>
+                <xslo:otherwise>
+                  <xslo:value-of select="substring(' ', 1, 1)"/>
+                </xslo:otherwise>
+              </xslo:choose>
+            </xslo:if>
+            <xslo:value-of select="."/>
+          </xslo:if>
+        </xslo:for-each>
+      </xslo:variable>
+      <xslo:value-of select="normalize-space($raw_heading)"/>
+    </z:index>
   </xslo:template>
   <xslo:template mode="index_heading" match="marc:datafield[@tag='448']">
     <z:index name="Chronological-term-see-from:w Chronological-term-see-from:p Chronological-term-see-from:s See-from:w See-from:p See-from:s">
@@ -499,6 +599,26 @@ authority-zebra-indexdefs.xsl` (substituting the appropriate file names).
       </xslo:variable>
       <xslo:value-of select="normalize-space($raw_heading)"/>
     </z:index>
+    <z:index name="Heading-Main:w Heading-Main:p Heading-Main:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('a', @code)" name="Heading-Main:w Heading-Main:p Heading-Main:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('', @code)">
+                  <xslo:text>--</xslo:text>
+                </xslo:when>
+                <xslo:otherwise>
+                  <xslo:value-of select="substring(' ', 1, 1)"/>
+                </xslo:otherwise>
+              </xslo:choose>
+            </xslo:if>
+            <xslo:value-of select="."/>
+          </xslo:if>
+        </xslo:for-each>
+      </xslo:variable>
+      <xslo:value-of select="normalize-space($raw_heading)"/>
+    </z:index>
   </xslo:template>
   <xslo:template mode="index_heading" match="marc:datafield[@tag='450']">
     <z:index name="Subject-topical-see-from:w Subject-topical-see-from:p Subject-topical-see-from:s See-from:w See-from:p See-from:s">
@@ -565,6 +685,26 @@ authority-zebra-indexdefs.xsl` (substituting the appropriate file names).
       </xslo:variable>
       <xslo:value-of select="normalize-space($raw_heading)"/>
     </z:index>
+    <z:index name="Heading-Main:w Heading-Main:p Heading-Main:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('a', @code)" name="Heading-Main:w Heading-Main:p Heading-Main:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('', @code)">
+                  <xslo:text>--</xslo:text>
+                </xslo:when>
+                <xslo:otherwise>
+                  <xslo:value-of select="substring(' ', 1, 1)"/>
+                </xslo:otherwise>
+              </xslo:choose>
+            </xslo:if>
+            <xslo:value-of select="."/>
+          </xslo:if>
+        </xslo:for-each>
+      </xslo:variable>
+      <xslo:value-of select="normalize-space($raw_heading)"/>
+    </z:index>
   </xslo:template>
   <xslo:template mode="index_heading" match="marc:datafield[@tag='451']">
     <z:index name="Name-geographic-see-from:w Name-geographic-see-from:p Name-geographic-see-from:s See-from:w See-from:p See-from:s">
@@ -631,6 +771,26 @@ authority-zebra-indexdefs.xsl` (substituting the appropriate file names).
       </xslo:variable>
       <xslo:value-of select="normalize-space($raw_heading)"/>
     </z:index>
+    <z:index name="Heading-Main:w Heading-Main:p Heading-Main:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('a', @code)" name="Heading-Main:w Heading-Main:p Heading-Main:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('', @code)">
+                  <xslo:text>--</xslo:text>
+                </xslo:when>
+                <xslo:otherwise>
+                  <xslo:value-of select="substring(' ', 1, 1)"/>
+                </xslo:otherwise>
+              </xslo:choose>
+            </xslo:if>
+            <xslo:value-of select="."/>
+          </xslo:if>
+        </xslo:for-each>
+      </xslo:variable>
+      <xslo:value-of select="normalize-space($raw_heading)"/>
+    </z:index>
   </xslo:template>
   <xslo:template mode="index_heading" match="marc:datafield[@tag='455']">
     <z:index name="Term-genre-form-see-from:w Term-genre-form-see-from:p Term-genre-form-see-from:s See-from:w See-from:p See-from:s">
@@ -1834,4 +1994,9 @@ authority-zebra-indexdefs.xsl` (substituting the appropriate file names).
       <xslo:value-of select="$full_thesaurus_code"/>
     </z:index>
   </xslo:template>
+  <xslo:template match="*">
+    <z:index name="Any:w Any:p">
+      <xslo:value-of select="."/>
+    </z:index>
+  </xslo:template>
 </xslo:stylesheet>
index edaa9d4..66bf816 100644 (file)
@@ -62,6 +62,11 @@ authority-zebra-indexdefs.xsl` (substituting the appropriate file names).
             <xsl:call-template name="handle-index-heading"/>
             <xsl:call-template name="handle-index-match-heading"/>
             <xsl:apply-templates/>
+            <xslo:template match="*">
+                <z:index name="Any:w Any:p">
+                    <xslo:value-of select="."/>
+                </z:index>
+            </xslo:template>
         </xslo:stylesheet>
     </xsl:template>