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