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