Bug 17788: (MARC21) Add $9 fields to Koha-Auth-Number:w index
[koha.git] / etc / zebradb / marc_defs / marc21 / biblios / biblio-zebra-indexdefs.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3 This file has been automatically generated from a Koha index definition file
4 with the stylesheet koha-indexdefs-to-zebra.xsl. Do not manually edit this file,
5 as it may be overwritten. To regenerate, edit the appropriate Koha index
6 definition file (probably something like {biblio,authority}-koha-indexdefs.xml) and run:
7 `xsltproc koha-indexdefs-to-zebra.xsl {biblio,authority}-koha-indexdefs.xml >
8 {biblio,authority}-zebra-indexdefs.xsl` (substituting the appropriate file names).
9 -->
10 <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-community.org/schemas/index-defs" version="1.0">
11   <xslo:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
12   <xslo:template match="text()"/>
13   <xslo:template match="text()" mode="index_subfields"/>
14   <xslo:template match="text()" mode="index_data_field"/>
15   <xslo:template match="text()" mode="index_facets"/>
16   <xslo:template match="text()" mode="index_heading"/>
17   <xslo:template match="text()" mode="index_heading_conditional"/>
18   <xslo:template match="text()" mode="index_match_heading"/>
19   <xslo:template match="text()" mode="index_subject_thesaurus"/>
20   <xslo:template match="text()" mode="index_sort_tit"/>
21   <xslo:template match="/">
22     <xslo:if test="marc:collection">
23       <collection>
24         <xslo:apply-templates select="marc:collection/marc:record"/>
25       </collection>
26     </xslo:if>
27     <xslo:if test="marc:record">
28       <xslo:apply-templates select="marc:record"/>
29     </xslo:if>
30   </xslo:template>
31   <xslo:template match="marc:record">
32     <xslo:variable name="idfield" select="normalize-space(marc:datafield[@tag='999']/marc:subfield[@code='c'])"/>
33     <z:record type="update">
34       <xslo:attribute name="z:id">
35         <xslo:value-of select="$idfield"/>
36       </xslo:attribute>
37       <xslo:apply-templates/>
38       <xslo:apply-templates mode="index_subfields"/>
39       <xslo:apply-templates mode="index_data_field"/>
40       <xslo:apply-templates mode="index_facets"/>
41       <xslo:apply-templates mode="index_heading"/>
42       <xslo:apply-templates mode="index_heading_conditional"/>
43       <xslo:apply-templates mode="index_match_heading"/>
44       <xslo:apply-templates mode="index_subject_thesaurus"/>
45       <xslo:apply-templates mode="index_all"/>
46       <xslo:apply-templates mode="index_sort_tit"/>
47     </z:record>
48   </xslo:template>
49   <xslo:template match="marc:leader">
50     <z:index name="llength:w">
51       <xslo:value-of select="substring(., 1, 5)"/>
52     </z:index>
53     <z:index name="rtype:w">
54       <xslo:value-of select="substring(., 7, 1)"/>
55     </z:index>
56     <z:index name="Bib-level:w">
57       <xslo:value-of select="substring(., 8, 1)"/>
58     </z:index>
59   </xslo:template>
60   <xslo:template match="marc:controlfield[@tag='001']">
61     <z:index name="Control-number:w">
62       <xslo:value-of select="."/>
63     </z:index>
64   </xslo:template>
65   <xslo:template match="marc:controlfield[@tag='005']">
66     <z:index name="Date/time-last-modified:w">
67       <xslo:value-of select="."/>
68     </z:index>
69   </xslo:template>
70   <xslo:template match="marc:controlfield[@tag='007']">
71     <z:index name="Microform-generation:n">
72       <xslo:value-of select="substring(., 12, 1)"/>
73     </z:index>
74     <z:index name="Material-type:w">
75       <xslo:value-of select="."/>
76     </z:index>
77     <z:index name="ff7-00:w">
78       <xslo:value-of select="substring(., 1, 1)"/>
79     </z:index>
80     <z:index name="ff7-01:w">
81       <xslo:value-of select="substring(., 2, 1)"/>
82     </z:index>
83     <z:index name="ff7-02:w">
84       <xslo:value-of select="substring(., 3, 1)"/>
85     </z:index>
86     <z:index name="ff7-01-02:w">
87       <xslo:value-of select="substring(., 1, 2)"/>
88     </z:index>
89   </xslo:template>
90   <xslo:template match="marc:controlfield[@tag='008']">
91     <z:index name="date-entered-on-file:n">
92       <xslo:value-of select="substring(., 1, 5)"/>
93     </z:index>
94     <z:index name="date-entered-on-file:s">
95       <xslo:value-of select="substring(., 1, 5)"/>
96     </z:index>
97     <z:index name="pubdate:w">
98       <xslo:value-of select="substring(., 8, 4)"/>
99     </z:index>
100     <z:index name="pubdate:n">
101       <xslo:value-of select="substring(., 8, 4)"/>
102     </z:index>
103     <z:index name="pubdate:y">
104       <xslo:value-of select="substring(., 8, 4)"/>
105     </z:index>
106     <z:index name="pubdate:s">
107       <xslo:value-of select="substring(., 8, 4)"/>
108     </z:index>
109     <z:index name="pl:w">
110       <xslo:value-of select="substring(., 16, 3)"/>
111     </z:index>
112     <z:index name="ta:w">
113       <xslo:value-of select="substring(., 23, 1)"/>
114     </z:index>
115     <z:index name="ff8-23:w">
116       <xslo:value-of select="substring(., 24, 1)"/>
117     </z:index>
118     <z:index name="ff8-29:w">
119       <xslo:value-of select="substring(., 30, 1)"/>
120     </z:index>
121     <z:index name="lf:w">
122       <xslo:value-of select="substring(., 34, 1)"/>
123     </z:index>
124     <z:index name="bio:w">
125       <xslo:value-of select="substring(., 35, 1)"/>
126     </z:index>
127     <z:index name="ln:w">
128       <xslo:value-of select="substring(., 36, 3)"/>
129     </z:index>
130     <z:index name="ctype:w">
131       <xslo:value-of select="substring(., 25, 4)"/>
132     </z:index>
133     <z:index name="Record-source:w">
134       <xslo:value-of select="substring(., 40, 0)"/>
135     </z:index>
136   </xslo:template>
137   <xslo:template mode="index_subfields" match="marc:datafield[@tag='020']">
138     <xslo:for-each select="marc:subfield">
139       <xslo:if test="contains('a', @code)">
140         <z:index name="ISBN:w Identifier-standard:w">
141           <xslo:value-of select="."/>
142         </z:index>
143       </xslo:if>
144     </xslo:for-each>
145     <xslo:for-each select="marc:subfield">
146       <xslo:if test="contains('z', @code)">
147         <z:index name="ISBN:w Identifier-standard:w">
148           <xslo:value-of select="."/>
149         </z:index>
150       </xslo:if>
151     </xslo:for-each>
152   </xslo:template>
153   <xslo:template mode="index_subfields" match="marc:datafield[@tag='022']">
154     <xslo:for-each select="marc:subfield">
155       <xslo:if test="contains('a', @code)">
156         <z:index name="ISSN:w Identifier-standard:w">
157           <xslo:value-of select="."/>
158         </z:index>
159       </xslo:if>
160     </xslo:for-each>
161     <xslo:for-each select="marc:subfield">
162       <xslo:if test="contains('y', @code)">
163         <z:index name="ISSN:w Identifier-standard:w">
164           <xslo:value-of select="."/>
165         </z:index>
166       </xslo:if>
167     </xslo:for-each>
168     <xslo:for-each select="marc:subfield">
169       <xslo:if test="contains('z', @code)">
170         <z:index name="ISSN:w Identifier-standard:w">
171           <xslo:value-of select="."/>
172         </z:index>
173       </xslo:if>
174     </xslo:for-each>
175   </xslo:template>
176   <xslo:template mode="index_subfields" match="marc:datafield[@tag='024']">
177     <xslo:for-each select="marc:subfield">
178       <xslo:if test="contains('a', @code)">
179         <z:index name="Identifier-other:w Identifier-other:p">
180           <xslo:value-of select="."/>
181         </z:index>
182       </xslo:if>
183     </xslo:for-each>
184     <xslo:if test="marc:subfield[@code='2' and text()='uri']">
185       <xslo:for-each select="marc:subfield">
186         <xslo:if test="contains('a', @code)">
187           <z:index name="Identifier-other:u">
188             <xslo:value-of select="."/>
189           </z:index>
190         </xslo:if>
191       </xslo:for-each>
192     </xslo:if>
193   </xslo:template>
194   <xslo:template mode="index_subfields" match="marc:datafield[@tag='041']">
195     <xslo:for-each select="marc:subfield">
196       <xslo:if test="contains('a', @code)">
197         <z:index name="ln:w ln-audio:w">
198           <xslo:value-of select="."/>
199         </z:index>
200       </xslo:if>
201     </xslo:for-each>
202     <xslo:for-each select="marc:subfield">
203       <xslo:if test="contains('d', @code)">
204         <z:index name="ln:w">
205           <xslo:value-of select="."/>
206         </z:index>
207       </xslo:if>
208     </xslo:for-each>
209     <xslo:for-each select="marc:subfield">
210       <xslo:if test="contains('e', @code)">
211         <z:index name="ln:w">
212           <xslo:value-of select="."/>
213         </z:index>
214       </xslo:if>
215     </xslo:for-each>
216     <xslo:for-each select="marc:subfield">
217       <xslo:if test="contains('h', @code)">
218         <z:index name="language-original:w">
219           <xslo:value-of select="."/>
220         </z:index>
221       </xslo:if>
222     </xslo:for-each>
223     <xslo:for-each select="marc:subfield">
224       <xslo:if test="contains('j', @code)">
225         <z:index name="ln:w ln-subtitle:w">
226           <xslo:value-of select="."/>
227         </z:index>
228       </xslo:if>
229     </xslo:for-each>
230   </xslo:template>
231   <xslo:template mode="index_subfields" match="marc:datafield[@tag='050']">
232     <xslo:for-each select="marc:subfield">
233       <xslo:if test="contains('b', @code)">
234         <z:index name="LC-call-number:w LC-call-number:p LC-call-number:s">
235           <xslo:value-of select="."/>
236         </z:index>
237       </xslo:if>
238     </xslo:for-each>
239   </xslo:template>
240   <xslo:template mode="index_subfields" match="marc:datafield[@tag='100']">
241     <xslo:for-each select="marc:subfield">
242       <xslo:if test="contains('9', @code)">
243         <z:index name="Cross-Reference:w Koha-Auth-Number:w">
244           <xslo:value-of select="."/>
245         </z:index>
246       </xslo:if>
247     </xslo:for-each>
248     <xslo:for-each select="marc:subfield">
249       <xslo:if test="contains('a', @code)">
250         <z:index name="Author:w Author:p Author:s Editor:w Author-personal-bibliography:w Author-personal-bibliography:p Author-personal-bibliography:s">
251           <xslo:value-of select="."/>
252         </z:index>
253       </xslo:if>
254     </xslo:for-each>
255   </xslo:template>
256   <xslo:template mode="index_subfields" match="marc:datafield[@tag='110']">
257     <xslo:for-each select="marc:subfield">
258       <xslo:if test="contains('9', @code)">
259         <z:index name="Koha-Auth-Number:w">
260           <xslo:value-of select="."/>
261         </z:index>
262       </xslo:if>
263     </xslo:for-each>
264   </xslo:template>
265   <xslo:template mode="index_subfields" match="marc:datafield[@tag='111']">
266     <xslo:for-each select="marc:subfield">
267       <xslo:if test="contains('9', @code)">
268         <z:index name="Koha-Auth-Number:w">
269           <xslo:value-of select="."/>
270         </z:index>
271       </xslo:if>
272     </xslo:for-each>
273   </xslo:template>
274   <xslo:template mode="index_subfields" match="marc:datafield[@tag='130']">
275     <xslo:for-each select="marc:subfield">
276       <xslo:if test="contains('n', @code)">
277         <z:index name="Thematic-number:w">
278           <xslo:value-of select="."/>
279         </z:index>
280       </xslo:if>
281     </xslo:for-each>
282     <xslo:for-each select="marc:subfield">
283       <xslo:if test="contains('r', @code)">
284         <z:index name="Music-key:w">
285           <xslo:value-of select="."/>
286         </z:index>
287       </xslo:if>
288     </xslo:for-each>
289     <xslo:for-each select="marc:subfield">
290       <xslo:if test="contains('9', @code)">
291         <z:index name="Koha-Auth-Number:w">
292           <xslo:value-of select="."/>
293         </z:index>
294       </xslo:if>
295     </xslo:for-each>
296   </xslo:template>
297   <xslo:template mode="index_subfields" match="marc:datafield[@tag='240']">
298     <xslo:for-each select="marc:subfield">
299       <xslo:if test="contains('r', @code)">
300         <z:index name="Music-key:w">
301           <xslo:value-of select="."/>
302         </z:index>
303       </xslo:if>
304     </xslo:for-each>
305     <xslo:for-each select="marc:subfield">
306       <xslo:if test="contains('n', @code)">
307         <z:index name="Thematic-number:w">
308           <xslo:value-of select="."/>
309         </z:index>
310       </xslo:if>
311     </xslo:for-each>
312   </xslo:template>
313   <xslo:template mode="index_subfields" match="marc:datafield[@tag='243']">
314     <xslo:for-each select="marc:subfield">
315       <xslo:if test="contains('n', @code)">
316         <z:index name="Thematic-number:w">
317           <xslo:value-of select="."/>
318         </z:index>
319       </xslo:if>
320     </xslo:for-each>
321     <xslo:for-each select="marc:subfield">
322       <xslo:if test="contains('r', @code)">
323         <z:index name="Music-key:w">
324           <xslo:value-of select="."/>
325         </z:index>
326       </xslo:if>
327     </xslo:for-each>
328   </xslo:template>
329   <xslo:template mode="index_subfields" match="marc:datafield[@tag='245']">
330     <xslo:for-each select="marc:subfield">
331       <xslo:if test="contains('a', @code)">
332         <z:index name="Title-cover:w Title-cover:p Title-cover:s Title:w Title:p">
333           <xslo:value-of select="."/>
334         </z:index>
335       </xslo:if>
336     </xslo:for-each>
337     <xslo:for-each select="marc:subfield">
338       <xslo:if test="contains('c', @code)">
339         <z:index name="Author:w Author-in-order:w Author-in-order:p Author-in-order:s">
340           <xslo:value-of select="."/>
341         </z:index>
342       </xslo:if>
343     </xslo:for-each>
344     <xslo:for-each select="marc:subfield">
345       <xslo:if test="contains('9', @code)">
346         <z:index name="Cross-Reference:w Koha-Auth-Number:w">
347           <xslo:value-of select="."/>
348         </z:index>
349       </xslo:if>
350     </xslo:for-each>
351   </xslo:template>
352   <xslo:template mode="index_subfields" match="marc:datafield[@tag='260']">
353     <xslo:for-each select="marc:subfield">
354       <xslo:if test="contains('a', @code)">
355         <z:index name="pl:w pl:p">
356           <xslo:value-of select="."/>
357         </z:index>
358       </xslo:if>
359     </xslo:for-each>
360     <xslo:for-each select="marc:subfield">
361       <xslo:if test="contains('b', @code)">
362         <z:index name="Publisher:w Publisher:p">
363           <xslo:value-of select="."/>
364         </z:index>
365       </xslo:if>
366     </xslo:for-each>
367     <xslo:for-each select="marc:subfield">
368       <xslo:if test="contains('c', @code)">
369         <z:index name="copydate:w copydate:s">
370           <xslo:value-of select="."/>
371         </z:index>
372       </xslo:if>
373     </xslo:for-each>
374   </xslo:template>
375   <xslo:template mode="index_subfields" match="marc:datafield[@tag='400']">
376     <xslo:for-each select="marc:subfield">
377       <xslo:if test="contains('a', @code)">
378         <z:index name="Name-and-title:w">
379           <xslo:value-of select="."/>
380         </z:index>
381       </xslo:if>
382     </xslo:for-each>
383     <xslo:for-each select="marc:subfield">
384       <xslo:if test="contains('t', @code)">
385         <z:index name="Author-title:w Name-and-title:w Title:w Title-series:w">
386           <xslo:value-of select="."/>
387         </z:index>
388       </xslo:if>
389     </xslo:for-each>
390     <xslo:for-each select="marc:subfield">
391       <xslo:if test="contains('9', @code)">
392         <z:index name="Koha-Auth-Number:w">
393           <xslo:value-of select="."/>
394         </z:index>
395       </xslo:if>
396     </xslo:for-each>
397   </xslo:template>
398   <xslo:template mode="index_subfields" match="marc:datafield[@tag='410']">
399     <xslo:for-each select="marc:subfield">
400       <xslo:if test="contains('a', @code)">
401         <z:index name="Name-and-title:w">
402           <xslo:value-of select="."/>
403         </z:index>
404       </xslo:if>
405     </xslo:for-each>
406     <xslo:for-each select="marc:subfield">
407       <xslo:if test="contains('t', @code)">
408         <z:index name="Author-title:w Title:w Title-series:w">
409           <xslo:value-of select="."/>
410         </z:index>
411       </xslo:if>
412     </xslo:for-each>
413     <xslo:for-each select="marc:subfield">
414       <xslo:if test="contains('9', @code)">
415         <z:index name="Koha-Auth-Number:w">
416           <xslo:value-of select="."/>
417         </z:index>
418       </xslo:if>
419     </xslo:for-each>
420   </xslo:template>
421   <xslo:template mode="index_subfields" match="marc:datafield[@tag='411']">
422     <xslo:for-each select="marc:subfield">
423       <xslo:if test="contains('a', @code)">
424         <z:index name="Name-and-title:w">
425           <xslo:value-of select="."/>
426         </z:index>
427       </xslo:if>
428     </xslo:for-each>
429     <xslo:for-each select="marc:subfield">
430       <xslo:if test="contains('t', @code)">
431         <z:index name="Author-title:w Title-series:w">
432           <xslo:value-of select="."/>
433         </z:index>
434       </xslo:if>
435     </xslo:for-each>
436   </xslo:template>
437   <xslo:template mode="index_subfields" match="marc:datafield[@tag='440']">
438     <xslo:for-each select="marc:subfield">
439       <xslo:if test="contains('a', @code)">
440         <z:index name="Title-series:w Title-series:p">
441           <xslo:value-of select="."/>
442         </z:index>
443       </xslo:if>
444     </xslo:for-each>
445     <xslo:for-each select="marc:subfield">
446       <xslo:if test="contains('9', @code)">
447         <z:index name="Koha-Auth-Number:w">
448           <xslo:value-of select="."/>
449         </z:index>
450       </xslo:if>
451     </xslo:for-each>
452   </xslo:template>
453   <xslo:template mode="index_subfields" match="marc:datafield[@tag='490']">
454     <xslo:for-each select="marc:subfield">
455       <xslo:if test="contains('a', @code)">
456         <z:index name="Title-series:w Title-series:p">
457           <xslo:value-of select="."/>
458         </z:index>
459       </xslo:if>
460     </xslo:for-each>
461     <xslo:for-each select="marc:subfield">
462       <xslo:if test="contains('9', @code)">
463         <z:index name="Koha-Auth-Number:w">
464           <xslo:value-of select="."/>
465         </z:index>
466       </xslo:if>
467     </xslo:for-each>
468   </xslo:template>
469   <xslo:template mode="index_subfields" match="marc:datafield[@tag='505']">
470     <xslo:for-each select="marc:subfield">
471       <xslo:if test="contains('r', @code)">
472         <z:index name="Author:w">
473           <xslo:value-of select="."/>
474         </z:index>
475       </xslo:if>
476     </xslo:for-each>
477     <xslo:for-each select="marc:subfield">
478       <xslo:if test="contains('t', @code)">
479         <z:index name="Title:w">
480           <xslo:value-of select="."/>
481         </z:index>
482       </xslo:if>
483     </xslo:for-each>
484   </xslo:template>
485   <xslo:template mode="index_subfields" match="marc:datafield[@tag='521']">
486     <xslo:if test="@ind1='0'">
487       <xslo:for-each select="marc:subfield">
488         <xslo:if test="contains('a', @code)">
489           <z:index name="Reading-grade-level:w Reading-grade-level:p Reading-grade-level:n">
490             <xslo:value-of select="."/>
491           </z:index>
492         </xslo:if>
493       </xslo:for-each>
494     </xslo:if>
495     <xslo:if test="@ind1='1'">
496       <xslo:for-each select="marc:subfield">
497         <xslo:if test="contains('a', @code)">
498           <z:index name="Interest-age-level:w Interest-age-level:p Interest-age-level:n">
499             <xslo:value-of select="."/>
500           </z:index>
501         </xslo:if>
502       </xslo:for-each>
503     </xslo:if>
504     <xslo:if test="@ind1='2'">
505       <xslo:for-each select="marc:subfield">
506         <xslo:if test="contains('a', @code)">
507           <z:index name="Interest-grade-level:w Interest-grade-level:p Interest-grade-level:n">
508             <xslo:value-of select="."/>
509           </z:index>
510         </xslo:if>
511       </xslo:for-each>
512     </xslo:if>
513     <xslo:if test="@ind1='8'">
514       <xslo:for-each select="marc:subfield">
515         <xslo:if test="contains('a', @code)">
516           <z:index name="lexile-number:w lexile-number:p lexile-number:n">
517             <xslo:value-of select="."/>
518           </z:index>
519         </xslo:if>
520       </xslo:for-each>
521     </xslo:if>
522   </xslo:template>
523   <xslo:template mode="index_subfields" match="marc:datafield[@tag='526']">
524     <xslo:for-each select="marc:subfield">
525       <xslo:if test="contains('c', @code)">
526         <z:index name="arl:w arl:n">
527           <xslo:value-of select="."/>
528         </z:index>
529       </xslo:if>
530     </xslo:for-each>
531     <xslo:for-each select="marc:subfield">
532       <xslo:if test="contains('d', @code)">
533         <z:index name="arp:w arp:n">
534           <xslo:value-of select="."/>
535         </z:index>
536       </xslo:if>
537     </xslo:for-each>
538   </xslo:template>
539   <xslo:template mode="index_subfields" match="marc:datafield[@tag='600']">
540     <xslo:for-each select="marc:subfield">
541       <xslo:if test="contains('a', @code)">
542         <z:index name="Name-and-title:w Name:w Personal-name:w Subject-name-personal:w Subject:w Subject:p">
543           <xslo:value-of select="."/>
544         </z:index>
545       </xslo:if>
546     </xslo:for-each>
547     <xslo:for-each select="marc:subfield">
548       <xslo:if test="contains('t', @code)">
549         <z:index name="Name-and-title:w Title:w Subject:w Subject:p">
550           <xslo:value-of select="."/>
551         </z:index>
552       </xslo:if>
553     </xslo:for-each>
554     <xslo:for-each select="marc:subfield">
555       <xslo:if test="contains('9', @code)">
556         <z:index name="Koha-Auth-Number:w">
557           <xslo:value-of select="."/>
558         </z:index>
559       </xslo:if>
560     </xslo:for-each>
561   </xslo:template>
562   <xslo:template mode="index_subfields" match="marc:datafield[@tag='610']">
563     <xslo:for-each select="marc:subfield">
564       <xslo:if test="contains('a', @code)">
565         <z:index name="Name-and-title:w Subject:w Subject:p">
566           <xslo:value-of select="."/>
567         </z:index>
568       </xslo:if>
569     </xslo:for-each>
570     <xslo:for-each select="marc:subfield">
571       <xslo:if test="contains('t', @code)">
572         <z:index name="Name-and-title:w Title:w Subject:w Subject:p">
573           <xslo:value-of select="."/>
574         </z:index>
575       </xslo:if>
576     </xslo:for-each>
577     <xslo:for-each select="marc:subfield">
578       <xslo:if test="contains('9', @code)">
579         <z:index name="Koha-Auth-Number:w">
580           <xslo:value-of select="."/>
581         </z:index>
582       </xslo:if>
583     </xslo:for-each>
584   </xslo:template>
585   <xslo:template mode="index_subfields" match="marc:datafield[@tag='611']">
586     <xslo:for-each select="marc:subfield">
587       <xslo:if test="contains('a', @code)">
588         <z:index name="Name-and-title:w Subject:w Subject:p">
589           <xslo:value-of select="."/>
590         </z:index>
591       </xslo:if>
592     </xslo:for-each>
593     <xslo:for-each select="marc:subfield">
594       <xslo:if test="contains('t', @code)">
595         <z:index name="Name-and-title:w Title:w Subject:w Subject:p">
596           <xslo:value-of select="."/>
597         </z:index>
598       </xslo:if>
599     </xslo:for-each>
600     <xslo:for-each select="marc:subfield">
601       <xslo:if test="contains('9', @code)">
602         <z:index name="Koha-Auth-Number:w">
603           <xslo:value-of select="."/>
604         </z:index>
605       </xslo:if>
606     </xslo:for-each>
607   </xslo:template>
608   <xslo:template mode="index_subfields" match="marc:datafield[@tag='630']">
609     <xslo:for-each select="marc:subfield">
610       <xslo:if test="contains('n', @code)">
611         <z:index name="Thematic-number:w Subject:w Subject:p">
612           <xslo:value-of select="."/>
613         </z:index>
614       </xslo:if>
615     </xslo:for-each>
616     <xslo:for-each select="marc:subfield">
617       <xslo:if test="contains('r', @code)">
618         <z:index name="Music-key:w Subject:w Subject:p">
619           <xslo:value-of select="."/>
620         </z:index>
621       </xslo:if>
622     </xslo:for-each>
623     <xslo:for-each select="marc:subfield">
624       <xslo:if test="contains('9', @code)">
625         <z:index name="Koha-Auth-Number:w">
626           <xslo:value-of select="."/>
627         </z:index>
628       </xslo:if>
629     </xslo:for-each>
630   </xslo:template>
631   <xslo:template mode="index_subfields" match="marc:datafield[@tag='648']">
632     <xslo:for-each select="marc:subfield">
633       <xslo:if test="contains('9', @code)">
634         <z:index name="Koha-Auth-Number:w">
635           <xslo:value-of select="."/>
636         </z:index>
637       </xslo:if>
638     </xslo:for-each>
639   </xslo:template>
640   <xslo:template mode="index_subfields" match="marc:datafield[@tag='650']">
641     <xslo:for-each select="marc:subfield">
642       <xslo:if test="contains('9', @code)">
643         <z:index name="Koha-Auth-Number:w">
644           <xslo:value-of select="."/>
645         </z:index>
646       </xslo:if>
647     </xslo:for-each>
648   </xslo:template>
649   <xslo:template mode="index_subfields" match="marc:datafield[@tag='651']">
650     <xslo:for-each select="marc:subfield">
651       <xslo:if test="contains('9', @code)">
652         <z:index name="Koha-Auth-Number:w">
653           <xslo:value-of select="."/>
654         </z:index>
655       </xslo:if>
656     </xslo:for-each>
657   </xslo:template>
658   <xslo:template mode="index_subfields" match="marc:datafield[@tag='652']">
659     <xslo:for-each select="marc:subfield">
660       <xslo:if test="contains('9', @code)">
661         <z:index name="Koha-Auth-Number:w">
662           <xslo:value-of select="."/>
663         </z:index>
664       </xslo:if>
665     </xslo:for-each>
666   </xslo:template>
667   <xslo:template mode="index_subfields" match="marc:datafield[@tag='653']">
668     <xslo:for-each select="marc:subfield">
669       <xslo:if test="contains('a', @code)">
670         <z:index name="Index-term-uncontrolled:w Index-term-uncontrolled:p Subject:w Subject:p">
671           <xslo:value-of select="."/>
672         </z:index>
673       </xslo:if>
674     </xslo:for-each>
675     <xslo:for-each select="marc:subfield">
676       <xslo:if test="contains('9', @code)">
677         <z:index name="Koha-Auth-Number:w">
678           <xslo:value-of select="."/>
679         </z:index>
680       </xslo:if>
681     </xslo:for-each>
682   </xslo:template>
683   <xslo:template mode="index_subfields" match="marc:datafield[@tag='654']">
684     <xslo:for-each select="marc:subfield">
685       <xslo:if test="contains('9', @code)">
686         <z:index name="Koha-Auth-Number:w">
687           <xslo:value-of select="."/>
688         </z:index>
689       </xslo:if>
690     </xslo:for-each>
691   </xslo:template>
692   <xslo:template mode="index_subfields" match="marc:datafield[@tag='655']">
693     <xslo:for-each select="marc:subfield">
694       <xslo:if test="contains('a', @code)">
695         <z:index name="Index-term-genre:w Index-term-genre:p Subject:w Subject:p">
696           <xslo:value-of select="."/>
697         </z:index>
698       </xslo:if>
699     </xslo:for-each>
700     <xslo:for-each select="marc:subfield">
701       <xslo:if test="contains('9', @code)">
702         <z:index name="Koha-Auth-Number:w">
703           <xslo:value-of select="."/>
704         </z:index>
705       </xslo:if>
706     </xslo:for-each>
707   </xslo:template>
708   <xslo:template mode="index_subfields" match="marc:datafield[@tag='656']">
709     <xslo:for-each select="marc:subfield">
710       <xslo:if test="contains('9', @code)">
711         <z:index name="Koha-Auth-Number:w">
712           <xslo:value-of select="."/>
713         </z:index>
714       </xslo:if>
715     </xslo:for-each>
716   </xslo:template>
717   <xslo:template mode="index_subfields" match="marc:datafield[@tag='657']">
718     <xslo:for-each select="marc:subfield">
719       <xslo:if test="contains('9', @code)">
720         <z:index name="Koha-Auth-Number:w">
721           <xslo:value-of select="."/>
722         </z:index>
723       </xslo:if>
724     </xslo:for-each>
725   </xslo:template>
726   <xslo:template mode="index_subfields" match="marc:datafield[@tag='658']">
727     <xslo:for-each select="marc:subfield">
728       <xslo:if test="contains('a', @code)">
729         <z:index name="curriculum:w curriculum:p Subject:w Subject:p">
730           <xslo:value-of select="."/>
731         </z:index>
732       </xslo:if>
733     </xslo:for-each>
734     <xslo:for-each select="marc:subfield">
735       <xslo:if test="contains('b', @code)">
736         <z:index name="curriculum:w curriculum:p Subject:w Subject:p">
737           <xslo:value-of select="."/>
738         </z:index>
739       </xslo:if>
740     </xslo:for-each>
741     <xslo:for-each select="marc:subfield">
742       <xslo:if test="contains('c', @code)">
743         <z:index name="curriculum:w curriculum:p Subject:w Subject:p">
744           <xslo:value-of select="."/>
745         </z:index>
746       </xslo:if>
747     </xslo:for-each>
748   </xslo:template>
749   <xslo:template mode="index_subfields" match="marc:datafield[@tag='662']">
750     <xslo:for-each select="marc:subfield">
751       <xslo:if test="contains('9', @code)">
752         <z:index name="Koha-Auth-Number:w">
753           <xslo:value-of select="."/>
754         </z:index>
755       </xslo:if>
756     </xslo:for-each>
757   </xslo:template>
758   <xslo:template mode="index_subfields" match="marc:datafield[@tag='690']">
759     <xslo:for-each select="marc:subfield">
760       <xslo:if test="contains('9', @code)">
761         <z:index name="Koha-Auth-Number:w">
762           <xslo:value-of select="."/>
763         </z:index>
764       </xslo:if>
765     </xslo:for-each>
766   </xslo:template>
767   <xslo:template mode="index_subfields" match="marc:datafield[@tag='691']">
768     <xslo:for-each select="marc:subfield">
769       <xslo:if test="contains('9', @code)">
770         <z:index name="Koha-Auth-Number:w">
771           <xslo:value-of select="."/>
772         </z:index>
773       </xslo:if>
774     </xslo:for-each>
775   </xslo:template>
776   <xslo:template mode="index_subfields" match="marc:datafield[@tag='696']">
777     <xslo:for-each select="marc:subfield">
778       <xslo:if test="contains('9', @code)">
779         <z:index name="Koha-Auth-Number:w">
780           <xslo:value-of select="."/>
781         </z:index>
782       </xslo:if>
783     </xslo:for-each>
784   </xslo:template>
785   <xslo:template mode="index_subfields" match="marc:datafield[@tag='697']">
786     <xslo:for-each select="marc:subfield">
787       <xslo:if test="contains('9', @code)">
788         <z:index name="Koha-Auth-Number:w">
789           <xslo:value-of select="."/>
790         </z:index>
791       </xslo:if>
792     </xslo:for-each>
793   </xslo:template>
794   <xslo:template mode="index_subfields" match="marc:datafield[@tag='698']">
795     <xslo:for-each select="marc:subfield">
796       <xslo:if test="contains('9', @code)">
797         <z:index name="Koha-Auth-Number:w">
798           <xslo:value-of select="."/>
799         </z:index>
800       </xslo:if>
801     </xslo:for-each>
802   </xslo:template>
803   <xslo:template mode="index_subfields" match="marc:datafield[@tag='699']">
804     <xslo:for-each select="marc:subfield">
805       <xslo:if test="contains('9', @code)">
806         <z:index name="Koha-Auth-Number:w">
807           <xslo:value-of select="."/>
808         </z:index>
809       </xslo:if>
810     </xslo:for-each>
811   </xslo:template>
812   <xslo:template mode="index_subfields" match="marc:datafield[@tag='700']">
813     <xslo:for-each select="marc:subfield">
814       <xslo:if test="contains('9', @code)">
815         <z:index name="Cross-Reference:w Koha-Auth-Number:w">
816           <xslo:value-of select="."/>
817         </z:index>
818       </xslo:if>
819     </xslo:for-each>
820     <xslo:for-each select="marc:subfield">
821       <xslo:if test="contains('a', @code)">
822         <z:index name="Author:w Author:p">
823           <xslo:value-of select="."/>
824         </z:index>
825       </xslo:if>
826     </xslo:for-each>
827     <xslo:for-each select="marc:subfield">
828       <xslo:if test="contains('n', @code)">
829         <z:index name="Thematic-number:w">
830           <xslo:value-of select="."/>
831         </z:index>
832       </xslo:if>
833     </xslo:for-each>
834     <xslo:for-each select="marc:subfield">
835       <xslo:if test="contains('r', @code)">
836         <z:index name="Music-key:w">
837           <xslo:value-of select="."/>
838         </z:index>
839       </xslo:if>
840     </xslo:for-each>
841     <xslo:for-each select="marc:subfield">
842       <xslo:if test="contains('t', @code)">
843         <z:index name="Author-title:w Name-and-title:w Title:w Title-uniform:w">
844           <xslo:value-of select="."/>
845         </z:index>
846       </xslo:if>
847     </xslo:for-each>
848   </xslo:template>
849   <xslo:template mode="index_subfields" match="marc:datafield[@tag='710']">
850     <xslo:for-each select="marc:subfield">
851       <xslo:if test="contains('t', @code)">
852         <z:index name="Author-title:w Name-and-title:w Title:w Title-uniform:w">
853           <xslo:value-of select="."/>
854         </z:index>
855       </xslo:if>
856     </xslo:for-each>
857     <xslo:for-each select="marc:subfield">
858       <xslo:if test="contains('a', @code)">
859         <z:index name="Name-and-title:w">
860           <xslo:value-of select="."/>
861         </z:index>
862       </xslo:if>
863     </xslo:for-each>
864     <xslo:for-each select="marc:subfield">
865       <xslo:if test="contains('9', @code)">
866         <z:index name="Koha-Auth-Number:w">
867           <xslo:value-of select="."/>
868         </z:index>
869       </xslo:if>
870     </xslo:for-each>
871   </xslo:template>
872   <xslo:template mode="index_subfields" match="marc:datafield[@tag='711']">
873     <xslo:for-each select="marc:subfield">
874       <xslo:if test="contains('a', @code)">
875         <z:index name="Name-and-title:w">
876           <xslo:value-of select="."/>
877         </z:index>
878       </xslo:if>
879     </xslo:for-each>
880     <xslo:for-each select="marc:subfield">
881       <xslo:if test="contains('t', @code)">
882         <z:index name="Author-title:w Title:w Title-uniform:w">
883           <xslo:value-of select="."/>
884         </z:index>
885       </xslo:if>
886     </xslo:for-each>
887     <xslo:for-each select="marc:subfield">
888       <xslo:if test="contains('9', @code)">
889         <z:index name="Koha-Auth-Number:w">
890           <xslo:value-of select="."/>
891         </z:index>
892       </xslo:if>
893     </xslo:for-each>
894   </xslo:template>
895   <xslo:template mode="index_subfields" match="marc:datafield[@tag='730']">
896     <xslo:for-each select="marc:subfield">
897       <xslo:if test="contains('n', @code)">
898         <z:index name="Thematic-number:w">
899           <xslo:value-of select="."/>
900         </z:index>
901       </xslo:if>
902     </xslo:for-each>
903     <xslo:for-each select="marc:subfield">
904       <xslo:if test="contains('r', @code)">
905         <z:index name="Music-key:w">
906           <xslo:value-of select="."/>
907         </z:index>
908       </xslo:if>
909     </xslo:for-each>
910     <xslo:for-each select="marc:subfield">
911       <xslo:if test="contains('9', @code)">
912         <z:index name="Koha-Auth-Number:w">
913           <xslo:value-of select="."/>
914         </z:index>
915       </xslo:if>
916     </xslo:for-each>
917   </xslo:template>
918   <xslo:template mode="index_subfields" match="marc:datafield[@tag='751']">
919     <xslo:for-each select="marc:subfield">
920       <xslo:if test="contains('a', @code)">
921         <z:index name="Name-geographic:w">
922           <xslo:value-of select="."/>
923         </z:index>
924       </xslo:if>
925     </xslo:for-each>
926     <xslo:for-each select="marc:subfield">
927       <xslo:if test="contains('9', @code)">
928         <z:index name="Koha-Auth-Number:w">
929           <xslo:value-of select="."/>
930         </z:index>
931       </xslo:if>
932     </xslo:for-each>
933   </xslo:template>
934   <xslo:template mode="index_subfields" match="marc:datafield[@tag='770']">
935     <xslo:for-each select="marc:subfield">
936       <xslo:if test="contains('w', @code)">
937         <z:index name="Record-control-number:w">
938           <xslo:value-of select="."/>
939         </z:index>
940       </xslo:if>
941     </xslo:for-each>
942   </xslo:template>
943   <xslo:template mode="index_subfields" match="marc:datafield[@tag='772']">
944     <xslo:for-each select="marc:subfield">
945       <xslo:if test="contains('w', @code)">
946         <z:index name="Record-control-number:w">
947           <xslo:value-of select="."/>
948         </z:index>
949       </xslo:if>
950     </xslo:for-each>
951   </xslo:template>
952   <xslo:template mode="index_subfields" match="marc:datafield[@tag='773']">
953     <xslo:for-each select="marc:subfield">
954       <xslo:if test="contains('a', @code)">
955         <z:index name="Host-item:w">
956           <xslo:value-of select="."/>
957         </z:index>
958       </xslo:if>
959     </xslo:for-each>
960     <xslo:for-each select="marc:subfield">
961       <xslo:if test="contains('9', @code)">
962         <z:index name="Host-Item-Number:w">
963           <xslo:value-of select="."/>
964         </z:index>
965       </xslo:if>
966     </xslo:for-each>
967     <xslo:for-each select="marc:subfield">
968       <xslo:if test="contains('t', @code)">
969         <z:index name="Host-item:w">
970           <xslo:value-of select="."/>
971         </z:index>
972       </xslo:if>
973     </xslo:for-each>
974     <xslo:for-each select="marc:subfield">
975       <xslo:if test="contains('w', @code)">
976         <z:index name="Record-control-number:w">
977           <xslo:value-of select="."/>
978         </z:index>
979       </xslo:if>
980     </xslo:for-each>
981   </xslo:template>
982   <xslo:template mode="index_subfields" match="marc:datafield[@tag='774']">
983     <xslo:for-each select="marc:subfield">
984       <xslo:if test="contains('w', @code)">
985         <z:index name="Record-control-number:w">
986           <xslo:value-of select="."/>
987         </z:index>
988       </xslo:if>
989     </xslo:for-each>
990   </xslo:template>
991   <xslo:template mode="index_subfields" match="marc:datafield[@tag='775']">
992     <xslo:for-each select="marc:subfield">
993       <xslo:if test="contains('w', @code)">
994         <z:index name="Record-control-number:w">
995           <xslo:value-of select="."/>
996         </z:index>
997       </xslo:if>
998     </xslo:for-each>
999   </xslo:template>
1000   <xslo:template mode="index_subfields" match="marc:datafield[@tag='776']">
1001     <xslo:for-each select="marc:subfield">
1002       <xslo:if test="contains('w', @code)">
1003         <z:index name="Record-control-number:w">
1004           <xslo:value-of select="."/>
1005         </z:index>
1006       </xslo:if>
1007     </xslo:for-each>
1008   </xslo:template>
1009   <xslo:template mode="index_subfields" match="marc:datafield[@tag='777']">
1010     <xslo:for-each select="marc:subfield">
1011       <xslo:if test="contains('w', @code)">
1012         <z:index name="Record-control-number:w">
1013           <xslo:value-of select="."/>
1014         </z:index>
1015       </xslo:if>
1016     </xslo:for-each>
1017   </xslo:template>
1018   <xslo:template mode="index_subfields" match="marc:datafield[@tag='780']">
1019     <xslo:for-each select="marc:subfield">
1020       <xslo:if test="contains('t', @code)">
1021         <z:index name="Title:w">
1022           <xslo:value-of select="."/>
1023         </z:index>
1024       </xslo:if>
1025     </xslo:for-each>
1026     <xslo:for-each select="marc:subfield">
1027       <xslo:if test="contains('w', @code)">
1028         <z:index name="Record-control-number:w">
1029           <xslo:value-of select="."/>
1030         </z:index>
1031       </xslo:if>
1032     </xslo:for-each>
1033   </xslo:template>
1034   <xslo:template mode="index_subfields" match="marc:datafield[@tag='785']">
1035     <xslo:for-each select="marc:subfield">
1036       <xslo:if test="contains('w', @code)">
1037         <z:index name="Record-control-number:w">
1038           <xslo:value-of select="."/>
1039         </z:index>
1040       </xslo:if>
1041     </xslo:for-each>
1042   </xslo:template>
1043   <xslo:template mode="index_subfields" match="marc:datafield[@tag='787']">
1044     <xslo:for-each select="marc:subfield">
1045       <xslo:if test="contains('w', @code)">
1046         <z:index name="Record-control-number:w">
1047           <xslo:value-of select="."/>
1048         </z:index>
1049       </xslo:if>
1050     </xslo:for-each>
1051   </xslo:template>
1052   <xslo:template mode="index_subfields" match="marc:datafield[@tag='796']">
1053     <xslo:for-each select="marc:subfield">
1054       <xslo:if test="contains('9', @code)">
1055         <z:index name="Koha-Auth-Number:w">
1056           <xslo:value-of select="."/>
1057         </z:index>
1058       </xslo:if>
1059     </xslo:for-each>
1060   </xslo:template>
1061   <xslo:template mode="index_subfields" match="marc:datafield[@tag='797']">
1062     <xslo:for-each select="marc:subfield">
1063       <xslo:if test="contains('9', @code)">
1064         <z:index name="Koha-Auth-Number:w">
1065           <xslo:value-of select="."/>
1066         </z:index>
1067       </xslo:if>
1068     </xslo:for-each>
1069   </xslo:template>
1070   <xslo:template mode="index_subfields" match="marc:datafield[@tag='798']">
1071     <xslo:for-each select="marc:subfield">
1072       <xslo:if test="contains('9', @code)">
1073         <z:index name="Koha-Auth-Number:w">
1074           <xslo:value-of select="."/>
1075         </z:index>
1076       </xslo:if>
1077     </xslo:for-each>
1078   </xslo:template>
1079   <xslo:template mode="index_subfields" match="marc:datafield[@tag='799']">
1080     <xslo:for-each select="marc:subfield">
1081       <xslo:if test="contains('9', @code)">
1082         <z:index name="Koha-Auth-Number:w">
1083           <xslo:value-of select="."/>
1084         </z:index>
1085       </xslo:if>
1086     </xslo:for-each>
1087   </xslo:template>
1088   <xslo:template mode="index_subfields" match="marc:datafield[@tag='800']">
1089     <xslo:for-each select="marc:subfield">
1090       <xslo:if test="contains('a', @code)">
1091         <z:index name="Name-and-title:w Title-series:w Title-series:p">
1092           <xslo:value-of select="."/>
1093         </z:index>
1094       </xslo:if>
1095     </xslo:for-each>
1096     <xslo:for-each select="marc:subfield">
1097       <xslo:if test="contains('t', @code)">
1098         <z:index name="Author-title:w Name-and-title:w Title:w Title-series:w Title-series:p">
1099           <xslo:value-of select="."/>
1100         </z:index>
1101       </xslo:if>
1102     </xslo:for-each>
1103     <xslo:for-each select="marc:subfield">
1104       <xslo:if test="contains('9', @code)">
1105         <z:index name="Koha-Auth-Number:w">
1106           <xslo:value-of select="."/>
1107         </z:index>
1108       </xslo:if>
1109     </xslo:for-each>
1110     <xslo:for-each select="marc:subfield">
1111       <xslo:if test="contains('w', @code)">
1112         <z:index name="Record-control-number:w">
1113           <xslo:value-of select="."/>
1114         </z:index>
1115       </xslo:if>
1116     </xslo:for-each>
1117   </xslo:template>
1118   <xslo:template mode="index_subfields" match="marc:datafield[@tag='810']">
1119     <xslo:for-each select="marc:subfield">
1120       <xslo:if test="contains('a', @code)">
1121         <z:index name="Name-and-title:w Title-series:w Title-series:p">
1122           <xslo:value-of select="."/>
1123         </z:index>
1124       </xslo:if>
1125     </xslo:for-each>
1126     <xslo:for-each select="marc:subfield">
1127       <xslo:if test="contains('t', @code)">
1128         <z:index name="Author-title:w Name-and-title:w Title:w Title-series:w Title-series:p">
1129           <xslo:value-of select="."/>
1130         </z:index>
1131       </xslo:if>
1132     </xslo:for-each>
1133     <xslo:for-each select="marc:subfield">
1134       <xslo:if test="contains('w', @code)">
1135         <z:index name="Record-control-number:w">
1136           <xslo:value-of select="."/>
1137         </z:index>
1138       </xslo:if>
1139     </xslo:for-each>
1140     <xslo:for-each select="marc:subfield">
1141       <xslo:if test="contains('9', @code)">
1142         <z:index name="Koha-Auth-Number:w">
1143           <xslo:value-of select="."/>
1144         </z:index>
1145       </xslo:if>
1146     </xslo:for-each>
1147   </xslo:template>
1148   <xslo:template mode="index_subfields" match="marc:datafield[@tag='811']">
1149     <xslo:for-each select="marc:subfield">
1150       <xslo:if test="contains('a', @code)">
1151         <z:index name="Name-and-title:w Title-series:w Title-series:p">
1152           <xslo:value-of select="."/>
1153         </z:index>
1154       </xslo:if>
1155     </xslo:for-each>
1156     <xslo:for-each select="marc:subfield">
1157       <xslo:if test="contains('9', @code)">
1158         <z:index name="Koha-Auth-Number:w">
1159           <xslo:value-of select="."/>
1160         </z:index>
1161       </xslo:if>
1162     </xslo:for-each>
1163     <xslo:for-each select="marc:subfield">
1164       <xslo:if test="contains('t', @code)">
1165         <z:index name="Author-title:w Name-and-title:w Title:w Title-series:w Title-series:p">
1166           <xslo:value-of select="."/>
1167         </z:index>
1168       </xslo:if>
1169     </xslo:for-each>
1170     <xslo:for-each select="marc:subfield">
1171       <xslo:if test="contains('w', @code)">
1172         <z:index name="Record-control-number:w">
1173           <xslo:value-of select="."/>
1174         </z:index>
1175       </xslo:if>
1176     </xslo:for-each>
1177   </xslo:template>
1178   <xslo:template mode="index_subfields" match="marc:datafield[@tag='830']">
1179     <xslo:for-each select="marc:subfield">
1180       <xslo:if test="contains('w', @code)">
1181         <z:index name="Record-control-number:w">
1182           <xslo:value-of select="."/>
1183         </z:index>
1184       </xslo:if>
1185     </xslo:for-each>
1186     <xslo:for-each select="marc:subfield">
1187       <xslo:if test="contains('9', @code)">
1188         <z:index name="Koha-Auth-Number:w">
1189           <xslo:value-of select="."/>
1190         </z:index>
1191       </xslo:if>
1192     </xslo:for-each>
1193   </xslo:template>
1194   <xslo:template mode="index_subfields" match="marc:datafield[@tag='896']">
1195     <xslo:for-each select="marc:subfield">
1196       <xslo:if test="contains('9', @code)">
1197         <z:index name="Koha-Auth-Number:w">
1198           <xslo:value-of select="."/>
1199         </z:index>
1200       </xslo:if>
1201     </xslo:for-each>
1202   </xslo:template>
1203   <xslo:template mode="index_subfields" match="marc:datafield[@tag='897']">
1204     <xslo:for-each select="marc:subfield">
1205       <xslo:if test="contains('9', @code)">
1206         <z:index name="Koha-Auth-Number:w">
1207           <xslo:value-of select="."/>
1208         </z:index>
1209       </xslo:if>
1210     </xslo:for-each>
1211   </xslo:template>
1212   <xslo:template mode="index_subfields" match="marc:datafield[@tag='898']">
1213     <xslo:for-each select="marc:subfield">
1214       <xslo:if test="contains('9', @code)">
1215         <z:index name="Koha-Auth-Number:w">
1216           <xslo:value-of select="."/>
1217         </z:index>
1218       </xslo:if>
1219     </xslo:for-each>
1220   </xslo:template>
1221   <xslo:template mode="index_subfields" match="marc:datafield[@tag='899']">
1222     <xslo:for-each select="marc:subfield">
1223       <xslo:if test="contains('9', @code)">
1224         <z:index name="Koha-Auth-Number:w">
1225           <xslo:value-of select="."/>
1226         </z:index>
1227       </xslo:if>
1228     </xslo:for-each>
1229   </xslo:template>
1230   <xslo:template mode="index_subfields" match="marc:datafield[@tag='999']">
1231     <xslo:for-each select="marc:subfield">
1232       <xslo:if test="contains('c', @code)">
1233         <z:index name="Local-Number:n Local-Number:w Local-Number:s">
1234           <xslo:value-of select="."/>
1235         </z:index>
1236       </xslo:if>
1237     </xslo:for-each>
1238     <xslo:for-each select="marc:subfield">
1239       <xslo:if test="contains('d', @code)">
1240         <z:index name="biblioitemnumber:n biblioitemnumber:w biblioitemnumber:s">
1241           <xslo:value-of select="."/>
1242         </z:index>
1243       </xslo:if>
1244     </xslo:for-each>
1245   </xslo:template>
1246   <xslo:template mode="index_subfields" match="marc:datafield[@tag='942']">
1247     <xslo:for-each select="marc:subfield">
1248       <xslo:if test="contains('0', @code)">
1249         <z:index name="totalissues:n totalissues:s">
1250           <xslo:value-of select="."/>
1251         </z:index>
1252       </xslo:if>
1253     </xslo:for-each>
1254     <xslo:for-each select="marc:subfield">
1255       <xslo:if test="contains('2', @code)">
1256         <z:index name="cn-bib-source:w">
1257           <xslo:value-of select="."/>
1258         </z:index>
1259       </xslo:if>
1260     </xslo:for-each>
1261     <xslo:for-each select="marc:subfield">
1262       <xslo:if test="contains('6', @code)">
1263         <z:index name="cn-bib-sort:n cn-bib-sort:s">
1264           <xslo:value-of select="."/>
1265         </z:index>
1266       </xslo:if>
1267     </xslo:for-each>
1268     <xslo:for-each select="marc:subfield">
1269       <xslo:if test="contains('c', @code)">
1270         <z:index name="itemtype:w itemtype:p itype:w itype:p">
1271           <xslo:value-of select="."/>
1272         </z:index>
1273       </xslo:if>
1274     </xslo:for-each>
1275     <xslo:for-each select="marc:subfield">
1276       <xslo:if test="contains('n', @code)">
1277         <z:index name="Suppress:w Suppress:n">
1278           <xslo:value-of select="."/>
1279         </z:index>
1280       </xslo:if>
1281     </xslo:for-each>
1282     <xslo:for-each select="marc:subfield">
1283       <xslo:if test="contains('h', @code)">
1284         <z:index name="cn-class:w">
1285           <xslo:value-of select="."/>
1286         </z:index>
1287       </xslo:if>
1288     </xslo:for-each>
1289     <xslo:for-each select="marc:subfield">
1290       <xslo:if test="contains('i', @code)">
1291         <z:index name="cn-item:w">
1292           <xslo:value-of select="."/>
1293         </z:index>
1294       </xslo:if>
1295     </xslo:for-each>
1296     <xslo:for-each select="marc:subfield">
1297       <xslo:if test="contains('k', @code)">
1298         <z:index name="cn-prefix:w">
1299           <xslo:value-of select="."/>
1300         </z:index>
1301       </xslo:if>
1302     </xslo:for-each>
1303     <xslo:for-each select="marc:subfield">
1304       <xslo:if test="contains('m', @code)">
1305         <z:index name="cn-suffix:w">
1306           <xslo:value-of select="."/>
1307         </z:index>
1308       </xslo:if>
1309     </xslo:for-each>
1310   </xslo:template>
1311   <xslo:template mode="index_subfields" match="marc:datafield[@tag='952']">
1312     <xslo:for-each select="marc:subfield">
1313       <xslo:if test="contains('0', @code)">
1314         <z:index name="withdrawn:n withdrawn:w">
1315           <xslo:value-of select="."/>
1316         </z:index>
1317       </xslo:if>
1318     </xslo:for-each>
1319     <xslo:for-each select="marc:subfield">
1320       <xslo:if test="contains('1', @code)">
1321         <z:index name="lost:w lost:n">
1322           <xslo:value-of select="."/>
1323         </z:index>
1324       </xslo:if>
1325     </xslo:for-each>
1326     <xslo:for-each select="marc:subfield">
1327       <xslo:if test="contains('2', @code)">
1328         <z:index name="classification-source:w">
1329           <xslo:value-of select="."/>
1330         </z:index>
1331       </xslo:if>
1332     </xslo:for-each>
1333     <xslo:for-each select="marc:subfield">
1334       <xslo:if test="contains('3', @code)">
1335         <z:index name="materials-specified:w">
1336           <xslo:value-of select="."/>
1337         </z:index>
1338       </xslo:if>
1339     </xslo:for-each>
1340     <xslo:for-each select="marc:subfield">
1341       <xslo:if test="contains('4', @code)">
1342         <z:index name="damaged:n damaged:w">
1343           <xslo:value-of select="."/>
1344         </z:index>
1345       </xslo:if>
1346     </xslo:for-each>
1347     <xslo:for-each select="marc:subfield">
1348       <xslo:if test="contains('5', @code)">
1349         <z:index name="restricted:n restricted:w">
1350           <xslo:value-of select="."/>
1351         </z:index>
1352       </xslo:if>
1353     </xslo:for-each>
1354     <xslo:for-each select="marc:subfield">
1355       <xslo:if test="contains('6', @code)">
1356         <z:index name="cn-sort:n cn-sort:s">
1357           <xslo:value-of select="."/>
1358         </z:index>
1359       </xslo:if>
1360     </xslo:for-each>
1361     <xslo:for-each select="marc:subfield">
1362       <xslo:if test="contains('7', @code)">
1363         <z:index name="notforloan:n notforloan:w">
1364           <xslo:value-of select="."/>
1365         </z:index>
1366       </xslo:if>
1367     </xslo:for-each>
1368     <xslo:for-each select="marc:subfield">
1369       <xslo:if test="contains('8', @code)">
1370         <z:index name="ccode:w ccode:p">
1371           <xslo:value-of select="."/>
1372         </z:index>
1373       </xslo:if>
1374     </xslo:for-each>
1375     <xslo:for-each select="marc:subfield">
1376       <xslo:if test="contains('9', @code)">
1377         <z:index name="itemnumber:n itemnumber:s">
1378           <xslo:value-of select="."/>
1379         </z:index>
1380       </xslo:if>
1381     </xslo:for-each>
1382     <xslo:for-each select="marc:subfield">
1383       <xslo:if test="contains('a', @code)">
1384         <z:index name="homebranch:w">
1385           <xslo:value-of select="."/>
1386         </z:index>
1387       </xslo:if>
1388     </xslo:for-each>
1389     <xslo:for-each select="marc:subfield">
1390       <xslo:if test="contains('b', @code)">
1391         <z:index name="holdingbranch:w">
1392           <xslo:value-of select="."/>
1393         </z:index>
1394       </xslo:if>
1395     </xslo:for-each>
1396     <xslo:for-each select="marc:subfield">
1397       <xslo:if test="contains('c', @code)">
1398         <z:index name="location:w">
1399           <xslo:value-of select="."/>
1400         </z:index>
1401       </xslo:if>
1402     </xslo:for-each>
1403     <xslo:for-each select="marc:subfield">
1404       <xslo:if test="contains('d', @code)">
1405         <z:index name="Date-of-acquisition:w Date-of-acquisition:d Date-of-acquisition:s">
1406           <xslo:value-of select="."/>
1407         </z:index>
1408       </xslo:if>
1409     </xslo:for-each>
1410     <xslo:for-each select="marc:subfield">
1411       <xslo:if test="contains('e', @code)">
1412         <z:index name="acqsource:w">
1413           <xslo:value-of select="."/>
1414         </z:index>
1415       </xslo:if>
1416     </xslo:for-each>
1417     <xslo:for-each select="marc:subfield">
1418       <xslo:if test="contains('f', @code)">
1419         <z:index name="coded-location-qualifier:w">
1420           <xslo:value-of select="."/>
1421         </z:index>
1422       </xslo:if>
1423     </xslo:for-each>
1424     <xslo:for-each select="marc:subfield">
1425       <xslo:if test="contains('g', @code)">
1426         <z:index name="price:w">
1427           <xslo:value-of select="."/>
1428         </z:index>
1429       </xslo:if>
1430     </xslo:for-each>
1431     <xslo:for-each select="marc:subfield">
1432       <xslo:if test="contains('i', @code)">
1433         <z:index name="Number-local-acquisition:w">
1434           <xslo:value-of select="."/>
1435         </z:index>
1436       </xslo:if>
1437     </xslo:for-each>
1438     <xslo:for-each select="marc:subfield">
1439       <xslo:if test="contains('j', @code)">
1440         <z:index name="stack:n stack:w">
1441           <xslo:value-of select="."/>
1442         </z:index>
1443       </xslo:if>
1444     </xslo:for-each>
1445     <xslo:for-each select="marc:subfield">
1446       <xslo:if test="contains('l', @code)">
1447         <z:index name="issues:n issues:w issues:s">
1448           <xslo:value-of select="."/>
1449         </z:index>
1450       </xslo:if>
1451     </xslo:for-each>
1452     <xslo:for-each select="marc:subfield">
1453       <xslo:if test="contains('m', @code)">
1454         <z:index name="renewals:n renewals:w">
1455           <xslo:value-of select="."/>
1456         </z:index>
1457       </xslo:if>
1458     </xslo:for-each>
1459     <xslo:for-each select="marc:subfield">
1460       <xslo:if test="contains('n', @code)">
1461         <z:index name="reserves:n reserves:w">
1462           <xslo:value-of select="."/>
1463         </z:index>
1464       </xslo:if>
1465     </xslo:for-each>
1466     <xslo:for-each select="marc:subfield">
1467       <xslo:if test="contains('o', @code)">
1468         <z:index name="Local-classification:w Local-classification:p Local-classification:s">
1469           <xslo:value-of select="."/>
1470         </z:index>
1471       </xslo:if>
1472     </xslo:for-each>
1473     <xslo:for-each select="marc:subfield">
1474       <xslo:if test="contains('p', @code)">
1475         <z:index name="barcode:w barcode:n">
1476           <xslo:value-of select="."/>
1477         </z:index>
1478       </xslo:if>
1479     </xslo:for-each>
1480     <xslo:for-each select="marc:subfield">
1481       <xslo:if test="contains('q', @code)">
1482         <z:index name="onloan:n onloan:w">
1483           <xslo:value-of select="."/>
1484         </z:index>
1485       </xslo:if>
1486     </xslo:for-each>
1487     <xslo:for-each select="marc:subfield">
1488       <xslo:if test="contains('r', @code)">
1489         <z:index name="datelastseen:w">
1490           <xslo:value-of select="."/>
1491         </z:index>
1492       </xslo:if>
1493     </xslo:for-each>
1494     <xslo:for-each select="marc:subfield">
1495       <xslo:if test="contains('s', @code)">
1496         <z:index name="datelastborrowed:w">
1497           <xslo:value-of select="."/>
1498         </z:index>
1499       </xslo:if>
1500     </xslo:for-each>
1501     <xslo:for-each select="marc:subfield">
1502       <xslo:if test="contains('t', @code)">
1503         <z:index name="copynumber:w">
1504           <xslo:value-of select="."/>
1505         </z:index>
1506       </xslo:if>
1507     </xslo:for-each>
1508     <xslo:for-each select="marc:subfield">
1509       <xslo:if test="contains('u', @code)">
1510         <z:index name="uri:u">
1511           <xslo:value-of select="."/>
1512         </z:index>
1513       </xslo:if>
1514     </xslo:for-each>
1515     <xslo:for-each select="marc:subfield">
1516       <xslo:if test="contains('v', @code)">
1517         <z:index name="replacementprice:w">
1518           <xslo:value-of select="."/>
1519         </z:index>
1520       </xslo:if>
1521     </xslo:for-each>
1522     <xslo:for-each select="marc:subfield">
1523       <xslo:if test="contains('w', @code)">
1524         <z:index name="replacementpricedate:w">
1525           <xslo:value-of select="."/>
1526         </z:index>
1527       </xslo:if>
1528     </xslo:for-each>
1529     <xslo:for-each select="marc:subfield">
1530       <xslo:if test="contains('y', @code)">
1531         <z:index name="itype:w itype:p">
1532           <xslo:value-of select="."/>
1533         </z:index>
1534       </xslo:if>
1535     </xslo:for-each>
1536     <xslo:for-each select="marc:subfield">
1537       <xslo:if test="contains('z', @code)">
1538         <z:index name="Note:w Note:p">
1539           <xslo:value-of select="."/>
1540         </z:index>
1541       </xslo:if>
1542     </xslo:for-each>
1543   </xslo:template>
1544   <xslo:template mode="index_data_field" match="marc:datafield[@tag='010']">
1545     <z:index name="LC-card-number:w Identifier-standard:w">
1546       <xslo:variable name="raw_heading">
1547         <xslo:for-each select="marc:subfield">
1548           <xslo:if test="position() &gt; 1">
1549             <xslo:value-of select="substring(' ', 1, 1)"/>
1550           </xslo:if>
1551           <xslo:value-of select="."/>
1552         </xslo:for-each>
1553       </xslo:variable>
1554       <xslo:value-of select="normalize-space($raw_heading)"/>
1555     </z:index>
1556   </xslo:template>
1557   <xslo:template mode="index_data_field" match="marc:datafield[@tag='011']">
1558     <z:index name="LC-card-number:w Identifier-standard:w">
1559       <xslo:variable name="raw_heading">
1560         <xslo:for-each select="marc:subfield">
1561           <xslo:if test="position() &gt; 1">
1562             <xslo:value-of select="substring(' ', 1, 1)"/>
1563           </xslo:if>
1564           <xslo:value-of select="."/>
1565         </xslo:for-each>
1566       </xslo:variable>
1567       <xslo:value-of select="normalize-space($raw_heading)"/>
1568     </z:index>
1569   </xslo:template>
1570   <xslo:template mode="index_data_field" match="marc:datafield[@tag='015']">
1571     <z:index name="BNB-card-number:w BGF-number:w Number-db:w Number-natl-biblio:w Identifier-standard:w">
1572       <xslo:variable name="raw_heading">
1573         <xslo:for-each select="marc:subfield">
1574           <xslo:if test="position() &gt; 1">
1575             <xslo:value-of select="substring(' ', 1, 1)"/>
1576           </xslo:if>
1577           <xslo:value-of select="."/>
1578         </xslo:for-each>
1579       </xslo:variable>
1580       <xslo:value-of select="normalize-space($raw_heading)"/>
1581     </z:index>
1582   </xslo:template>
1583   <xslo:template mode="index_data_field" match="marc:datafield[@tag='017']">
1584     <z:index name="Number-legal-deposit:w Identifier-standard:w">
1585       <xslo:variable name="raw_heading">
1586         <xslo:for-each select="marc:subfield">
1587           <xslo:if test="position() &gt; 1">
1588             <xslo:value-of select="substring(' ', 1, 1)"/>
1589           </xslo:if>
1590           <xslo:value-of select="."/>
1591         </xslo:for-each>
1592       </xslo:variable>
1593       <xslo:value-of select="normalize-space($raw_heading)"/>
1594     </z:index>
1595   </xslo:template>
1596   <xslo:template mode="index_data_field" match="marc:datafield[@tag='018']">
1597     <z:index name="Identifier-standard:w">
1598       <xslo:variable name="raw_heading">
1599         <xslo:for-each select="marc:subfield">
1600           <xslo:if test="position() &gt; 1">
1601             <xslo:value-of select="substring(' ', 1, 1)"/>
1602           </xslo:if>
1603           <xslo:value-of select="."/>
1604         </xslo:for-each>
1605       </xslo:variable>
1606       <xslo:value-of select="normalize-space($raw_heading)"/>
1607     </z:index>
1608   </xslo:template>
1609   <xslo:template mode="index_data_field" match="marc:datafield[@tag='020']">
1610     <z:index name="Identifier-standard:w">
1611       <xslo:variable name="raw_heading">
1612         <xslo:for-each select="marc:subfield">
1613           <xslo:if test="position() &gt; 1">
1614             <xslo:value-of select="substring(' ', 1, 1)"/>
1615           </xslo:if>
1616           <xslo:value-of select="."/>
1617         </xslo:for-each>
1618       </xslo:variable>
1619       <xslo:value-of select="normalize-space($raw_heading)"/>
1620     </z:index>
1621   </xslo:template>
1622   <xslo:template mode="index_data_field" match="marc:datafield[@tag='022']">
1623     <z:index name="Identifier-standard:w">
1624       <xslo:variable name="raw_heading">
1625         <xslo:for-each select="marc:subfield">
1626           <xslo:if test="position() &gt; 1">
1627             <xslo:value-of select="substring(' ', 1, 1)"/>
1628           </xslo:if>
1629           <xslo:value-of select="."/>
1630         </xslo:for-each>
1631       </xslo:variable>
1632       <xslo:value-of select="normalize-space($raw_heading)"/>
1633     </z:index>
1634   </xslo:template>
1635   <xslo:template mode="index_data_field" match="marc:datafield[@tag='023']">
1636     <z:index name="Identifier-standard:w">
1637       <xslo:variable name="raw_heading">
1638         <xslo:for-each select="marc:subfield">
1639           <xslo:if test="position() &gt; 1">
1640             <xslo:value-of select="substring(' ', 1, 1)"/>
1641           </xslo:if>
1642           <xslo:value-of select="."/>
1643         </xslo:for-each>
1644       </xslo:variable>
1645       <xslo:value-of select="normalize-space($raw_heading)"/>
1646     </z:index>
1647   </xslo:template>
1648   <xslo:template mode="index_data_field" match="marc:datafield[@tag='024']">
1649     <z:index name="Identifier-standard:w">
1650       <xslo:variable name="raw_heading">
1651         <xslo:for-each select="marc:subfield">
1652           <xslo:if test="position() &gt; 1">
1653             <xslo:value-of select="substring(' ', 1, 1)"/>
1654           </xslo:if>
1655           <xslo:value-of select="."/>
1656         </xslo:for-each>
1657       </xslo:variable>
1658       <xslo:value-of select="normalize-space($raw_heading)"/>
1659     </z:index>
1660   </xslo:template>
1661   <xslo:template mode="index_data_field" match="marc:datafield[@tag='025']">
1662     <z:index name="Identifier-standard:w">
1663       <xslo:variable name="raw_heading">
1664         <xslo:for-each select="marc:subfield">
1665           <xslo:if test="position() &gt; 1">
1666             <xslo:value-of select="substring(' ', 1, 1)"/>
1667           </xslo:if>
1668           <xslo:value-of select="."/>
1669         </xslo:for-each>
1670       </xslo:variable>
1671       <xslo:value-of select="normalize-space($raw_heading)"/>
1672     </z:index>
1673   </xslo:template>
1674   <xslo:template mode="index_data_field" match="marc:datafield[@tag='027']">
1675     <z:index name="Report-number:w Identifier-standard:w">
1676       <xslo:variable name="raw_heading">
1677         <xslo:for-each select="marc:subfield">
1678           <xslo:if test="position() &gt; 1">
1679             <xslo:value-of select="substring(' ', 1, 1)"/>
1680           </xslo:if>
1681           <xslo:value-of select="."/>
1682         </xslo:for-each>
1683       </xslo:variable>
1684       <xslo:value-of select="normalize-space($raw_heading)"/>
1685     </z:index>
1686   </xslo:template>
1687   <xslo:template mode="index_data_field" match="marc:datafield[@tag='028']">
1688     <z:index name="Identifier-publisher-for-music:w Identifier-standard:w">
1689       <xslo:variable name="raw_heading">
1690         <xslo:for-each select="marc:subfield">
1691           <xslo:if test="position() &gt; 1">
1692             <xslo:value-of select="substring(' ', 1, 1)"/>
1693           </xslo:if>
1694           <xslo:value-of select="."/>
1695         </xslo:for-each>
1696       </xslo:variable>
1697       <xslo:value-of select="normalize-space($raw_heading)"/>
1698     </z:index>
1699   </xslo:template>
1700   <xslo:template mode="index_data_field" match="marc:datafield[@tag='030']">
1701     <z:index name="CODEN:w Identifier-standard:w">
1702       <xslo:variable name="raw_heading">
1703         <xslo:for-each select="marc:subfield">
1704           <xslo:if test="position() &gt; 1">
1705             <xslo:value-of select="substring(' ', 1, 1)"/>
1706           </xslo:if>
1707           <xslo:value-of select="."/>
1708         </xslo:for-each>
1709       </xslo:variable>
1710       <xslo:value-of select="normalize-space($raw_heading)"/>
1711     </z:index>
1712   </xslo:template>
1713   <xslo:template mode="index_data_field" match="marc:datafield[@tag='034']">
1714     <z:index name="Map-scale:w">
1715       <xslo:variable name="raw_heading">
1716         <xslo:for-each select="marc:subfield">
1717           <xslo:if test="position() &gt; 1">
1718             <xslo:value-of select="substring(' ', 1, 1)"/>
1719           </xslo:if>
1720           <xslo:value-of select="."/>
1721         </xslo:for-each>
1722       </xslo:variable>
1723       <xslo:value-of select="normalize-space($raw_heading)"/>
1724     </z:index>
1725   </xslo:template>
1726   <xslo:template mode="index_data_field" match="marc:datafield[@tag='035']">
1727     <z:index name="Other-control-number:w">
1728       <xslo:variable name="raw_heading">
1729         <xslo:for-each select="marc:subfield">
1730           <xslo:if test="position() &gt; 1">
1731             <xslo:value-of select="substring(' ', 1, 1)"/>
1732           </xslo:if>
1733           <xslo:value-of select="."/>
1734         </xslo:for-each>
1735       </xslo:variable>
1736       <xslo:value-of select="normalize-space($raw_heading)"/>
1737     </z:index>
1738   </xslo:template>
1739   <xslo:template mode="index_data_field" match="marc:datafield[@tag='037']">
1740     <z:index name="Identifier-standard:w Stock-number:w">
1741       <xslo:variable name="raw_heading">
1742         <xslo:for-each select="marc:subfield">
1743           <xslo:if test="position() &gt; 1">
1744             <xslo:value-of select="substring(' ', 1, 1)"/>
1745           </xslo:if>
1746           <xslo:value-of select="."/>
1747         </xslo:for-each>
1748       </xslo:variable>
1749       <xslo:value-of select="normalize-space($raw_heading)"/>
1750     </z:index>
1751   </xslo:template>
1752   <xslo:template mode="index_data_field" match="marc:datafield[@tag='040']">
1753     <z:index name="Code-institution:w Record-source:w">
1754       <xslo:variable name="raw_heading">
1755         <xslo:for-each select="marc:subfield">
1756           <xslo:if test="position() &gt; 1">
1757             <xslo:value-of select="substring(' ', 1, 1)"/>
1758           </xslo:if>
1759           <xslo:value-of select="."/>
1760         </xslo:for-each>
1761       </xslo:variable>
1762       <xslo:value-of select="normalize-space($raw_heading)"/>
1763     </z:index>
1764   </xslo:template>
1765   <xslo:template mode="index_data_field" match="marc:datafield[@tag='043']">
1766     <z:index name="Code-geographic:w">
1767       <xslo:variable name="raw_heading">
1768         <xslo:for-each select="marc:subfield">
1769           <xslo:if test="position() &gt; 1">
1770             <xslo:value-of select="substring(' ', 1, 1)"/>
1771           </xslo:if>
1772           <xslo:value-of select="."/>
1773         </xslo:for-each>
1774       </xslo:variable>
1775       <xslo:value-of select="normalize-space($raw_heading)"/>
1776     </z:index>
1777   </xslo:template>
1778   <xslo:template mode="index_data_field" match="marc:datafield[@tag='050']">
1779     <z:index name="LC-call-number:w LC-call-number:p LC-call-number:s">
1780       <xslo:variable name="raw_heading">
1781         <xslo:for-each select="marc:subfield">
1782           <xslo:if test="position() &gt; 1">
1783             <xslo:value-of select="substring(' ', 1, 1)"/>
1784           </xslo:if>
1785           <xslo:value-of select="."/>
1786         </xslo:for-each>
1787       </xslo:variable>
1788       <xslo:value-of select="normalize-space($raw_heading)"/>
1789     </z:index>
1790   </xslo:template>
1791   <xslo:template mode="index_data_field" match="marc:datafield[@tag='052']">
1792     <z:index name="Geographic-class:w">
1793       <xslo:variable name="raw_heading">
1794         <xslo:for-each select="marc:subfield">
1795           <xslo:if test="position() &gt; 1">
1796             <xslo:value-of select="substring(' ', 1, 1)"/>
1797           </xslo:if>
1798           <xslo:value-of select="."/>
1799         </xslo:for-each>
1800       </xslo:variable>
1801       <xslo:value-of select="normalize-space($raw_heading)"/>
1802     </z:index>
1803   </xslo:template>
1804   <xslo:template mode="index_data_field" match="marc:datafield[@tag='060']">
1805     <z:index name="NLM-call-number:w">
1806       <xslo:variable name="raw_heading">
1807         <xslo:for-each select="marc:subfield">
1808           <xslo:if test="position() &gt; 1">
1809             <xslo:value-of select="substring(' ', 1, 1)"/>
1810           </xslo:if>
1811           <xslo:value-of select="."/>
1812         </xslo:for-each>
1813       </xslo:variable>
1814       <xslo:value-of select="normalize-space($raw_heading)"/>
1815     </z:index>
1816   </xslo:template>
1817   <xslo:template mode="index_data_field" match="marc:datafield[@tag='070']">
1818     <z:index name="NAL-call-number:w">
1819       <xslo:variable name="raw_heading">
1820         <xslo:for-each select="marc:subfield">
1821           <xslo:if test="position() &gt; 1">
1822             <xslo:value-of select="substring(' ', 1, 1)"/>
1823           </xslo:if>
1824           <xslo:value-of select="."/>
1825         </xslo:for-each>
1826       </xslo:variable>
1827       <xslo:value-of select="normalize-space($raw_heading)"/>
1828     </z:index>
1829   </xslo:template>
1830   <xslo:template mode="index_data_field" match="marc:datafield[@tag='080']">
1831     <z:index name="UDC-classification:w">
1832       <xslo:variable name="raw_heading">
1833         <xslo:for-each select="marc:subfield">
1834           <xslo:if test="position() &gt; 1">
1835             <xslo:value-of select="substring(' ', 1, 1)"/>
1836           </xslo:if>
1837           <xslo:value-of select="."/>
1838         </xslo:for-each>
1839       </xslo:variable>
1840       <xslo:value-of select="normalize-space($raw_heading)"/>
1841     </z:index>
1842   </xslo:template>
1843   <xslo:template mode="index_data_field" match="marc:datafield[@tag='082']">
1844     <z:index name="Dewey-classification:w Dewey-classification:s">
1845       <xslo:variable name="raw_heading">
1846         <xslo:for-each select="marc:subfield">
1847           <xslo:if test="position() &gt; 1">
1848             <xslo:value-of select="substring(' ', 1, 1)"/>
1849           </xslo:if>
1850           <xslo:value-of select="."/>
1851         </xslo:for-each>
1852       </xslo:variable>
1853       <xslo:value-of select="normalize-space($raw_heading)"/>
1854     </z:index>
1855   </xslo:template>
1856   <xslo:template mode="index_data_field" match="marc:datafield[@tag='086']">
1857     <z:index name="Number-govt-pub:w">
1858       <xslo:variable name="raw_heading">
1859         <xslo:for-each select="marc:subfield">
1860           <xslo:if test="position() &gt; 1">
1861             <xslo:value-of select="substring(' ', 1, 1)"/>
1862           </xslo:if>
1863           <xslo:value-of select="."/>
1864         </xslo:for-each>
1865       </xslo:variable>
1866       <xslo:value-of select="normalize-space($raw_heading)"/>
1867     </z:index>
1868   </xslo:template>
1869   <xslo:template mode="index_data_field" match="marc:datafield[@tag='100']">
1870     <z:index name="Author:w Author:p Author:s Author-title:w Author-name-personal:w Name:w Name-and-title:w Personal-name:w">
1871       <xslo:variable name="raw_heading">
1872         <xslo:for-each select="marc:subfield">
1873           <xslo:if test="position() &gt; 1">
1874             <xslo:value-of select="substring(' ', 1, 1)"/>
1875           </xslo:if>
1876           <xslo:value-of select="."/>
1877         </xslo:for-each>
1878       </xslo:variable>
1879       <xslo:value-of select="normalize-space($raw_heading)"/>
1880     </z:index>
1881   </xslo:template>
1882   <xslo:template mode="index_data_field" match="marc:datafield[@tag='110']">
1883     <z:index name="Author:w Author:p Author:s Author-title:w Author-name-corporate:w Name:w Name-and-title:w Corporate-name:w">
1884       <xslo:variable name="raw_heading">
1885         <xslo:for-each select="marc:subfield">
1886           <xslo:if test="position() &gt; 1">
1887             <xslo:value-of select="substring(' ', 1, 1)"/>
1888           </xslo:if>
1889           <xslo:value-of select="."/>
1890         </xslo:for-each>
1891       </xslo:variable>
1892       <xslo:value-of select="normalize-space($raw_heading)"/>
1893     </z:index>
1894   </xslo:template>
1895   <xslo:template mode="index_data_field" match="marc:datafield[@tag='111']">
1896     <z:index name="Author:w Author:p Author:s Author-title:w Author-name-corporate:w Name:w Name-and-title:w Conference-name:w">
1897       <xslo:variable name="raw_heading">
1898         <xslo:for-each select="marc:subfield">
1899           <xslo:if test="position() &gt; 1">
1900             <xslo:value-of select="substring(' ', 1, 1)"/>
1901           </xslo:if>
1902           <xslo:value-of select="."/>
1903         </xslo:for-each>
1904       </xslo:variable>
1905       <xslo:value-of select="normalize-space($raw_heading)"/>
1906     </z:index>
1907   </xslo:template>
1908   <xslo:template mode="index_data_field" match="marc:datafield[@tag='130']">
1909     <z:index name="Title:w Title:p Title-uniform:w">
1910       <xslo:variable name="raw_heading">
1911         <xslo:for-each select="marc:subfield">
1912           <xslo:if test="position() &gt; 1">
1913             <xslo:value-of select="substring(' ', 1, 1)"/>
1914           </xslo:if>
1915           <xslo:value-of select="."/>
1916         </xslo:for-each>
1917       </xslo:variable>
1918       <xslo:value-of select="normalize-space($raw_heading)"/>
1919     </z:index>
1920   </xslo:template>
1921   <xslo:template mode="index_data_field" match="marc:datafield[@tag='210']">
1922     <z:index name="Title:w Title:p Title-abbreviated:w">
1923       <xslo:variable name="raw_heading">
1924         <xslo:for-each select="marc:subfield">
1925           <xslo:if test="position() &gt; 1">
1926             <xslo:value-of select="substring(' ', 1, 1)"/>
1927           </xslo:if>
1928           <xslo:value-of select="."/>
1929         </xslo:for-each>
1930       </xslo:variable>
1931       <xslo:value-of select="normalize-space($raw_heading)"/>
1932     </z:index>
1933   </xslo:template>
1934   <xslo:template mode="index_data_field" match="marc:datafield[@tag='211']">
1935     <z:index name="Title:w Title:p Title-abbreviated:w">
1936       <xslo:variable name="raw_heading">
1937         <xslo:for-each select="marc:subfield">
1938           <xslo:if test="position() &gt; 1">
1939             <xslo:value-of select="substring(' ', 1, 1)"/>
1940           </xslo:if>
1941           <xslo:value-of select="."/>
1942         </xslo:for-each>
1943       </xslo:variable>
1944       <xslo:value-of select="normalize-space($raw_heading)"/>
1945     </z:index>
1946   </xslo:template>
1947   <xslo:template mode="index_data_field" match="marc:datafield[@tag='212']">
1948     <z:index name="Title:w Title:p Title-other-variant:w">
1949       <xslo:variable name="raw_heading">
1950         <xslo:for-each select="marc:subfield">
1951           <xslo:if test="position() &gt; 1">
1952             <xslo:value-of select="substring(' ', 1, 1)"/>
1953           </xslo:if>
1954           <xslo:value-of select="."/>
1955         </xslo:for-each>
1956       </xslo:variable>
1957       <xslo:value-of select="normalize-space($raw_heading)"/>
1958     </z:index>
1959   </xslo:template>
1960   <xslo:template mode="index_data_field" match="marc:datafield[@tag='214']">
1961     <z:index name="Title:w Title:p Title-expanded:w">
1962       <xslo:variable name="raw_heading">
1963         <xslo:for-each select="marc:subfield">
1964           <xslo:if test="position() &gt; 1">
1965             <xslo:value-of select="substring(' ', 1, 1)"/>
1966           </xslo:if>
1967           <xslo:value-of select="."/>
1968         </xslo:for-each>
1969       </xslo:variable>
1970       <xslo:value-of select="normalize-space($raw_heading)"/>
1971     </z:index>
1972   </xslo:template>
1973   <xslo:template mode="index_data_field" match="marc:datafield[@tag='222']">
1974     <z:index name="Title:w Title:p Title-key:w">
1975       <xslo:variable name="raw_heading">
1976         <xslo:for-each select="marc:subfield">
1977           <xslo:if test="position() &gt; 1">
1978             <xslo:value-of select="substring(' ', 1, 1)"/>
1979           </xslo:if>
1980           <xslo:value-of select="."/>
1981         </xslo:for-each>
1982       </xslo:variable>
1983       <xslo:value-of select="normalize-space($raw_heading)"/>
1984     </z:index>
1985   </xslo:template>
1986   <xslo:template mode="index_data_field" match="marc:datafield[@tag='240']">
1987     <z:index name="Title:w Title:p Title-uniform:w">
1988       <xslo:variable name="raw_heading">
1989         <xslo:for-each select="marc:subfield">
1990           <xslo:if test="position() &gt; 1">
1991             <xslo:value-of select="substring(' ', 1, 1)"/>
1992           </xslo:if>
1993           <xslo:value-of select="."/>
1994         </xslo:for-each>
1995       </xslo:variable>
1996       <xslo:value-of select="normalize-space($raw_heading)"/>
1997     </z:index>
1998   </xslo:template>
1999   <xslo:template mode="index_data_field" match="marc:datafield[@tag='243']">
2000     <z:index name="Title:w Title:p Title-collective:w">
2001       <xslo:variable name="raw_heading">
2002         <xslo:for-each select="marc:subfield">
2003           <xslo:if test="position() &gt; 1">
2004             <xslo:value-of select="substring(' ', 1, 1)"/>
2005           </xslo:if>
2006           <xslo:value-of select="."/>
2007         </xslo:for-each>
2008       </xslo:variable>
2009       <xslo:value-of select="normalize-space($raw_heading)"/>
2010     </z:index>
2011   </xslo:template>
2012   <xslo:template mode="index_data_field" match="marc:datafield[@tag='245']">
2013     <z:index name="Title:w Title:p">
2014       <xslo:variable name="raw_heading">
2015         <xslo:for-each select="marc:subfield">
2016           <xslo:if test="position() &gt; 1">
2017             <xslo:value-of select="substring(' ', 1, 1)"/>
2018           </xslo:if>
2019           <xslo:value-of select="."/>
2020         </xslo:for-each>
2021       </xslo:variable>
2022       <xslo:value-of select="normalize-space($raw_heading)"/>
2023     </z:index>
2024   </xslo:template>
2025   <xslo:template mode="index_data_field" match="marc:datafield[@tag='246']">
2026     <z:index name="Title:w Title:p Title-abbreviated:w Title-expanded:w Title-former:w">
2027       <xslo:variable name="raw_heading">
2028         <xslo:for-each select="marc:subfield">
2029           <xslo:if test="position() &gt; 1">
2030             <xslo:value-of select="substring(' ', 1, 1)"/>
2031           </xslo:if>
2032           <xslo:value-of select="."/>
2033         </xslo:for-each>
2034       </xslo:variable>
2035       <xslo:value-of select="normalize-space($raw_heading)"/>
2036     </z:index>
2037   </xslo:template>
2038   <xslo:template mode="index_data_field" match="marc:datafield[@tag='247']">
2039     <z:index name="Title:w Title:p Title-former:w Title-other-variant:w Related-periodical:w">
2040       <xslo:variable name="raw_heading">
2041         <xslo:for-each select="marc:subfield">
2042           <xslo:if test="position() &gt; 1">
2043             <xslo:value-of select="substring(' ', 1, 1)"/>
2044           </xslo:if>
2045           <xslo:value-of select="."/>
2046         </xslo:for-each>
2047       </xslo:variable>
2048       <xslo:value-of select="normalize-space($raw_heading)"/>
2049     </z:index>
2050   </xslo:template>
2051   <xslo:template mode="index_data_field" match="marc:datafield[@tag='260']">
2052     <z:index name="pl:w Provider:w">
2053       <xslo:variable name="raw_heading">
2054         <xslo:for-each select="marc:subfield">
2055           <xslo:if test="position() &gt; 1">
2056             <xslo:value-of select="substring(' ', 1, 1)"/>
2057           </xslo:if>
2058           <xslo:value-of select="."/>
2059         </xslo:for-each>
2060       </xslo:variable>
2061       <xslo:value-of select="normalize-space($raw_heading)"/>
2062     </z:index>
2063   </xslo:template>
2064   <xslo:template mode="index_data_field" match="marc:datafield[@tag='264']">
2065     <z:index name="Provider:w">
2066       <xslo:variable name="raw_heading">
2067         <xslo:for-each select="marc:subfield">
2068           <xslo:if test="position() &gt; 1">
2069             <xslo:value-of select="substring(' ', 1, 1)"/>
2070           </xslo:if>
2071           <xslo:value-of select="."/>
2072         </xslo:for-each>
2073       </xslo:variable>
2074       <xslo:value-of select="normalize-space($raw_heading)"/>
2075     </z:index>
2076   </xslo:template>
2077   <xslo:template mode="index_data_field" match="marc:datafield[@tag='300']">
2078     <z:index name="Extent:w Extent:p">
2079       <xslo:variable name="raw_heading">
2080         <xslo:for-each select="marc:subfield">
2081           <xslo:if test="position() &gt; 1">
2082             <xslo:value-of select="substring(' ', 1, 1)"/>
2083           </xslo:if>
2084           <xslo:value-of select="."/>
2085         </xslo:for-each>
2086       </xslo:variable>
2087       <xslo:value-of select="normalize-space($raw_heading)"/>
2088     </z:index>
2089   </xslo:template>
2090   <xslo:template mode="index_data_field" match="marc:datafield[@tag='400']">
2091     <z:index name="Author:w Author-name-personal:w Name:w Personal-name:w">
2092       <xslo:variable name="raw_heading">
2093         <xslo:for-each select="marc:subfield">
2094           <xslo:if test="position() &gt; 1">
2095             <xslo:value-of select="substring(' ', 1, 1)"/>
2096           </xslo:if>
2097           <xslo:value-of select="."/>
2098         </xslo:for-each>
2099       </xslo:variable>
2100       <xslo:value-of select="normalize-space($raw_heading)"/>
2101     </z:index>
2102   </xslo:template>
2103   <xslo:template mode="index_data_field" match="marc:datafield[@tag='410']">
2104     <z:index name="Author:w Corporate-name:w">
2105       <xslo:variable name="raw_heading">
2106         <xslo:for-each select="marc:subfield">
2107           <xslo:if test="position() &gt; 1">
2108             <xslo:value-of select="substring(' ', 1, 1)"/>
2109           </xslo:if>
2110           <xslo:value-of select="."/>
2111         </xslo:for-each>
2112       </xslo:variable>
2113       <xslo:value-of select="normalize-space($raw_heading)"/>
2114     </z:index>
2115   </xslo:template>
2116   <xslo:template mode="index_data_field" match="marc:datafield[@tag='411']">
2117     <z:index name="Author:w Conference-name:w">
2118       <xslo:variable name="raw_heading">
2119         <xslo:for-each select="marc:subfield">
2120           <xslo:if test="position() &gt; 1">
2121             <xslo:value-of select="substring(' ', 1, 1)"/>
2122           </xslo:if>
2123           <xslo:value-of select="."/>
2124         </xslo:for-each>
2125       </xslo:variable>
2126       <xslo:value-of select="normalize-space($raw_heading)"/>
2127     </z:index>
2128   </xslo:template>
2129   <xslo:template mode="index_data_field" match="marc:datafield[@tag='440']">
2130     <z:index name="Title-series:w Title-series:p Title:w Title-series:w">
2131       <xslo:variable name="raw_heading">
2132         <xslo:for-each select="marc:subfield">
2133           <xslo:if test="position() &gt; 1">
2134             <xslo:value-of select="substring(' ', 1, 1)"/>
2135           </xslo:if>
2136           <xslo:value-of select="."/>
2137         </xslo:for-each>
2138       </xslo:variable>
2139       <xslo:value-of select="normalize-space($raw_heading)"/>
2140     </z:index>
2141   </xslo:template>
2142   <xslo:template mode="index_data_field" match="marc:datafield[@tag='490']">
2143     <z:index name="Title:w Title-series:w">
2144       <xslo:variable name="raw_heading">
2145         <xslo:for-each select="marc:subfield">
2146           <xslo:if test="position() &gt; 1">
2147             <xslo:value-of select="substring(' ', 1, 1)"/>
2148           </xslo:if>
2149           <xslo:value-of select="."/>
2150         </xslo:for-each>
2151       </xslo:variable>
2152       <xslo:value-of select="normalize-space($raw_heading)"/>
2153     </z:index>
2154   </xslo:template>
2155   <xslo:template mode="index_data_field" match="marc:datafield[@tag='500']">
2156     <z:index name="Note:w Note:p">
2157       <xslo:variable name="raw_heading">
2158         <xslo:for-each select="marc:subfield">
2159           <xslo:if test="position() &gt; 1">
2160             <xslo:value-of select="substring(' ', 1, 1)"/>
2161           </xslo:if>
2162           <xslo:value-of select="."/>
2163         </xslo:for-each>
2164       </xslo:variable>
2165       <xslo:value-of select="normalize-space($raw_heading)"/>
2166     </z:index>
2167   </xslo:template>
2168   <xslo:template mode="index_data_field" match="marc:datafield[@tag='502']">
2169     <z:index name="Material-type:w Dissertation-information:p Dissertation-information:w">
2170       <xslo:variable name="raw_heading">
2171         <xslo:for-each select="marc:subfield">
2172           <xslo:if test="position() &gt; 1">
2173             <xslo:value-of select="substring(' ', 1, 1)"/>
2174           </xslo:if>
2175           <xslo:value-of select="."/>
2176         </xslo:for-each>
2177       </xslo:variable>
2178       <xslo:value-of select="normalize-space($raw_heading)"/>
2179     </z:index>
2180   </xslo:template>
2181   <xslo:template mode="index_data_field" match="marc:datafield[@tag='505']">
2182     <z:index name="Note:w Note:p">
2183       <xslo:variable name="raw_heading">
2184         <xslo:for-each select="marc:subfield">
2185           <xslo:if test="position() &gt; 1">
2186             <xslo:value-of select="substring(' ', 1, 1)"/>
2187           </xslo:if>
2188           <xslo:value-of select="."/>
2189         </xslo:for-each>
2190       </xslo:variable>
2191       <xslo:value-of select="normalize-space($raw_heading)"/>
2192     </z:index>
2193   </xslo:template>
2194   <xslo:template mode="index_data_field" match="marc:datafield[@tag='510']">
2195     <z:index name="Indexed-by:w">
2196       <xslo:variable name="raw_heading">
2197         <xslo:for-each select="marc:subfield">
2198           <xslo:if test="position() &gt; 1">
2199             <xslo:value-of select="substring(' ', 1, 1)"/>
2200           </xslo:if>
2201           <xslo:value-of select="."/>
2202         </xslo:for-each>
2203       </xslo:variable>
2204       <xslo:value-of select="normalize-space($raw_heading)"/>
2205     </z:index>
2206   </xslo:template>
2207   <xslo:template mode="index_data_field" match="marc:datafield[@tag='520']">
2208     <z:index name="Abstract:w Abstract:p">
2209       <xslo:variable name="raw_heading">
2210         <xslo:for-each select="marc:subfield">
2211           <xslo:if test="position() &gt; 1">
2212             <xslo:value-of select="substring(' ', 1, 1)"/>
2213           </xslo:if>
2214           <xslo:value-of select="."/>
2215         </xslo:for-each>
2216       </xslo:variable>
2217       <xslo:value-of select="normalize-space($raw_heading)"/>
2218     </z:index>
2219   </xslo:template>
2220   <xslo:template mode="index_data_field" match="marc:datafield[@tag='590']">
2221     <z:index name="Note:w Note:p">
2222       <xslo:variable name="raw_heading">
2223         <xslo:for-each select="marc:subfield">
2224           <xslo:if test="position() &gt; 1">
2225             <xslo:value-of select="substring(' ', 1, 1)"/>
2226           </xslo:if>
2227           <xslo:value-of select="."/>
2228         </xslo:for-each>
2229       </xslo:variable>
2230       <xslo:value-of select="normalize-space($raw_heading)"/>
2231     </z:index>
2232   </xslo:template>
2233   <xslo:template mode="index_data_field" match="marc:datafield[@tag='600']">
2234     <z:index name="Name:w Personal-name:w Subject-name-personal:w Subject:w Subject:p">
2235       <xslo:variable name="raw_heading">
2236         <xslo:for-each select="marc:subfield">
2237           <xslo:if test="position() &gt; 1">
2238             <xslo:value-of select="substring(' ', 1, 1)"/>
2239           </xslo:if>
2240           <xslo:value-of select="."/>
2241         </xslo:for-each>
2242       </xslo:variable>
2243       <xslo:value-of select="normalize-space($raw_heading)"/>
2244     </z:index>
2245   </xslo:template>
2246   <xslo:template mode="index_data_field" match="marc:datafield[@tag='610']">
2247     <z:index name="Name:w Subject:w Subject:p Corporate-name:w">
2248       <xslo:variable name="raw_heading">
2249         <xslo:for-each select="marc:subfield">
2250           <xslo:if test="position() &gt; 1">
2251             <xslo:value-of select="substring(' ', 1, 1)"/>
2252           </xslo:if>
2253           <xslo:value-of select="."/>
2254         </xslo:for-each>
2255       </xslo:variable>
2256       <xslo:value-of select="normalize-space($raw_heading)"/>
2257     </z:index>
2258   </xslo:template>
2259   <xslo:template mode="index_data_field" match="marc:datafield[@tag='611']">
2260     <z:index name="Conference-name:w Name:w Subject:w Subject:p">
2261       <xslo:variable name="raw_heading">
2262         <xslo:for-each select="marc:subfield">
2263           <xslo:if test="position() &gt; 1">
2264             <xslo:value-of select="substring(' ', 1, 1)"/>
2265           </xslo:if>
2266           <xslo:value-of select="."/>
2267         </xslo:for-each>
2268       </xslo:variable>
2269       <xslo:value-of select="normalize-space($raw_heading)"/>
2270     </z:index>
2271   </xslo:template>
2272   <xslo:template mode="index_data_field" match="marc:datafield[@tag='630']">
2273     <z:index name="Subject:w Subject:p">
2274       <xslo:variable name="raw_heading">
2275         <xslo:for-each select="marc:subfield">
2276           <xslo:if test="position() &gt; 1">
2277             <xslo:value-of select="substring(' ', 1, 1)"/>
2278           </xslo:if>
2279           <xslo:value-of select="."/>
2280         </xslo:for-each>
2281       </xslo:variable>
2282       <xslo:value-of select="normalize-space($raw_heading)"/>
2283     </z:index>
2284   </xslo:template>
2285   <xslo:template mode="index_data_field" match="marc:datafield[@tag='650']">
2286     <z:index name="Subject:w Subject:p">
2287       <xslo:variable name="raw_heading">
2288         <xslo:for-each select="marc:subfield">
2289           <xslo:if test="position() &gt; 1">
2290             <xslo:value-of select="substring(' ', 1, 1)"/>
2291           </xslo:if>
2292           <xslo:value-of select="."/>
2293         </xslo:for-each>
2294       </xslo:variable>
2295       <xslo:value-of select="normalize-space($raw_heading)"/>
2296     </z:index>
2297   </xslo:template>
2298   <xslo:template mode="index_data_field" match="marc:datafield[@tag='651']">
2299     <z:index name="Name-geographic:w Subject:w Subject:p">
2300       <xslo:variable name="raw_heading">
2301         <xslo:for-each select="marc:subfield">
2302           <xslo:if test="position() &gt; 1">
2303             <xslo:value-of select="substring(' ', 1, 1)"/>
2304           </xslo:if>
2305           <xslo:value-of select="."/>
2306         </xslo:for-each>
2307       </xslo:variable>
2308       <xslo:value-of select="normalize-space($raw_heading)"/>
2309     </z:index>
2310   </xslo:template>
2311   <xslo:template mode="index_data_field" match="marc:datafield[@tag='653']">
2312     <z:index name="Subject:w Subject:p">
2313       <xslo:variable name="raw_heading">
2314         <xslo:for-each select="marc:subfield">
2315           <xslo:if test="position() &gt; 1">
2316             <xslo:value-of select="substring(' ', 1, 1)"/>
2317           </xslo:if>
2318           <xslo:value-of select="."/>
2319         </xslo:for-each>
2320       </xslo:variable>
2321       <xslo:value-of select="normalize-space($raw_heading)"/>
2322     </z:index>
2323   </xslo:template>
2324   <xslo:template mode="index_data_field" match="marc:datafield[@tag='654']">
2325     <z:index name="Subject:w Subject:p">
2326       <xslo:variable name="raw_heading">
2327         <xslo:for-each select="marc:subfield">
2328           <xslo:if test="position() &gt; 1">
2329             <xslo:value-of select="substring(' ', 1, 1)"/>
2330           </xslo:if>
2331           <xslo:value-of select="."/>
2332         </xslo:for-each>
2333       </xslo:variable>
2334       <xslo:value-of select="normalize-space($raw_heading)"/>
2335     </z:index>
2336   </xslo:template>
2337   <xslo:template mode="index_data_field" match="marc:datafield[@tag='655']">
2338     <z:index name="Subject:w Subject:p">
2339       <xslo:variable name="raw_heading">
2340         <xslo:for-each select="marc:subfield">
2341           <xslo:if test="position() &gt; 1">
2342             <xslo:value-of select="substring(' ', 1, 1)"/>
2343           </xslo:if>
2344           <xslo:value-of select="."/>
2345         </xslo:for-each>
2346       </xslo:variable>
2347       <xslo:value-of select="normalize-space($raw_heading)"/>
2348     </z:index>
2349   </xslo:template>
2350   <xslo:template mode="index_data_field" match="marc:datafield[@tag='656']">
2351     <z:index name="Subject:w Subject:p">
2352       <xslo:variable name="raw_heading">
2353         <xslo:for-each select="marc:subfield">
2354           <xslo:if test="position() &gt; 1">
2355             <xslo:value-of select="substring(' ', 1, 1)"/>
2356           </xslo:if>
2357           <xslo:value-of select="."/>
2358         </xslo:for-each>
2359       </xslo:variable>
2360       <xslo:value-of select="normalize-space($raw_heading)"/>
2361     </z:index>
2362   </xslo:template>
2363   <xslo:template mode="index_data_field" match="marc:datafield[@tag='657']">
2364     <z:index name="Subject:w Subject:p">
2365       <xslo:variable name="raw_heading">
2366         <xslo:for-each select="marc:subfield">
2367           <xslo:if test="position() &gt; 1">
2368             <xslo:value-of select="substring(' ', 1, 1)"/>
2369           </xslo:if>
2370           <xslo:value-of select="."/>
2371         </xslo:for-each>
2372       </xslo:variable>
2373       <xslo:value-of select="normalize-space($raw_heading)"/>
2374     </z:index>
2375   </xslo:template>
2376   <xslo:template mode="index_data_field" match="marc:datafield[@tag='658']">
2377     <z:index name="Subject:w Subject:p">
2378       <xslo:variable name="raw_heading">
2379         <xslo:for-each select="marc:subfield">
2380           <xslo:if test="position() &gt; 1">
2381             <xslo:value-of select="substring(' ', 1, 1)"/>
2382           </xslo:if>
2383           <xslo:value-of select="."/>
2384         </xslo:for-each>
2385       </xslo:variable>
2386       <xslo:value-of select="normalize-space($raw_heading)"/>
2387     </z:index>
2388   </xslo:template>
2389   <xslo:template mode="index_data_field" match="marc:datafield[@tag='690']">
2390     <z:index name="Subject:w Subject:p">
2391       <xslo:variable name="raw_heading">
2392         <xslo:for-each select="marc:subfield">
2393           <xslo:if test="position() &gt; 1">
2394             <xslo:value-of select="substring(' ', 1, 1)"/>
2395           </xslo:if>
2396           <xslo:value-of select="."/>
2397         </xslo:for-each>
2398       </xslo:variable>
2399       <xslo:value-of select="normalize-space($raw_heading)"/>
2400     </z:index>
2401   </xslo:template>
2402   <xslo:template mode="index_data_field" match="marc:datafield[@tag='700']">
2403     <z:index name="Author:w Author:p Author-name-personal:w Name:w Editor:w Personal-name:w">
2404       <xslo:variable name="raw_heading">
2405         <xslo:for-each select="marc:subfield">
2406           <xslo:if test="position() &gt; 1">
2407             <xslo:value-of select="substring(' ', 1, 1)"/>
2408           </xslo:if>
2409           <xslo:value-of select="."/>
2410         </xslo:for-each>
2411       </xslo:variable>
2412       <xslo:value-of select="normalize-space($raw_heading)"/>
2413     </z:index>
2414   </xslo:template>
2415   <xslo:template mode="index_data_field" match="marc:datafield[@tag='710']">
2416     <z:index name="Author:w Author:p Corporate-name:w Name:w">
2417       <xslo:variable name="raw_heading">
2418         <xslo:for-each select="marc:subfield">
2419           <xslo:if test="position() &gt; 1">
2420             <xslo:value-of select="substring(' ', 1, 1)"/>
2421           </xslo:if>
2422           <xslo:value-of select="."/>
2423         </xslo:for-each>
2424       </xslo:variable>
2425       <xslo:value-of select="normalize-space($raw_heading)"/>
2426     </z:index>
2427   </xslo:template>
2428   <xslo:template mode="index_data_field" match="marc:datafield[@tag='711']">
2429     <z:index name="Author:w Author:p Author-name-corporate:w Name:w Conference-name:w">
2430       <xslo:variable name="raw_heading">
2431         <xslo:for-each select="marc:subfield">
2432           <xslo:if test="position() &gt; 1">
2433             <xslo:value-of select="substring(' ', 1, 1)"/>
2434           </xslo:if>
2435           <xslo:value-of select="."/>
2436         </xslo:for-each>
2437       </xslo:variable>
2438       <xslo:value-of select="normalize-space($raw_heading)"/>
2439     </z:index>
2440   </xslo:template>
2441   <xslo:template mode="index_data_field" match="marc:datafield[@tag='730']">
2442     <z:index name="Title:w Title:p Title-uniform:w">
2443       <xslo:variable name="raw_heading">
2444         <xslo:for-each select="marc:subfield">
2445           <xslo:if test="position() &gt; 1">
2446             <xslo:value-of select="substring(' ', 1, 1)"/>
2447           </xslo:if>
2448           <xslo:value-of select="."/>
2449         </xslo:for-each>
2450       </xslo:variable>
2451       <xslo:value-of select="normalize-space($raw_heading)"/>
2452     </z:index>
2453   </xslo:template>
2454   <xslo:template mode="index_data_field" match="marc:datafield[@tag='740']">
2455     <z:index name="Title:w Title:p Title-other-variant:w">
2456       <xslo:variable name="raw_heading">
2457         <xslo:for-each select="marc:subfield">
2458           <xslo:if test="position() &gt; 1">
2459             <xslo:value-of select="substring(' ', 1, 1)"/>
2460           </xslo:if>
2461           <xslo:value-of select="."/>
2462         </xslo:for-each>
2463       </xslo:variable>
2464       <xslo:value-of select="normalize-space($raw_heading)"/>
2465     </z:index>
2466   </xslo:template>
2467   <xslo:template mode="index_data_field" match="marc:datafield[@tag='751']">
2468     <z:index name="Name-geographic:w">
2469       <xslo:variable name="raw_heading">
2470         <xslo:for-each select="marc:subfield">
2471           <xslo:if test="position() &gt; 1">
2472             <xslo:value-of select="substring(' ', 1, 1)"/>
2473           </xslo:if>
2474           <xslo:value-of select="."/>
2475         </xslo:for-each>
2476       </xslo:variable>
2477       <xslo:value-of select="normalize-space($raw_heading)"/>
2478     </z:index>
2479   </xslo:template>
2480   <xslo:template mode="index_data_field" match="marc:datafield[@tag='780']">
2481     <z:index name="Title:w Title:p Title-former:w Related-periodical:w">
2482       <xslo:variable name="raw_heading">
2483         <xslo:for-each select="marc:subfield">
2484           <xslo:if test="position() &gt; 1">
2485             <xslo:value-of select="substring(' ', 1, 1)"/>
2486           </xslo:if>
2487           <xslo:value-of select="."/>
2488         </xslo:for-each>
2489       </xslo:variable>
2490       <xslo:value-of select="normalize-space($raw_heading)"/>
2491     </z:index>
2492   </xslo:template>
2493   <xslo:template mode="index_data_field" match="marc:datafield[@tag='785']">
2494     <z:index name="Title:w Title:p Title-later:w Related-periodical:w">
2495       <xslo:variable name="raw_heading">
2496         <xslo:for-each select="marc:subfield">
2497           <xslo:if test="position() &gt; 1">
2498             <xslo:value-of select="substring(' ', 1, 1)"/>
2499           </xslo:if>
2500           <xslo:value-of select="."/>
2501         </xslo:for-each>
2502       </xslo:variable>
2503       <xslo:value-of select="normalize-space($raw_heading)"/>
2504     </z:index>
2505   </xslo:template>
2506   <xslo:template mode="index_data_field" match="marc:datafield[@tag='800']">
2507     <z:index name="Author:w Author-name-personal:w Name:w Personal-name:w">
2508       <xslo:variable name="raw_heading">
2509         <xslo:for-each select="marc:subfield">
2510           <xslo:if test="position() &gt; 1">
2511             <xslo:value-of select="substring(' ', 1, 1)"/>
2512           </xslo:if>
2513           <xslo:value-of select="."/>
2514         </xslo:for-each>
2515       </xslo:variable>
2516       <xslo:value-of select="normalize-space($raw_heading)"/>
2517     </z:index>
2518   </xslo:template>
2519   <xslo:template mode="index_data_field" match="marc:datafield[@tag='810']">
2520     <z:index name="Author:w Corporate-name:w Author-name-corporate:w Name:w">
2521       <xslo:variable name="raw_heading">
2522         <xslo:for-each select="marc:subfield">
2523           <xslo:if test="position() &gt; 1">
2524             <xslo:value-of select="substring(' ', 1, 1)"/>
2525           </xslo:if>
2526           <xslo:value-of select="."/>
2527         </xslo:for-each>
2528       </xslo:variable>
2529       <xslo:value-of select="normalize-space($raw_heading)"/>
2530     </z:index>
2531   </xslo:template>
2532   <xslo:template mode="index_data_field" match="marc:datafield[@tag='811']">
2533     <z:index name="Author:w Author-name-corporate:w Name:w Conference-name:w">
2534       <xslo:variable name="raw_heading">
2535         <xslo:for-each select="marc:subfield">
2536           <xslo:if test="position() &gt; 1">
2537             <xslo:value-of select="substring(' ', 1, 1)"/>
2538           </xslo:if>
2539           <xslo:value-of select="."/>
2540         </xslo:for-each>
2541       </xslo:variable>
2542       <xslo:value-of select="normalize-space($raw_heading)"/>
2543     </z:index>
2544   </xslo:template>
2545   <xslo:template mode="index_data_field" match="marc:datafield[@tag='830']">
2546     <z:index name="Title:w Title-series:w Title-series:p">
2547       <xslo:variable name="raw_heading">
2548         <xslo:for-each select="marc:subfield">
2549           <xslo:if test="position() &gt; 1">
2550             <xslo:value-of select="substring(' ', 1, 1)"/>
2551           </xslo:if>
2552           <xslo:value-of select="."/>
2553         </xslo:for-each>
2554       </xslo:variable>
2555       <xslo:value-of select="normalize-space($raw_heading)"/>
2556     </z:index>
2557   </xslo:template>
2558   <xslo:template mode="index_data_field" match="marc:datafield[@tag='840']">
2559     <z:index name="Title:w Title-series:w Title-series:p">
2560       <xslo:variable name="raw_heading">
2561         <xslo:for-each select="marc:subfield">
2562           <xslo:if test="position() &gt; 1">
2563             <xslo:value-of select="substring(' ', 1, 1)"/>
2564           </xslo:if>
2565           <xslo:value-of select="."/>
2566         </xslo:for-each>
2567       </xslo:variable>
2568       <xslo:value-of select="normalize-space($raw_heading)"/>
2569     </z:index>
2570   </xslo:template>
2571   <xslo:template mode="index_facets" match="marc:datafield[@tag='100']">
2572     <xslo:if test="not(@ind1='z')">
2573       <z:index name="au:0">
2574         <xslo:value-of select="marc:subfield[@code='a']"/>
2575       </z:index>
2576     </xslo:if>
2577   </xslo:template>
2578   <xslo:template mode="index_facets" match="marc:datafield[@tag='110']">
2579     <xslo:if test="not(@ind1='z')">
2580       <z:index name="au:0">
2581         <xslo:value-of select="marc:subfield[@code='a']"/>
2582       </z:index>
2583     </xslo:if>
2584   </xslo:template>
2585   <xslo:template mode="index_facets" match="marc:datafield[@tag='440']">
2586     <xslo:if test="not(@ind1='z')">
2587       <z:index name="se:0">
2588         <xslo:value-of select="marc:subfield[@code='a']"/>
2589       </z:index>
2590     </xslo:if>
2591   </xslo:template>
2592   <xslo:template mode="index_facets" match="marc:datafield[@tag='490']">
2593     <xslo:if test="not(@ind1='z')">
2594       <z:index name="se:0">
2595         <xslo:value-of select="marc:subfield[@code='a']"/>
2596       </z:index>
2597     </xslo:if>
2598   </xslo:template>
2599   <xslo:template mode="index_facets" match="marc:datafield[@tag='630']">
2600     <xslo:if test="not(@ind1='z')">
2601       <z:index name="su-ut:0">
2602         <xslo:value-of select="marc:subfield[@code='a']"/>
2603       </z:index>
2604     </xslo:if>
2605   </xslo:template>
2606   <xslo:template mode="index_facets" match="marc:datafield[@tag='650']">
2607     <xslo:if test="not(@ind1='z')">
2608       <z:index name="su-to:0">
2609         <xslo:value-of select="marc:subfield[@code='a']"/>
2610       </z:index>
2611     </xslo:if>
2612   </xslo:template>
2613   <xslo:template mode="index_facets" match="marc:datafield[@tag='651']">
2614     <xslo:if test="not(@ind1='z')">
2615       <z:index name="su-geo:0">
2616         <xslo:value-of select="marc:subfield[@code='a']"/>
2617       </z:index>
2618     </xslo:if>
2619   </xslo:template>
2620   <xslo:template mode="index_facets" match="marc:datafield[@tag='700']">
2621     <xslo:if test="not(@ind1='z')">
2622       <z:index name="au:0">
2623         <xslo:value-of select="marc:subfield[@code='a']"/>
2624       </z:index>
2625     </xslo:if>
2626   </xslo:template>
2627   <xslo:template mode="index_facets" match="marc:datafield[@tag='942']">
2628     <xslo:if test="not(@ind1='z')">
2629       <z:index name="itype:0">
2630         <xslo:value-of select="marc:subfield[@code='c']"/>
2631       </z:index>
2632     </xslo:if>
2633   </xslo:template>
2634   <xslo:template mode="index_facets" match="marc:datafield[@tag='952']">
2635     <xslo:if test="not(@ind1='z')">
2636       <z:index name="homebranch:0">
2637         <xslo:value-of select="marc:subfield[@code='a']"/>
2638       </z:index>
2639       <z:index name="holdingbranch:0">
2640         <xslo:value-of select="marc:subfield[@code='b']"/>
2641       </z:index>
2642       <z:index name="location:0">
2643         <xslo:value-of select="marc:subfield[@code='c']"/>
2644       </z:index>
2645       <z:index name="itype:0">
2646         <xslo:value-of select="marc:subfield[@code='y']"/>
2647       </z:index>
2648     </xslo:if>
2649   </xslo:template>
2650   <xslo:template mode="index_all" match="text()">
2651     <z:index name="Any:w Any:p">
2652       <xslo:value-of select="."/>
2653     </z:index>
2654   </xslo:template>
2655   <xslo:template mode="index_sort_tit" match="marc:datafield[@tag='245']">
2656     <xslo:variable name="chop">
2657       <xslo:choose>
2658         <xslo:when test="not(number(@ind2))">0</xslo:when>
2659         <xslo:otherwise>
2660           <xslo:value-of select="number(@ind2)"/>
2661         </xslo:otherwise>
2662       </xslo:choose>
2663     </xslo:variable>
2664     <z:index name="Title:s">
2665       <xslo:value-of select="substring(marc:subfield[@code='a'], $chop+1)"/>
2666     </z:index>
2667   </xslo:template>
2668   <xslo:template name="chopPunctuation">
2669     <xslo:param name="chopString"/>
2670     <xslo:variable name="length" select="string-length($chopString)"/>
2671     <xslo:choose>
2672       <xslo:when test="$length=0"/>
2673       <xslo:when test="contains('-,.:=;!%/', substring($chopString,$length,1))">
2674         <xslo:call-template name="chopPunctuation">
2675           <xslo:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
2676         </xslo:call-template>
2677       </xslo:when>
2678       <xslo:when test="not($chopString)"/>
2679       <xslo:otherwise>
2680         <xslo:value-of select="$chopString"/>
2681       </xslo:otherwise>
2682     </xslo:choose>
2683     <xslo:text/>
2684   </xslo:template>
2685 </xslo:stylesheet>