authorities: changed extension of authority-zebra-indexdefs.xml
authorGalen Charlton <galen.charlton@liblime.com>
Thu, 31 Jan 2008 19:43:16 +0000 (13:43 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Sun, 3 Feb 2008 13:22:12 +0000 (07:22 -0600)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xml [deleted file]
etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl [new file with mode: 0644]

diff --git a/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xml b/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xml
deleted file mode 100644 (file)
index f1c4dc7..0000000
+++ /dev/null
@@ -1,983 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xslo:stylesheet xmlns:xslo="http://www.w3.org/1999/XSL/Transform" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:z="http://indexdata.com/zebra-2.0" xmlns:kohaidx="http://www.koha.org/schemas/index-defs" version="1.0">
-  <xslo:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
-  <xslo:template match="text()"/>
-  <xslo:template match="text()" mode="index_subfields"/>
-  <xslo:template match="text()" mode="index_heading"/>
-  <xslo:template match="text()" mode="index_subject_thesaurus"/>
-  <xslo:template match="/">
-    <xslo:if test="marc:collection">
-      <collection>
-        <xslo:apply-templates select="marc:collection/marc:record"/>
-      </collection>
-    </xslo:if>
-    <xslo:if test="marc:record">
-      <xslo:apply-templates select="marc:record"/>
-    </xslo:if>
-  </xslo:template>
-  <xslo:template match="marc:record">
-    <xslo:variable name="controlField001" select="normalize-space(marc:controlfield[@tag='001'])"/>
-    <z:record type="update">
-      <xslo:attribute name="z:id">
-        <xslo:value-of select="$controlField001"/>
-      </xslo:attribute>
-      <xslo:apply-templates/>
-      <xslo:apply-templates mode="index_subfields"/>
-      <xslo:apply-templates mode="index_heading"/>
-      <xslo:apply-templates mode="index_subject_thesaurus"/>
-    </z:record>
-  </xslo:template>
-  <xslo:template match="marc:leader">
-    <z:index name="Record-status">
-      <xslo:value-of select="substring(., 6, 1)"/>
-    </z:index>
-    <z:index name="Encoding-level">
-      <xslo:value-of select="substring(., 18, 1)"/>
-    </z:index>
-  </xslo:template>
-  <xslo:template match="marc:controlfield[@tag='001']">
-    <z:index name="Local-Number">
-      <xslo:value-of select="."/>
-    </z:index>
-  </xslo:template>
-  <xslo:template match="marc:controlfield[@tag='008']">
-    <z:index name="Kind-of-record">
-      <xslo:value-of select="substring(., 10, 1)"/>
-    </z:index>
-    <z:index name="Descriptive-cataloging-rules">
-      <xslo:value-of select="substring(., 11, 1)"/>
-    </z:index>
-    <z:index name="Heading-use-main-or-added-entry">
-      <xslo:value-of select="substring(., 15, 1)"/>
-    </z:index>
-    <z:index name="Heading-use-subject-added-entry">
-      <xslo:value-of select="substring(., 16, 1)"/>
-    </z:index>
-    <z:index name="Heading-use-series-added-entry">
-      <xslo:value-of select="substring(., 17, 1)"/>
-    </z:index>
-  </xslo:template>
-  <xslo:template mode="index_subfields" match="marc:datafield[@tag='100']">
-    <xslo:for-each select="marc:subfield">
-      <xslo:if test="contains('abcdefghjklmnopqrstvxyz', @code)">
-        <z:index name="Personal-name:w Personal-name:p Personal-name:s">
-          <xslo:value-of select="."/>
-        </z:index>
-      </xslo:if>
-    </xslo:for-each>
-  </xslo:template>
-  <xslo:template mode="index_subfields" match="marc:datafield[@tag='110']">
-    <xslo:for-each select="marc:subfield">
-      <xslo:if test="contains('abcdefghklmnoprstvxyz', @code)">
-        <z:index name="Corporate-name:w Corporate-name:p">
-          <xslo:value-of select="."/>
-        </z:index>
-      </xslo:if>
-    </xslo:for-each>
-  </xslo:template>
-  <xslo:template mode="index_subfields" match="marc:datafield[@tag='111']">
-    <xslo:for-each select="marc:subfield">
-      <xslo:if test="contains('acdefghjklnpqstvxyz', @code)">
-        <z:index name="Meeting-name:w Meeting-name:p">
-          <xslo:value-of select="."/>
-        </z:index>
-      </xslo:if>
-    </xslo:for-each>
-  </xslo:template>
-  <xslo:template mode="index_subfields" match="marc:datafield[@tag='130']">
-    <xslo:for-each select="marc:subfield">
-      <xslo:if test="contains('adfghklmnoprstvxyz', @code)">
-        <z:index name="Title-uniform:w Title-uniform:p">
-          <xslo:value-of select="."/>
-        </z:index>
-      </xslo:if>
-    </xslo:for-each>
-  </xslo:template>
-  <xslo:template mode="index_subfields" match="marc:datafield[@tag='148']">
-    <xslo:for-each select="marc:subfield">
-      <xslo:if test="contains('avxyz', @code)">
-        <z:index name="Chronological-term:w Chronological-term:p">
-          <xslo:value-of select="."/>
-        </z:index>
-      </xslo:if>
-    </xslo:for-each>
-  </xslo:template>
-  <xslo:template mode="index_subfields" match="marc:datafield[@tag='150']">
-    <xslo:for-each select="marc:subfield">
-      <xslo:if test="contains('abvxyz', @code)">
-        <z:index name="Subject-topical:w Subject-topical:p">
-          <xslo:value-of select="."/>
-        </z:index>
-      </xslo:if>
-    </xslo:for-each>
-  </xslo:template>
-  <xslo:template mode="index_subfields" match="marc:datafield[@tag='151']">
-    <xslo:for-each select="marc:subfield">
-      <xslo:if test="contains('avxyz', @code)">
-        <z:index name="Name-geographic:w Name-geographic:p">
-          <xslo:value-of select="."/>
-        </z:index>
-      </xslo:if>
-    </xslo:for-each>
-  </xslo:template>
-  <xslo:template mode="index_subfields" match="marc:datafield[@tag='155']">
-    <xslo:for-each select="marc:subfield">
-      <xslo:if test="contains('avxyz', @code)">
-        <z:index name="Term-genre-form:w Term-genre-form:p">
-          <xslo:value-of select="."/>
-        </z:index>
-      </xslo:if>
-    </xslo:for-each>
-  </xslo:template>
-  <xslo:template mode="index_subfields" match="marc:datafield[@tag='942']">
-    <xslo:for-each select="marc:subfield">
-      <xslo:if test="contains('a', @code)">
-        <z:index name="authtype">
-          <xslo:value-of select="."/>
-        </z:index>
-      </xslo:if>
-    </xslo:for-each>
-  </xslo:template>
-  <xslo:template mode="index_heading" match="marc:datafield[@tag='100']">
-    <z:index name="Personal-name-heading:w Personal-name-heading:p Personal-name-heading:s Heading:w Heading:p Heading:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('abcdefghjklmnopqrstvxyz', @code)" name="Personal-name-heading:w Personal-name-heading:p Personal-name-heading:s Heading:w Heading:p Heading:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('abcdefghjklmnopqrstvxyz', @code)" 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">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='500']">
-    <z:index name="Personal-name-see-also-from:w Personal-name-see-also-from:p Personal-name-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('abcdefghjklmnopqrstvxyz', @code)" name="Personal-name-see-also-from:w Personal-name-see-also-from:p Personal-name-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='110']">
-    <z:index name="Corporate-name-heading:w Corporate-name-heading:p Corporate-name-heading:s Heading:w Heading:p Heading:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('abcdefghklmnoprstvxyz', @code)" name="Corporate-name-heading:w Corporate-name-heading:p Corporate-name-heading:s Heading:w Heading:p Heading:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('abcdefghklmnoprstvxyz', @code)" 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">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='510']">
-    <z:index name="Corporate-name-see-also-from:w Corporate-name-see-also-from:p Corporate-name-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('abcdefghklmnoprstvxyz', @code)" name="Corporate-name-see-also-from:w Corporate-name-see-also-from:p Corporate-name-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='111']">
-    <z:index name="Meeting-name-heading:w Meeting-name-heading:p Meeting-name-heading:s Heading:w Heading:p Heading:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('acdefghjklnpqstvxyz', @code)" name="Meeting-name-heading:w Meeting-name-heading:p Meeting-name-heading:s Heading:w Heading:p Heading:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('acdefghjklnpqstvxyz', @code)" 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">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='511']">
-    <z:index name="Meeting-name-see-also-from:w Meeting-name-see-also-from:p Meeting-name-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('acdefghjklnpqstvxyz', @code)" name="Meeting-name-see-also-from:w Meeting-name-see-also-from:p Meeting-name-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='130']">
-    <z:index name="Title-uniform-heading:w Title-uniform-heading:p Title-uniform-heading:s Heading:w Heading:p Heading:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('adfghklmnoprstvxyz', @code)" name="Title-uniform-heading:w Title-uniform-heading:p Title-uniform-heading:s Heading:w Heading:p Heading:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('adfghklmnoprstvxyz', @code)" 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">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='530']">
-    <z:index name="Title-uniform-see-also-from:w Title-uniform-see-also-from:p Title-uniform-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('adfghklmnoprstvxyz', @code)" name="Title-uniform-see-also-from:w Title-uniform-see-also-from:p Title-uniform-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='148']">
-    <z:index name="Chronological-term-heading:w Chronological-term-heading:p Chronological-term-heading:s Heading:w Heading:p Heading:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('avxyz', @code)" name="Chronological-term-heading:w Chronological-term-heading:p Chronological-term-heading:s Heading:w Heading:p Heading:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('avxyz', @code)" 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">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='548']">
-    <z:index name="Chronological-term-see-also-from:w Chronological-term-see-also-from:p Chronological-term-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('avxyz', @code)" name="Chronological-term-see-also-from:w Chronological-term-see-also-from:p Chronological-term-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='150']">
-    <z:index name="Subject-topical-heading:w Subject-topical-heading:p Subject-topical-heading:s Heading:w Heading:p Heading:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('abvxyz', @code)" name="Subject-topical-heading:w Subject-topical-heading:p Subject-topical-heading:s Heading:w Heading:p Heading:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('abvxyz', @code)" 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">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='550']">
-    <z:index name="Subject-topical-see-also-from:w Subject-topical-see-also-from:p Subject-topical-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('abvxyz', @code)" name="Subject-topical-see-also-from:w Subject-topical-see-also-from:p Subject-topical-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='151']">
-    <z:index name="Name-geographic-heading:w Name-geographic-heading:p Name-geographic-heading:s Heading:w Heading:p Heading:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('avxyz', @code)" name="Name-geographic-heading:w Name-geographic-heading:p Name-geographic-heading:s Heading:w Heading:p Heading:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('avxyz', @code)" 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">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='551']">
-    <z:index name="Name-geographic-see-also-from:w Name-geographic-see-also-from:p Name-geographic-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('avxyz', @code)" name="Name-geographic-see-also-from:w Name-geographic-see-also-from:p Name-geographic-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='155']">
-    <z:index name="Term-genre-form-heading:w Term-genre-form-heading:p Term-genre-form-heading:s Heading:w Heading:p Heading:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('avxyz', @code)" name="Term-genre-form-heading:w Term-genre-form-heading:p Term-genre-form-heading:s Heading:w Heading:p Heading:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('avxyz', @code)" 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">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='555']">
-    <z:index name="Term-genre-form-see-also-from:w Term-genre-form-see-also-from:p Term-genre-form-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('avxyz', @code)" name="Term-genre-form-see-also-from:w Term-genre-form-see-also-from:p Term-genre-form-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='180']">
-    <z:index name="General-subdivision:w General-subdivision:p General-subdivision:s Subdivision:w Subdivision:p Subdivision:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('vxyz', @code)" name="General-subdivision:w General-subdivision:p General-subdivision:s Subdivision:w Subdivision:p Subdivision:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='480']">
-    <z:index name="General-subdivision-see-from:w General-subdivision-see-from:p General-subdivision-see-from:s Subdivision-see-from:w Subdivision-see-from:p Subdivision-see-from:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('vxyz', @code)" name="General-subdivision-see-from:w General-subdivision-see-from:p General-subdivision-see-from:s Subdivision-see-from:w Subdivision-see-from:p Subdivision-see-from:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='580']">
-    <z:index name="General-subdivision-see-also-from:w General-subdivision-see-also-from:p General-subdivision-see-also-from:s Subdivision-see-also-from:w Subdivision-see-also-from:p Subdivision-see-also-from:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('vxyz', @code)" name="General-subdivision-see-also-from:w General-subdivision-see-also-from:p General-subdivision-see-also-from:s Subdivision-see-also-from:w Subdivision-see-also-from:p Subdivision-see-also-from:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='181']">
-    <z:index name="Geographic-subdivision:w Geographic-subdivision:p Geographic-subdivision:s Subdivision:w Subdivision:p Subdivision:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('vxyz', @code)" name="Geographic-subdivision:w Geographic-subdivision:p Geographic-subdivision:s Subdivision:w Subdivision:p Subdivision:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='481']">
-    <z:index name="Geographic-subdivision-see-from:w Geographic-subdivision-see-from:p Geographic-subdivision-see-from:s Subdivision-see-from:w Subdivision-see-from:p Subdivision-see-from:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('vxyz', @code)" name="Geographic-subdivision-see-from:w Geographic-subdivision-see-from:p Geographic-subdivision-see-from:s Subdivision-see-from:w Subdivision-see-from:p Subdivision-see-from:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='581']">
-    <z:index name="Geographic-subdivision-see-also-from:w Geographic-subdivision-see-also-from:p Geographic-subdivision-see-also-from:s Subdivision-see-also-from:w Subdivision-see-also-from:p Subdivision-see-also-from:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('vxyz', @code)" name="Geographic-subdivision-see-also-from:w Geographic-subdivision-see-also-from:p Geographic-subdivision-see-also-from:s Subdivision-see-also-from:w Subdivision-see-also-from:p Subdivision-see-also-from:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='182']">
-    <z:index name="Chronological-subdivision:w Chronological-subdivision:p Chronological-subdivision:s Subdivision:w Subdivision:p Subdivision:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('vxyz', @code)" name="Chronological-subdivision:w Chronological-subdivision:p Chronological-subdivision:s Subdivision:w Subdivision:p Subdivision:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='482']">
-    <z:index name="Chronological-subdivision-see-from:w Chronological-subdivision-see-from:p Chronological-subdivision-see-from:s Subdivision-see-from:w Subdivision-see-from:p Subdivision-see-from:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('vxyz', @code)" name="Chronological-subdivision-see-from:w Chronological-subdivision-see-from:p Chronological-subdivision-see-from:s Subdivision-see-from:w Subdivision-see-from:p Subdivision-see-from:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='582']">
-    <z:index name="Chronological-subdivision-see-also-from:w Chronological-subdivision-see-also-from:p Chronological-subdivision-see-also-from:s Subdivision-see-also-from:w Subdivision-see-also-from:p Subdivision-see-also-from:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('vxyz', @code)" name="Chronological-subdivision-see-also-from:w Chronological-subdivision-see-also-from:p Chronological-subdivision-see-also-from:s Subdivision-see-also-from:w Subdivision-see-also-from:p Subdivision-see-also-from:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='185']">
-    <z:index name="Form-subdivision:w Form-subdivision:p Form-subdivision:s Subdivision:w Subdivision:p Subdivision:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('vxyz', @code)" name="Form-subdivision:w Form-subdivision:p Form-subdivision:s Subdivision:w Subdivision:p Subdivision:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='485']">
-    <z:index name="Form-subdivision-see-from:w Form-subdivision-see-from:p Form-subdivision-see-from:s Subdivision-see-from:w Subdivision-see-from:p Subdivision-see-from:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('vxyz', @code)" name="Form-subdivision-see-from:w Form-subdivision-see-from:p Form-subdivision-see-from:s Subdivision-see-from:w Subdivision-see-from:p Subdivision-see-from:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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='585']">
-    <z:index name="Form-subdivision-see-also-from:w Form-subdivision-see-also-from:p Form-subdivision-see-also-from:s Subdivision-see-also-from:w Subdivision-see-also-from:p Subdivision-see-also-from:s">
-      <xslo:variable name="raw_heading">
-        <xslo:for-each select="marc:subfield">
-          <xslo:if test="contains('vxyz', @code)" name="Form-subdivision-see-also-from:w Form-subdivision-see-also-from:p Form-subdivision-see-also-from:s Subdivision-see-also-from:w Subdivision-see-also-from:p Subdivision-see-also-from:s">
-            <xslo:if test="position() &gt; 1">
-              <xslo:choose>
-                <xslo:when test="contains('vxyz', @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_subject_thesaurus" match="marc:controlfield[@tag='008']">
-    <xslo:variable name="thesaurus_code1" select="substring(., 12, 1)"/>
-    <xslo:variable name="full_thesaurus_code">
-      <xslo:choose>
-        <xslo:when test="$thesaurus_code1 = 'a'">
-          <xslo:text>lcsh</xslo:text>
-        </xslo:when>
-        <xslo:when test="$thesaurus_code1 = 'b'">
-          <xslo:text>lcac</xslo:text>
-        </xslo:when>
-        <xslo:when test="$thesaurus_code1 = 'c'">
-          <xslo:text>mesh</xslo:text>
-        </xslo:when>
-        <xslo:when test="$thesaurus_code1 = 'd'">
-          <xslo:text>nal</xslo:text>
-        </xslo:when>
-        <xslo:when test="$thesaurus_code1 = 'k'">
-          <xslo:text>cash</xslo:text>
-        </xslo:when>
-        <xslo:when test="$thesaurus_code1 = 'n'">
-          <xslo:text>notapplicable</xslo:text>
-        </xslo:when>
-        <xslo:when test="$thesaurus_code1 = 'r'">
-          <xslo:text>aat</xslo:text>
-        </xslo:when>
-        <xslo:when test="$thesaurus_code1 = 's'">
-          <xslo:text>sears</xslo:text>
-        </xslo:when>
-        <xslo:when test="$thesaurus_code1 = 'v'">
-          <xslo:text>rvm</xslo:text>
-        </xslo:when>
-        <xslo:when test="$thesaurus_code1 = 'z'">
-          <xslo:choose>
-            <xslo:when test="//marc:datafield[@tag='040']/marc:subfield[@code='f']">
-              <xslo:value-of select="//marc:datafield[@tag='040']/marc:subfield[@code='f']"/>
-            </xslo:when>
-            <xslo:otherwise>
-              <xslo:text>notdefined</xslo:text>
-            </xslo:otherwise>
-          </xslo:choose>
-        </xslo:when>
-        <xslo:otherwise>
-          <xslo:text>notdefined</xslo:text>
-        </xslo:otherwise>
-      </xslo:choose>
-    </xslo:variable>
-    <z:index name="Subject-heading-thesaurus">
-      <xslo:value-of select="$full_thesaurus_code"/>
-    </z:index>
-  </xslo:template>
-</xslo:stylesheet>
diff --git a/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl b/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl
new file mode 100644 (file)
index 0000000..f1c4dc7
--- /dev/null
@@ -0,0 +1,983 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xslo:stylesheet xmlns:xslo="http://www.w3.org/1999/XSL/Transform" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:z="http://indexdata.com/zebra-2.0" xmlns:kohaidx="http://www.koha.org/schemas/index-defs" version="1.0">
+  <xslo:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
+  <xslo:template match="text()"/>
+  <xslo:template match="text()" mode="index_subfields"/>
+  <xslo:template match="text()" mode="index_heading"/>
+  <xslo:template match="text()" mode="index_subject_thesaurus"/>
+  <xslo:template match="/">
+    <xslo:if test="marc:collection">
+      <collection>
+        <xslo:apply-templates select="marc:collection/marc:record"/>
+      </collection>
+    </xslo:if>
+    <xslo:if test="marc:record">
+      <xslo:apply-templates select="marc:record"/>
+    </xslo:if>
+  </xslo:template>
+  <xslo:template match="marc:record">
+    <xslo:variable name="controlField001" select="normalize-space(marc:controlfield[@tag='001'])"/>
+    <z:record type="update">
+      <xslo:attribute name="z:id">
+        <xslo:value-of select="$controlField001"/>
+      </xslo:attribute>
+      <xslo:apply-templates/>
+      <xslo:apply-templates mode="index_subfields"/>
+      <xslo:apply-templates mode="index_heading"/>
+      <xslo:apply-templates mode="index_subject_thesaurus"/>
+    </z:record>
+  </xslo:template>
+  <xslo:template match="marc:leader">
+    <z:index name="Record-status">
+      <xslo:value-of select="substring(., 6, 1)"/>
+    </z:index>
+    <z:index name="Encoding-level">
+      <xslo:value-of select="substring(., 18, 1)"/>
+    </z:index>
+  </xslo:template>
+  <xslo:template match="marc:controlfield[@tag='001']">
+    <z:index name="Local-Number">
+      <xslo:value-of select="."/>
+    </z:index>
+  </xslo:template>
+  <xslo:template match="marc:controlfield[@tag='008']">
+    <z:index name="Kind-of-record">
+      <xslo:value-of select="substring(., 10, 1)"/>
+    </z:index>
+    <z:index name="Descriptive-cataloging-rules">
+      <xslo:value-of select="substring(., 11, 1)"/>
+    </z:index>
+    <z:index name="Heading-use-main-or-added-entry">
+      <xslo:value-of select="substring(., 15, 1)"/>
+    </z:index>
+    <z:index name="Heading-use-subject-added-entry">
+      <xslo:value-of select="substring(., 16, 1)"/>
+    </z:index>
+    <z:index name="Heading-use-series-added-entry">
+      <xslo:value-of select="substring(., 17, 1)"/>
+    </z:index>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='100']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('abcdefghjklmnopqrstvxyz', @code)">
+        <z:index name="Personal-name:w Personal-name:p Personal-name:s">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='110']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('abcdefghklmnoprstvxyz', @code)">
+        <z:index name="Corporate-name:w Corporate-name:p">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='111']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('acdefghjklnpqstvxyz', @code)">
+        <z:index name="Meeting-name:w Meeting-name:p">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='130']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('adfghklmnoprstvxyz', @code)">
+        <z:index name="Title-uniform:w Title-uniform:p">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='148']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('avxyz', @code)">
+        <z:index name="Chronological-term:w Chronological-term:p">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='150']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('abvxyz', @code)">
+        <z:index name="Subject-topical:w Subject-topical:p">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='151']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('avxyz', @code)">
+        <z:index name="Name-geographic:w Name-geographic:p">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='155']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('avxyz', @code)">
+        <z:index name="Term-genre-form:w Term-genre-form:p">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_subfields" match="marc:datafield[@tag='942']">
+    <xslo:for-each select="marc:subfield">
+      <xslo:if test="contains('a', @code)">
+        <z:index name="authtype">
+          <xslo:value-of select="."/>
+        </z:index>
+      </xslo:if>
+    </xslo:for-each>
+  </xslo:template>
+  <xslo:template mode="index_heading" match="marc:datafield[@tag='100']">
+    <z:index name="Personal-name-heading:w Personal-name-heading:p Personal-name-heading:s Heading:w Heading:p Heading:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('abcdefghjklmnopqrstvxyz', @code)" name="Personal-name-heading:w Personal-name-heading:p Personal-name-heading:s Heading:w Heading:p Heading:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('abcdefghjklmnopqrstvxyz', @code)" 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">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='500']">
+    <z:index name="Personal-name-see-also-from:w Personal-name-see-also-from:p Personal-name-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('abcdefghjklmnopqrstvxyz', @code)" name="Personal-name-see-also-from:w Personal-name-see-also-from:p Personal-name-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='110']">
+    <z:index name="Corporate-name-heading:w Corporate-name-heading:p Corporate-name-heading:s Heading:w Heading:p Heading:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('abcdefghklmnoprstvxyz', @code)" name="Corporate-name-heading:w Corporate-name-heading:p Corporate-name-heading:s Heading:w Heading:p Heading:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('abcdefghklmnoprstvxyz', @code)" 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">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='510']">
+    <z:index name="Corporate-name-see-also-from:w Corporate-name-see-also-from:p Corporate-name-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('abcdefghklmnoprstvxyz', @code)" name="Corporate-name-see-also-from:w Corporate-name-see-also-from:p Corporate-name-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='111']">
+    <z:index name="Meeting-name-heading:w Meeting-name-heading:p Meeting-name-heading:s Heading:w Heading:p Heading:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('acdefghjklnpqstvxyz', @code)" name="Meeting-name-heading:w Meeting-name-heading:p Meeting-name-heading:s Heading:w Heading:p Heading:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('acdefghjklnpqstvxyz', @code)" 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">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='511']">
+    <z:index name="Meeting-name-see-also-from:w Meeting-name-see-also-from:p Meeting-name-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('acdefghjklnpqstvxyz', @code)" name="Meeting-name-see-also-from:w Meeting-name-see-also-from:p Meeting-name-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='130']">
+    <z:index name="Title-uniform-heading:w Title-uniform-heading:p Title-uniform-heading:s Heading:w Heading:p Heading:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('adfghklmnoprstvxyz', @code)" name="Title-uniform-heading:w Title-uniform-heading:p Title-uniform-heading:s Heading:w Heading:p Heading:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('adfghklmnoprstvxyz', @code)" 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">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='530']">
+    <z:index name="Title-uniform-see-also-from:w Title-uniform-see-also-from:p Title-uniform-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('adfghklmnoprstvxyz', @code)" name="Title-uniform-see-also-from:w Title-uniform-see-also-from:p Title-uniform-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='148']">
+    <z:index name="Chronological-term-heading:w Chronological-term-heading:p Chronological-term-heading:s Heading:w Heading:p Heading:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('avxyz', @code)" name="Chronological-term-heading:w Chronological-term-heading:p Chronological-term-heading:s Heading:w Heading:p Heading:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('avxyz', @code)" 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">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='548']">
+    <z:index name="Chronological-term-see-also-from:w Chronological-term-see-also-from:p Chronological-term-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('avxyz', @code)" name="Chronological-term-see-also-from:w Chronological-term-see-also-from:p Chronological-term-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='150']">
+    <z:index name="Subject-topical-heading:w Subject-topical-heading:p Subject-topical-heading:s Heading:w Heading:p Heading:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('abvxyz', @code)" name="Subject-topical-heading:w Subject-topical-heading:p Subject-topical-heading:s Heading:w Heading:p Heading:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('abvxyz', @code)" 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">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='550']">
+    <z:index name="Subject-topical-see-also-from:w Subject-topical-see-also-from:p Subject-topical-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('abvxyz', @code)" name="Subject-topical-see-also-from:w Subject-topical-see-also-from:p Subject-topical-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='151']">
+    <z:index name="Name-geographic-heading:w Name-geographic-heading:p Name-geographic-heading:s Heading:w Heading:p Heading:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('avxyz', @code)" name="Name-geographic-heading:w Name-geographic-heading:p Name-geographic-heading:s Heading:w Heading:p Heading:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('avxyz', @code)" 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">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='551']">
+    <z:index name="Name-geographic-see-also-from:w Name-geographic-see-also-from:p Name-geographic-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('avxyz', @code)" name="Name-geographic-see-also-from:w Name-geographic-see-also-from:p Name-geographic-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='155']">
+    <z:index name="Term-genre-form-heading:w Term-genre-form-heading:p Term-genre-form-heading:s Heading:w Heading:p Heading:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('avxyz', @code)" name="Term-genre-form-heading:w Term-genre-form-heading:p Term-genre-form-heading:s Heading:w Heading:p Heading:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('avxyz', @code)" 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">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='555']">
+    <z:index name="Term-genre-form-see-also-from:w Term-genre-form-see-also-from:p Term-genre-form-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('avxyz', @code)" name="Term-genre-form-see-also-from:w Term-genre-form-see-also-from:p Term-genre-form-see-also-from:s See-also-from:w See-also-from:p See-also-from:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='180']">
+    <z:index name="General-subdivision:w General-subdivision:p General-subdivision:s Subdivision:w Subdivision:p Subdivision:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('vxyz', @code)" name="General-subdivision:w General-subdivision:p General-subdivision:s Subdivision:w Subdivision:p Subdivision:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='480']">
+    <z:index name="General-subdivision-see-from:w General-subdivision-see-from:p General-subdivision-see-from:s Subdivision-see-from:w Subdivision-see-from:p Subdivision-see-from:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('vxyz', @code)" name="General-subdivision-see-from:w General-subdivision-see-from:p General-subdivision-see-from:s Subdivision-see-from:w Subdivision-see-from:p Subdivision-see-from:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='580']">
+    <z:index name="General-subdivision-see-also-from:w General-subdivision-see-also-from:p General-subdivision-see-also-from:s Subdivision-see-also-from:w Subdivision-see-also-from:p Subdivision-see-also-from:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('vxyz', @code)" name="General-subdivision-see-also-from:w General-subdivision-see-also-from:p General-subdivision-see-also-from:s Subdivision-see-also-from:w Subdivision-see-also-from:p Subdivision-see-also-from:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='181']">
+    <z:index name="Geographic-subdivision:w Geographic-subdivision:p Geographic-subdivision:s Subdivision:w Subdivision:p Subdivision:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('vxyz', @code)" name="Geographic-subdivision:w Geographic-subdivision:p Geographic-subdivision:s Subdivision:w Subdivision:p Subdivision:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='481']">
+    <z:index name="Geographic-subdivision-see-from:w Geographic-subdivision-see-from:p Geographic-subdivision-see-from:s Subdivision-see-from:w Subdivision-see-from:p Subdivision-see-from:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('vxyz', @code)" name="Geographic-subdivision-see-from:w Geographic-subdivision-see-from:p Geographic-subdivision-see-from:s Subdivision-see-from:w Subdivision-see-from:p Subdivision-see-from:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='581']">
+    <z:index name="Geographic-subdivision-see-also-from:w Geographic-subdivision-see-also-from:p Geographic-subdivision-see-also-from:s Subdivision-see-also-from:w Subdivision-see-also-from:p Subdivision-see-also-from:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('vxyz', @code)" name="Geographic-subdivision-see-also-from:w Geographic-subdivision-see-also-from:p Geographic-subdivision-see-also-from:s Subdivision-see-also-from:w Subdivision-see-also-from:p Subdivision-see-also-from:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='182']">
+    <z:index name="Chronological-subdivision:w Chronological-subdivision:p Chronological-subdivision:s Subdivision:w Subdivision:p Subdivision:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('vxyz', @code)" name="Chronological-subdivision:w Chronological-subdivision:p Chronological-subdivision:s Subdivision:w Subdivision:p Subdivision:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='482']">
+    <z:index name="Chronological-subdivision-see-from:w Chronological-subdivision-see-from:p Chronological-subdivision-see-from:s Subdivision-see-from:w Subdivision-see-from:p Subdivision-see-from:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('vxyz', @code)" name="Chronological-subdivision-see-from:w Chronological-subdivision-see-from:p Chronological-subdivision-see-from:s Subdivision-see-from:w Subdivision-see-from:p Subdivision-see-from:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='582']">
+    <z:index name="Chronological-subdivision-see-also-from:w Chronological-subdivision-see-also-from:p Chronological-subdivision-see-also-from:s Subdivision-see-also-from:w Subdivision-see-also-from:p Subdivision-see-also-from:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('vxyz', @code)" name="Chronological-subdivision-see-also-from:w Chronological-subdivision-see-also-from:p Chronological-subdivision-see-also-from:s Subdivision-see-also-from:w Subdivision-see-also-from:p Subdivision-see-also-from:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='185']">
+    <z:index name="Form-subdivision:w Form-subdivision:p Form-subdivision:s Subdivision:w Subdivision:p Subdivision:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('vxyz', @code)" name="Form-subdivision:w Form-subdivision:p Form-subdivision:s Subdivision:w Subdivision:p Subdivision:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='485']">
+    <z:index name="Form-subdivision-see-from:w Form-subdivision-see-from:p Form-subdivision-see-from:s Subdivision-see-from:w Subdivision-see-from:p Subdivision-see-from:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('vxyz', @code)" name="Form-subdivision-see-from:w Form-subdivision-see-from:p Form-subdivision-see-from:s Subdivision-see-from:w Subdivision-see-from:p Subdivision-see-from:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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='585']">
+    <z:index name="Form-subdivision-see-also-from:w Form-subdivision-see-also-from:p Form-subdivision-see-also-from:s Subdivision-see-also-from:w Subdivision-see-also-from:p Subdivision-see-also-from:s">
+      <xslo:variable name="raw_heading">
+        <xslo:for-each select="marc:subfield">
+          <xslo:if test="contains('vxyz', @code)" name="Form-subdivision-see-also-from:w Form-subdivision-see-also-from:p Form-subdivision-see-also-from:s Subdivision-see-also-from:w Subdivision-see-also-from:p Subdivision-see-also-from:s">
+            <xslo:if test="position() &gt; 1">
+              <xslo:choose>
+                <xslo:when test="contains('vxyz', @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_subject_thesaurus" match="marc:controlfield[@tag='008']">
+    <xslo:variable name="thesaurus_code1" select="substring(., 12, 1)"/>
+    <xslo:variable name="full_thesaurus_code">
+      <xslo:choose>
+        <xslo:when test="$thesaurus_code1 = 'a'">
+          <xslo:text>lcsh</xslo:text>
+        </xslo:when>
+        <xslo:when test="$thesaurus_code1 = 'b'">
+          <xslo:text>lcac</xslo:text>
+        </xslo:when>
+        <xslo:when test="$thesaurus_code1 = 'c'">
+          <xslo:text>mesh</xslo:text>
+        </xslo:when>
+        <xslo:when test="$thesaurus_code1 = 'd'">
+          <xslo:text>nal</xslo:text>
+        </xslo:when>
+        <xslo:when test="$thesaurus_code1 = 'k'">
+          <xslo:text>cash</xslo:text>
+        </xslo:when>
+        <xslo:when test="$thesaurus_code1 = 'n'">
+          <xslo:text>notapplicable</xslo:text>
+        </xslo:when>
+        <xslo:when test="$thesaurus_code1 = 'r'">
+          <xslo:text>aat</xslo:text>
+        </xslo:when>
+        <xslo:when test="$thesaurus_code1 = 's'">
+          <xslo:text>sears</xslo:text>
+        </xslo:when>
+        <xslo:when test="$thesaurus_code1 = 'v'">
+          <xslo:text>rvm</xslo:text>
+        </xslo:when>
+        <xslo:when test="$thesaurus_code1 = 'z'">
+          <xslo:choose>
+            <xslo:when test="//marc:datafield[@tag='040']/marc:subfield[@code='f']">
+              <xslo:value-of select="//marc:datafield[@tag='040']/marc:subfield[@code='f']"/>
+            </xslo:when>
+            <xslo:otherwise>
+              <xslo:text>notdefined</xslo:text>
+            </xslo:otherwise>
+          </xslo:choose>
+        </xslo:when>
+        <xslo:otherwise>
+          <xslo:text>notdefined</xslo:text>
+        </xslo:otherwise>
+      </xslo:choose>
+    </xslo:variable>
+    <z:index name="Subject-heading-thesaurus">
+      <xslo:value-of select="$full_thesaurus_code"/>
+    </z:index>
+  </xslo:template>
+</xslo:stylesheet>