--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<kohaidx:index_defs xmlns:kohaidx="http://www.koha.org/schemas/index-defs">
+ <!-- Leader -->
+ <kohaidx:index_leader offset="5" length="1">
+ <kohaidx:target_index>Record-status</kohaidx:target_index>
+ </kohaidx:index_leader>
+ <kohaidx:index_leader offset="17" length="1">
+ <kohaidx:target_index>Encoding-level</kohaidx:target_index>
+ </kohaidx:index_leader>
+
+ <!-- Original record ID -->
+ <kohaidx:index_control_field tag="001">
+ <kohaidx:target_index>Local-Number</kohaidx:target_index>
+ </kohaidx:index_control_field>
+
+ <!-- 008 -->
+ <kohaidx:index_control_field tag="008" offset="9" length="1">
+ <kohaidx:target_index>Kind-of-record</kohaidx:target_index>
+ </kohaidx:index_control_field>
+ <kohaidx:index_control_field tag="008" offset="10" length="1">
+ <kohaidx:target_index>Descriptive-cataloging-rules</kohaidx:target_index>
+ </kohaidx:index_control_field>
+ <kohaidx:index_subject_thesaurus tag="008" offset="11" length="1" detail_tag="040" detail_subfields="f">
+ <kohaidx:target_index>Subject-heading-thesaurus</kohaidx:target_index>
+ </kohaidx:index_subject_thesaurus>
+ <kohaidx:index_control_field tag="008" offset="14" length="1">
+ <kohaidx:target_index>Heading-use-main-or-added-entry</kohaidx:target_index>
+ </kohaidx:index_control_field>
+ <kohaidx:index_control_field tag="008" offset="15" length="1">
+ <kohaidx:target_index>Heading-use-subject-added-entry</kohaidx:target_index>
+ </kohaidx:index_control_field>
+ <kohaidx:index_control_field tag="008" offset="16" length="1">
+ <kohaidx:target_index>Heading-use-series-added-entry</kohaidx:target_index>
+ </kohaidx:index_control_field>
+
+ <!-- Personal name headings -->
+ <kohaidx:index_subfields tag="100" subfields="abcdefghjklmnopqrstvxyz">
+ <kohaidx:target_index>Personal-name:w</kohaidx:target_index>
+ <kohaidx:target_index>Personal-name:p</kohaidx:target_index>
+ <kohaidx:target_index>Personal-name:s</kohaidx:target_index>
+ </kohaidx:index_subfields>
+ <kohaidx:index_heading tag="100" subfields="abcdefghjklmnopqrstvxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Personal-name-heading:w</kohaidx:target_index>
+ <kohaidx:target_index>Personal-name-heading:p</kohaidx:target_index>
+ <kohaidx:target_index>Personal-name-heading:s</kohaidx:target_index>
+ <kohaidx:target_index>Heading:w</kohaidx:target_index>
+ <kohaidx:target_index>Heading:p</kohaidx:target_index>
+ <kohaidx:target_index>Heading:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="400" subfields="abcdefghjklmnopqrstvxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Personal-name-see-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Personal-name-see-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Personal-name-see-from:s</kohaidx:target_index>
+ <kohaidx:target_index>See-from:w</kohaidx:target_index>
+ <kohaidx:target_index>See-from:p</kohaidx:target_index>
+ <kohaidx:target_index>See-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="500" subfields="abcdefghjklmnopqrstvxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Personal-name-see-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Personal-name-see-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Personal-name-see-also-from:s</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <!-- Corporate name headings -->
+ <kohaidx:index_subfields tag="110" subfields="abcdefghklmnoprstvxyz">
+ <kohaidx:target_index>Corporate-name:w</kohaidx:target_index>
+ <kohaidx:target_index>Corporate-name:p</kohaidx:target_index>
+ </kohaidx:index_subfields>
+ <kohaidx:index_heading tag="110" subfields="abcdefghklmnoprstvxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Corporate-name-heading:w</kohaidx:target_index>
+ <kohaidx:target_index>Corporate-name-heading:p</kohaidx:target_index>
+ <kohaidx:target_index>Corporate-name-heading:s</kohaidx:target_index>
+ <kohaidx:target_index>Heading:w</kohaidx:target_index>
+ <kohaidx:target_index>Heading:p</kohaidx:target_index>
+ <kohaidx:target_index>Heading:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="410" subfields="abcdefghklmnoprstvxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Corporate-name-see-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Corporate-name-see-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Corporate-name-see-from:s</kohaidx:target_index>
+ <kohaidx:target_index>See-from:w</kohaidx:target_index>
+ <kohaidx:target_index>See-from:p</kohaidx:target_index>
+ <kohaidx:target_index>See-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="510" subfields="abcdefghklmnoprstvxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Corporate-name-see-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Corporate-name-see-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Corporate-name-see-also-from:s</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <!-- Meeting name -->
+ <kohaidx:index_subfields tag="111" subfields="acdefghjklnpqstvxyz">
+ <kohaidx:target_index>Meeting-name:w</kohaidx:target_index>
+ <kohaidx:target_index>Meeting-name:p</kohaidx:target_index>
+ </kohaidx:index_subfields>
+ <kohaidx:index_heading tag="111" subfields="acdefghjklnpqstvxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Meeting-name-heading:w</kohaidx:target_index>
+ <kohaidx:target_index>Meeting-name-heading:p</kohaidx:target_index>
+ <kohaidx:target_index>Meeting-name-heading:s</kohaidx:target_index>
+ <kohaidx:target_index>Heading:w</kohaidx:target_index>
+ <kohaidx:target_index>Heading:p</kohaidx:target_index>
+ <kohaidx:target_index>Heading:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="411" subfields="acdefghjklnpqstvxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Meeting-name-see-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Meeting-name-see-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Meeting-name-see-from:s</kohaidx:target_index>
+ <kohaidx:target_index>See-from:w</kohaidx:target_index>
+ <kohaidx:target_index>See-from:p</kohaidx:target_index>
+ <kohaidx:target_index>See-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="511" subfields="acdefghjklnpqstvxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Meeting-name-see-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Meeting-name-see-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Meeting-name-see-also-from:s</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <!-- Uniform title -->
+ <kohaidx:index_subfields tag="130" subfields="adfghklmnoprstvxyz">
+ <kohaidx:target_index>Title-uniform:w</kohaidx:target_index>
+ <kohaidx:target_index>Title-uniform:p</kohaidx:target_index>
+ </kohaidx:index_subfields>
+ <kohaidx:index_heading tag="130" subfields="adfghklmnoprstvxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Title-uniform-heading:w</kohaidx:target_index>
+ <kohaidx:target_index>Title-uniform-heading:p</kohaidx:target_index>
+ <kohaidx:target_index>Title-uniform-heading:s</kohaidx:target_index>
+ <kohaidx:target_index>Heading:w</kohaidx:target_index>
+ <kohaidx:target_index>Heading:p</kohaidx:target_index>
+ <kohaidx:target_index>Heading:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="430" subfields="adfghklmnoprstvxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Title-uniform-see-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Title-uniform-see-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Title-uniform-see-from:s</kohaidx:target_index>
+ <kohaidx:target_index>See-from:w</kohaidx:target_index>
+ <kohaidx:target_index>See-from:p</kohaidx:target_index>
+ <kohaidx:target_index>See-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="530" subfields="adfghklmnoprstvxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Title-uniform-see-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Title-uniform-see-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Title-uniform-see-also-from:s</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <!-- Chronological term -->
+ <kohaidx:index_subfields tag="148" subfields="avxyz">
+ <kohaidx:target_index>Chronological-term:w</kohaidx:target_index>
+ <kohaidx:target_index>Chronological-term:p</kohaidx:target_index>
+ </kohaidx:index_subfields>
+ <kohaidx:index_heading tag="148" subfields="avxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Chronological-term-heading:w</kohaidx:target_index>
+ <kohaidx:target_index>Chronological-term-heading:p</kohaidx:target_index>
+ <kohaidx:target_index>Chronological-term-heading:s</kohaidx:target_index>
+ <kohaidx:target_index>Heading:w</kohaidx:target_index>
+ <kohaidx:target_index>Heading:p</kohaidx:target_index>
+ <kohaidx:target_index>Heading:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="448" subfields="avxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Chronological-term-see-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Chronological-term-see-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Chronological-term-see-from:s</kohaidx:target_index>
+ <kohaidx:target_index>See-from:w</kohaidx:target_index>
+ <kohaidx:target_index>See-from:p</kohaidx:target_index>
+ <kohaidx:target_index>See-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="548" subfields="avxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Chronological-term-see-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Chronological-term-see-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Chronological-term-see-also-from:s</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+
+ <!-- Topical term -->
+ <kohaidx:index_subfields tag="150" subfields="abvxyz">
+ <kohaidx:target_index>Subject-topical:w</kohaidx:target_index>
+ <kohaidx:target_index>Subject-topical:p</kohaidx:target_index>
+ </kohaidx:index_subfields>
+ <kohaidx:index_heading tag="150" subfields="abvxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Subject-topical-heading:w</kohaidx:target_index>
+ <kohaidx:target_index>Subject-topical-heading:p</kohaidx:target_index>
+ <kohaidx:target_index>Subject-topical-heading:s</kohaidx:target_index>
+ <kohaidx:target_index>Heading:w</kohaidx:target_index>
+ <kohaidx:target_index>Heading:p</kohaidx:target_index>
+ <kohaidx:target_index>Heading:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="450" subfields="abvxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Subject-topical-see-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Subject-topical-see-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Subject-topical-see-from:s</kohaidx:target_index>
+ <kohaidx:target_index>See-from:w</kohaidx:target_index>
+ <kohaidx:target_index>See-from:p</kohaidx:target_index>
+ <kohaidx:target_index>See-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="550" subfields="abvxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Subject-topical-see-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Subject-topical-see-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Subject-topical-see-also-from:s</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <!-- Geographic name -->
+ <kohaidx:index_subfields tag="151" subfields="avxyz">
+ <kohaidx:target_index>Name-geographic:w</kohaidx:target_index>
+ <kohaidx:target_index>Name-geographic:p</kohaidx:target_index>
+ </kohaidx:index_subfields>
+ <kohaidx:index_heading tag="151" subfields="avxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Name-geographic-heading:w</kohaidx:target_index>
+ <kohaidx:target_index>Name-geographic-heading:p</kohaidx:target_index>
+ <kohaidx:target_index>Name-geographic-heading:s</kohaidx:target_index>
+ <kohaidx:target_index>Heading:w</kohaidx:target_index>
+ <kohaidx:target_index>Heading:p</kohaidx:target_index>
+ <kohaidx:target_index>Heading:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="451" subfields="avxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Name-geographic-see-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Name-geographic-see-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Name-geographic-see-from:s</kohaidx:target_index>
+ <kohaidx:target_index>See-from:w</kohaidx:target_index>
+ <kohaidx:target_index>See-from:p</kohaidx:target_index>
+ <kohaidx:target_index>See-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="551" subfields="avxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Name-geographic-see-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Name-geographic-see-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Name-geographic-see-also-from:s</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <!-- Genre/form term -->
+ <kohaidx:index_subfields tag="155" subfields="avxyz">
+ <kohaidx:target_index>Term-genre-form:w</kohaidx:target_index>
+ <kohaidx:target_index>Term-genre-form:p</kohaidx:target_index>
+ </kohaidx:index_subfields>
+ <kohaidx:index_heading tag="155" subfields="avxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Term-genre-form-heading:w</kohaidx:target_index>
+ <kohaidx:target_index>Term-genre-form-heading:p</kohaidx:target_index>
+ <kohaidx:target_index>Term-genre-form-heading:s</kohaidx:target_index>
+ <kohaidx:target_index>Heading:w</kohaidx:target_index>
+ <kohaidx:target_index>Heading:p</kohaidx:target_index>
+ <kohaidx:target_index>Heading:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="455" subfields="avxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Term-genre-form-see-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Term-genre-form-see-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Term-genre-form-see-from:s</kohaidx:target_index>
+ <kohaidx:target_index>See-from:w</kohaidx:target_index>
+ <kohaidx:target_index>See-from:p</kohaidx:target_index>
+ <kohaidx:target_index>See-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="555" subfields="avxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Term-genre-form-see-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Term-genre-form-see-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Term-genre-form-see-also-from:s</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>See-also-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <!-- General subdivision -->
+ <kohaidx:index_heading tag="180" subfields="vxyz" subdivisions="vxyz">
+ <kohaidx:target_index>General-subdivision:w</kohaidx:target_index>
+ <kohaidx:target_index>General-subdivision:p</kohaidx:target_index>
+ <kohaidx:target_index>General-subdivision:s</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision:w</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision:p</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="480" subfields="vxyz" subdivisions="vxyz">
+ <kohaidx:target_index>General-subdivision-see-from:w</kohaidx:target_index>
+ <kohaidx:target_index>General-subdivision-see-from:p</kohaidx:target_index>
+ <kohaidx:target_index>General-subdivision-see-from:s</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="580" subfields="vxyz" subdivisions="vxyz">
+ <kohaidx:target_index>General-subdivision-see-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>General-subdivision-see-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>General-subdivision-see-also-from:s</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-also-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <!-- Geographic subdivision -->
+ <kohaidx:index_heading tag="181" subfields="vxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Geographic-subdivision:w</kohaidx:target_index>
+ <kohaidx:target_index>Geographic-subdivision:p</kohaidx:target_index>
+ <kohaidx:target_index>Geographic-subdivision:s</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision:w</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision:p</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="481" subfields="vxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Geographic-subdivision-see-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Geographic-subdivision-see-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Geographic-subdivision-see-from:s</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="581" subfields="vxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Geographic-subdivision-see-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Geographic-subdivision-see-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Geographic-subdivision-see-also-from:s</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-also-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <!-- Chronological subdivision -->
+ <kohaidx:index_heading tag="182" subfields="vxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Chronological-subdivision:w</kohaidx:target_index>
+ <kohaidx:target_index>Chronological-subdivision:p</kohaidx:target_index>
+ <kohaidx:target_index>Chronological-subdivision:s</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision:w</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision:p</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="482" subfields="vxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Chronological-subdivision-see-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Chronological-subdivision-see-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Chronological-subdivision-see-from:s</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="582" subfields="vxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Chronological-subdivision-see-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Chronological-subdivision-see-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Chronological-subdivision-see-also-from:s</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-also-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <!-- Form subdivision -->
+ <kohaidx:index_heading tag="185" subfields="vxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Form-subdivision:w</kohaidx:target_index>
+ <kohaidx:target_index>Form-subdivision:p</kohaidx:target_index>
+ <kohaidx:target_index>Form-subdivision:s</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision:w</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision:p</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="485" subfields="vxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Form-subdivision-see-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Form-subdivision-see-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Form-subdivision-see-from:s</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_heading tag="585" subfields="vxyz" subdivisions="vxyz">
+ <kohaidx:target_index>Form-subdivision-see-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Form-subdivision-see-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Form-subdivision-see-also-from:s</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-also-from:w</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-also-from:p</kohaidx:target_index>
+ <kohaidx:target_index>Subdivision-see-also-from:s</kohaidx:target_index>
+ </kohaidx:index_heading>
+
+ <kohaidx:index_subfields tag="942" subfields="a">
+ <kohaidx:target_index>authtype</kohaidx:target_index>
+ </kohaidx:index_subfields>
+</kohaidx:index_defs>
--- /dev/null
+<?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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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() > 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>
--- /dev/null
+<?xml version='1.0'?>
+<xsl:stylesheet version="1.0"
+ xmlns:marc="http://www.loc.gov/MARC21/slim"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xslo="http://www.w3.org/1999/XSL/TransformAlias"
+ xmlns:z="http://indexdata.com/zebra-2.0"
+ xmlns:kohaidx="http://www.koha.org/schemas/index-defs">
+
+ <xsl:namespace-alias stylesheet-prefix="xslo" result-prefix="xsl"/>
+ <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
+ <!-- disable all default text node output -->
+ <xsl:template match="text()"/>
+
+ <!-- Keys on tags referenced in the index definitions -->
+ <xsl:key name="index_control_field_tag" match="kohaidx:index_control_field" use="@tag"/>
+ <xsl:key name="index_subfields_tag" match="kohaidx:index_subfields" use="@tag"/>
+ <xsl:key name="index_heading_tag" match="kohaidx:index_heading" use="@tag"/>
+
+ <xsl:template match="kohaidx:index_defs">
+ <xslo:stylesheet 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>
+
+ <xsl:call-template name="handle-index-leader"/>
+ <xsl:call-template name="handle-index-control-field"/>
+ <xsl:call-template name="handle-index-subfields"/>
+ <xsl:call-template name="handle-index-heading"/>
+ <xsl:apply-templates/>
+ </xslo:stylesheet>
+ </xsl:template>
+
+ <xsl:template match="kohaidx:index_subject_thesaurus">
+ <xsl:variable name="tag"><xsl:value-of select="@tag"/></xsl:variable>
+ <xsl:variable name="offset"><xsl:value-of select="@offset"/></xsl:variable>
+ <xsl:variable name="length"><xsl:value-of select="@length"/></xsl:variable>
+ <xsl:variable name="detail_tag"><xsl:value-of select="@detail_tag"/></xsl:variable>
+ <xsl:variable name="detail_subfields"><xsl:value-of select="@detail_subfields"/></xsl:variable>
+ <xsl:variable name="indexes">
+ <xsl:call-template name="get-target-indexes"/>
+ </xsl:variable>
+ <xslo:template mode="index_subject_thesaurus">
+ <xsl:attribute name="match">
+ <xsl:text>marc:controlfield[@tag='</xsl:text>
+ <xsl:value-of select="$tag"/>
+ <xsl:text>']</xsl:text>
+ </xsl:attribute>
+ <xslo:variable name="thesaurus_code1">
+ <xsl:attribute name="select">
+ <xsl:text>substring(., </xsl:text>
+ <xsl:value-of select="$offset + 1" />
+ <xsl:text>, </xsl:text>
+ <xsl:value-of select="$length" />
+ <xsl:text>)</xsl:text>
+ </xsl:attribute>
+ </xslo:variable>
+ <xsl:variable name="alt_select">
+ <xsl:text>//marc:datafield[@tag='</xsl:text>
+ <xsl:value-of select="$detail_tag"/>
+ <xsl:text>']/marc:subfield[@code='</xsl:text>
+ <xsl:value-of select="$detail_subfields"/>
+ <xsl:text>']</xsl:text>
+ </xsl:variable>
+ <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>
+ <xsl:attribute name="test"><xsl:value-of select="$alt_select"/></xsl:attribute>
+ <xslo:value-of>
+ <xsl:attribute name="select"><xsl:value-of select="$alt_select"/></xsl:attribute>
+ </xslo:value-of>
+ </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>
+ <xsl:attribute name="name"><xsl:value-of select="normalize-space($indexes)"/></xsl:attribute>
+ <xslo:value-of select="$full_thesaurus_code"/>
+ </z:index>
+ </xslo:template>
+ </xsl:template>
+
+ <xsl:template name="handle-index-leader">
+ <xsl:if test="kohaidx:index_leader">
+ <xslo:template match="marc:leader">
+ <xsl:apply-templates select="kohaidx:index_leader" mode="secondary"/>
+ </xslo:template>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="kohaidx:index_leader" mode="secondary">
+ <xsl:variable name="offset"><xsl:value-of select="@offset"/></xsl:variable>
+ <xsl:variable name="length"><xsl:value-of select="@length"/></xsl:variable>
+ <xsl:variable name="indexes">
+ <xsl:call-template name="get-target-indexes"/>
+ </xsl:variable>
+ <z:index>
+ <xsl:attribute name="name"><xsl:value-of select="normalize-space($indexes)"/></xsl:attribute>
+ <xslo:value-of>
+ <xsl:attribute name="select">
+ <xsl:text>substring(., </xsl:text>
+ <xsl:value-of select="$offset + 1" />
+ <xsl:text>, </xsl:text>
+ <xsl:value-of select="$length" />
+ <xsl:text>)</xsl:text>
+ </xsl:attribute>
+ </xslo:value-of>
+ </z:index>
+ </xsl:template>
+
+ <xsl:template name="handle-index-control-field">
+ <xsl:for-each select="//kohaidx:index_control_field[generate-id() = generate-id(key('index_control_field_tag', @tag)[1])]">
+ <xslo:template>
+ <xsl:attribute name="match">
+ <xsl:text>marc:controlfield[@tag='</xsl:text>
+ <xsl:value-of select="@tag"/>
+ <xsl:text>']</xsl:text>
+ </xsl:attribute>
+ <xsl:for-each select="key('index_control_field_tag', @tag)">
+ <xsl:call-template name="handle-one-index-control-field"/>
+ </xsl:for-each>
+ </xslo:template>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="handle-one-index-control-field">
+ <xsl:variable name="offset"><xsl:value-of select="@offset"/></xsl:variable>
+ <xsl:variable name="length"><xsl:value-of select="@length"/></xsl:variable>
+ <xsl:variable name="indexes">
+ <xsl:call-template name="get-target-indexes"/>
+ </xsl:variable>
+ <z:index>
+ <xsl:attribute name="name"><xsl:value-of select="normalize-space($indexes)"/></xsl:attribute>
+ <xslo:value-of>
+ <xsl:attribute name="select">
+ <xsl:choose>
+ <xsl:when test="@length">
+ <xsl:text>substring(., </xsl:text>
+ <xsl:value-of select="$offset + 1" />
+ <xsl:text>, </xsl:text>
+ <xsl:value-of select="$length"/>
+ <xsl:text>)</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>.</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xslo:value-of>
+ </z:index>
+ </xsl:template>
+
+ <xsl:template name="handle-index-subfields">
+ <xsl:for-each select="//kohaidx:index_subfields[generate-id() = generate-id(key('index_subfields_tag', @tag)[1])]">
+ <xslo:template mode="index_subfields">
+ <xsl:attribute name="match">
+ <xsl:text>marc:datafield[@tag='</xsl:text>
+ <xsl:value-of select="@tag"/>
+ <xsl:text>']</xsl:text>
+ </xsl:attribute>
+ <xsl:for-each select="key('index_subfields_tag', @tag)">
+ <xsl:call-template name="handle-one-index-subfields"/>
+ </xsl:for-each>
+ </xslo:template>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="handle-one-index-subfields">
+ <xsl:variable name="indexes">
+ <xsl:call-template name="get-target-indexes"/>
+ </xsl:variable>
+ <xslo:for-each select="marc:subfield">
+ <xslo:if>
+ <xsl:attribute name="test">
+ <xsl:text>contains('</xsl:text>
+ <xsl:value-of select="@subfields"/>
+ <xsl:text>', @code)</xsl:text>
+ </xsl:attribute>
+ <z:index>
+ <xsl:attribute name="name"><xsl:value-of select="normalize-space($indexes)"/></xsl:attribute>
+ <xslo:value-of select="."/>
+ </z:index>
+ </xslo:if>
+ </xslo:for-each>
+ </xsl:template>
+
+ <xsl:template name="handle-index-heading">
+ <xsl:for-each select="//kohaidx:index_heading[generate-id() = generate-id(key('index_heading_tag', @tag)[1])]">
+ <xslo:template mode="index_heading">
+ <xsl:attribute name="match">
+ <xsl:text>marc:datafield[@tag='</xsl:text>
+ <xsl:value-of select="@tag"/>
+ <xsl:text>']</xsl:text>
+ </xsl:attribute>
+ <xsl:for-each select="key('index_heading_tag', @tag)">
+ <xsl:call-template name="handle-one-index-heading"/>
+ </xsl:for-each>
+ </xslo:template>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="handle-one-index-heading">
+ <xsl:variable name="indexes">
+ <xsl:call-template name="get-target-indexes"/>
+ </xsl:variable>
+ <z:index>
+ <xsl:attribute name="name"><xsl:value-of select="normalize-space($indexes)"/></xsl:attribute>
+ <xslo:variable name="raw_heading">
+ <xslo:for-each select="marc:subfield">
+ <xslo:if>
+ <xsl:attribute name="test">
+ <xsl:text>contains('</xsl:text>
+ <xsl:value-of select="@subfields"/>
+ <xsl:text>', @code)</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="name"><xsl:value-of select="normalize-space($indexes)"/></xsl:attribute>
+ <xslo:if test="position() > 1">
+ <xslo:choose>
+ <xslo:when>
+ <xsl:attribute name="test">
+ <xsl:text>contains('</xsl:text>
+ <xsl:value-of select="@subdivisions"/>
+ <xsl:text>', @code)</xsl:text>
+ </xsl:attribute>
+ <xslo:text>--</xslo:text>
+ </xslo:when>
+ <xslo:otherwise>
+ <xslo:value-of select="substring(' ', 1, 1)"/> <!-- FIXME surely there's a better way to specify a space -->
+ </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>
+ </xsl:template>
+
+ <xsl:template name="get-target-indexes">
+ <xsl:for-each select="kohaidx:target_index">
+ <xsl:value-of select="." /><xsl:text> </xsl:text>
+ </xsl:for-each>
+ </xsl:template>
+</xsl:stylesheet>