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