Bug 8805 - Add a biblio-zebra-indexdefs.xsl for NORMARC
[koha.git] / etc / zebradb / marc_defs / normarc / 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_heading"/>
16   <xslo:template match="text()" mode="index_heading_conditional"/>
17   <xslo:template match="text()" mode="index_match_heading"/>
18   <xslo:template match="text()" mode="index_subject_thesaurus"/>
19   <xslo:template match="/">
20     <xslo:if test="marc:collection">
21       <collection>
22         <xslo:apply-templates select="marc:collection/marc:record"/>
23       </collection>
24     </xslo:if>
25     <xslo:if test="marc:record">
26       <xslo:apply-templates select="marc:record"/>
27     </xslo:if>
28   </xslo:template>
29   <xslo:template match="marc:record">
30     <xslo:variable name="idfield" select="normalize-space()"/>
31     <z:record type="update">
32       <xslo:attribute name="z:id">
33         <xslo:value-of select="$idfield"/>
34       </xslo:attribute>
35       <xslo:apply-templates/>
36       <xslo:apply-templates mode="index_subfields"/>
37       <xslo:apply-templates mode="index_data_field"/>
38       <xslo:apply-templates mode="index_heading"/>
39       <xslo:apply-templates mode="index_heading_conditional"/>
40       <xslo:apply-templates mode="index_match_heading"/>
41       <xslo:apply-templates mode="index_subject_thesaurus"/>
42     </z:record>
43   </xslo:template>
44   <xslo:template match="marc:leader">
45     <z:index name="llength:w">
46       <xslo:value-of select="substring(., 1, 5)"/>
47     </z:index>
48     <z:index name="rtype:w">
49       <xslo:value-of select="substring(., 7, 1)"/>
50     </z:index>
51     <z:index name="Bib-level:w">
52       <xslo:value-of select="substring(., 8, 1)"/>
53     </z:index>
54   </xslo:template>
55   <xslo:template match="marc:controlfield[@tag='001']">
56     <z:index name="Control-number:w">
57       <xslo:value-of select="."/>
58     </z:index>
59   </xslo:template>
60   <xslo:template match="marc:controlfield[@tag='007']">
61     <z:index name="Microform-generation:n">
62       <xslo:value-of select="substring(., 12, 1)"/>
63     </z:index>
64     <z:index name="Material-type:w">
65       <xslo:value-of select="."/>
66     </z:index>
67     <z:index name="ff7-00:w">
68       <xslo:value-of select="substring(., 1, 1)"/>
69     </z:index>
70     <z:index name="ff7-01:w">
71       <xslo:value-of select="substring(., 2, 1)"/>
72     </z:index>
73     <z:index name="ff7-02:w">
74       <xslo:value-of select="substring(., 3, 1)"/>
75     </z:index>
76     <z:index name="ff7-01-02:w">
77       <xslo:value-of select="substring(., 1, 2)"/>
78     </z:index>
79   </xslo:template>
80   <xslo:template match="marc:controlfield[@tag='008']">
81     <z:index name="date-entered-on-file:n">
82       <xslo:value-of select="substring(., 1, 5)"/>
83     </z:index>
84     <z:index name="date-entered-on-file:s">
85       <xslo:value-of select="substring(., 1, 5)"/>
86     </z:index>
87     <z:index name="pubdate:w">
88       <xslo:value-of select="substring(., 8, 4)"/>
89     </z:index>
90     <z:index name="pubdate:n">
91       <xslo:value-of select="substring(., 8, 4)"/>
92     </z:index>
93     <z:index name="pubdate:y">
94       <xslo:value-of select="substring(., 8, 4)"/>
95     </z:index>
96     <z:index name="pubdate:s">
97       <xslo:value-of select="substring(., 8, 4)"/>
98     </z:index>
99     <z:index name="pl:w">
100       <xslo:value-of select="substring(., 16, 3)"/>
101     </z:index>
102     <z:index name="ta:w">
103       <xslo:value-of select="substring(., 23, 1)"/>
104     </z:index>
105     <z:index name="ff8-23:w">
106       <xslo:value-of select="substring(., 24, 1)"/>
107     </z:index>
108     <z:index name="ff8-29:w">
109       <xslo:value-of select="substring(., 30, 1)"/>
110     </z:index>
111     <z:index name="lf:w">
112       <xslo:value-of select="substring(., 34, 1)"/>
113     </z:index>
114     <z:index name="bio:w">
115       <xslo:value-of select="substring(., 35, 1)"/>
116     </z:index>
117     <z:index name="ln:n">
118       <xslo:value-of select="substring(., 36, 3)"/>
119     </z:index>
120     <z:index name="ctype:w">
121       <xslo:value-of select="substring(., 25, 4)"/>
122     </z:index>
123     <z:index name="Record-source:w">
124       <xslo:value-of select="substring(., 40, 0)"/>
125     </z:index>
126   </xslo:template>
127   <xslo:template mode="index_subfields" match="marc:datafield[@tag='020']">
128     <xslo:for-each select="marc:subfield">
129       <xslo:if test="contains('a', @code)">
130         <z:index name="ISBN:w Identifier-standard:w">
131           <xslo:value-of select="."/>
132         </z:index>
133       </xslo:if>
134     </xslo:for-each>
135   </xslo:template>
136   <xslo:template mode="index_subfields" match="marc:datafield[@tag='022']">
137     <xslo:for-each select="marc:subfield">
138       <xslo:if test="contains('a', @code)">
139         <z:index name="ISSN:w ISBN:w">
140           <xslo:value-of select="."/>
141         </z:index>
142       </xslo:if>
143     </xslo:for-each>
144   </xslo:template>
145   <xslo:template mode="index_subfields" match="marc:datafield[@tag='100']">
146     <xslo:for-each select="marc:subfield">
147       <xslo:if test="contains('9', @code)">
148         <z:index name="Cross-Reference:w Koha-Auth-Number:w">
149           <xslo:value-of select="."/>
150         </z:index>
151       </xslo:if>
152     </xslo:for-each>
153     <xslo:for-each select="marc:subfield">
154       <xslo:if test="contains('a', @code)">
155         <z:index name="Author:w Author:p Author:s Editor:w Author-personal-bibliography:w Author-personal-bibliography:p Author-personal-bibliography:s">
156           <xslo:value-of select="."/>
157         </z:index>
158       </xslo:if>
159     </xslo:for-each>
160   </xslo:template>
161   <xslo:template mode="index_subfields" match="marc:datafield[@tag='110']">
162     <xslo:for-each select="marc:subfield">
163       <xslo:if test="contains('9', @code)">
164         <z:index name="Koha-Auth-Number:w">
165           <xslo:value-of select="."/>
166         </z:index>
167       </xslo:if>
168     </xslo:for-each>
169   </xslo:template>
170   <xslo:template mode="index_subfields" match="marc:datafield[@tag='111']">
171     <xslo:for-each select="marc:subfield">
172       <xslo:if test="contains('9', @code)">
173         <z:index name="Koha-Auth-Number:w">
174           <xslo:value-of select="."/>
175         </z:index>
176       </xslo:if>
177     </xslo:for-each>
178   </xslo:template>
179   <xslo:template mode="index_subfields" match="marc:datafield[@tag='130']">
180     <xslo:for-each select="marc:subfield">
181       <xslo:if test="contains('i', @code)">
182         <z:index name="Thematic-number:w">
183           <xslo:value-of select="."/>
184         </z:index>
185       </xslo:if>
186     </xslo:for-each>
187     <xslo:for-each select="marc:subfield">
188       <xslo:if test="contains('n', @code)">
189         <z:index name="Thematic-number:w">
190           <xslo:value-of select="."/>
191         </z:index>
192       </xslo:if>
193     </xslo:for-each>
194     <xslo:for-each select="marc:subfield">
195       <xslo:if test="contains('r', @code)">
196         <z:index name="Music-key:w">
197           <xslo:value-of select="."/>
198         </z:index>
199       </xslo:if>
200     </xslo:for-each>
201     <xslo:for-each select="marc:subfield">
202       <xslo:if test="contains('9', @code)">
203         <z:index name="Koha-Auth-Number:w">
204           <xslo:value-of select="."/>
205         </z:index>
206       </xslo:if>
207     </xslo:for-each>
208   </xslo:template>
209   <xslo:template mode="index_subfields" match="marc:datafield[@tag='240']">
210     <xslo:for-each select="marc:subfield">
211       <xslo:if test="contains('i', @code)">
212         <z:index name="Thematic-number:w">
213           <xslo:value-of select="."/>
214         </z:index>
215       </xslo:if>
216     </xslo:for-each>
217     <xslo:for-each select="marc:subfield">
218       <xslo:if test="contains('r', @code)">
219         <z:index name="Music-key:w">
220           <xslo:value-of select="."/>
221         </z:index>
222       </xslo:if>
223     </xslo:for-each>
224     <xslo:for-each select="marc:subfield">
225       <xslo:if test="contains('n', @code)">
226         <z:index name="Thematic-number:w">
227           <xslo:value-of select="."/>
228         </z:index>
229       </xslo:if>
230     </xslo:for-each>
231   </xslo:template>
232   <xslo:template mode="index_subfields" match="marc:datafield[@tag='245']">
233     <xslo:for-each select="marc:subfield">
234       <xslo:if test="contains('a', @code)">
235         <z:index name="Title-cover:w Title-cover:p Title-cover:s Title:w Title:p Title:s">
236           <xslo:value-of select="."/>
237         </z:index>
238       </xslo:if>
239     </xslo:for-each>
240     <xslo:for-each select="marc:subfield">
241       <xslo:if test="contains('c', @code)">
242         <z:index name="Author:w Author-in-order:w Author-in-order:p Author-in-order:s">
243           <xslo:value-of select="."/>
244         </z:index>
245       </xslo:if>
246     </xslo:for-each>
247     <xslo:for-each select="marc:subfield">
248       <xslo:if test="contains('9', @code)">
249         <z:index name="Cross-Reference:w Koha-Auth-Number:w">
250           <xslo:value-of select="."/>
251         </z:index>
252       </xslo:if>
253     </xslo:for-each>
254   </xslo:template>
255   <xslo:template mode="index_subfields" match="marc:datafield[@tag='260']">
256     <xslo:for-each select="marc:subfield">
257       <xslo:if test="contains('a', @code)">
258         <z:index name="pl:w pl:p">
259           <xslo:value-of select="."/>
260         </z:index>
261       </xslo:if>
262     </xslo:for-each>
263     <xslo:for-each select="marc:subfield">
264       <xslo:if test="contains('b', @code)">
265         <z:index name="Publisher:w Publisher:p">
266           <xslo:value-of select="."/>
267         </z:index>
268       </xslo:if>
269     </xslo:for-each>
270     <xslo:for-each select="marc:subfield">
271       <xslo:if test="contains('c', @code)">
272         <z:index name="copydate:w copydate:s">
273           <xslo:value-of select="."/>
274         </z:index>
275       </xslo:if>
276     </xslo:for-each>
277   </xslo:template>
278   <xslo:template mode="index_subfields" match="marc:datafield[@tag='440']">
279     <xslo:for-each select="marc:subfield">
280       <xslo:if test="contains('a', @code)">
281         <z:index name="Title-series:w Title-series:p">
282           <xslo:value-of select="."/>
283         </z:index>
284       </xslo:if>
285     </xslo:for-each>
286     <xslo:for-each select="marc:subfield">
287       <xslo:if test="contains('9', @code)">
288         <z:index name="Koha-Auth-Number:w">
289           <xslo:value-of select="."/>
290         </z:index>
291       </xslo:if>
292     </xslo:for-each>
293   </xslo:template>
294   <xslo:template mode="index_subfields" match="marc:datafield[@tag='490']">
295     <xslo:for-each select="marc:subfield">
296       <xslo:if test="contains('a', @code)">
297         <z:index name="Title-series:w Title-series:p">
298           <xslo:value-of select="."/>
299         </z:index>
300       </xslo:if>
301     </xslo:for-each>
302     <xslo:for-each select="marc:subfield">
303       <xslo:if test="contains('9', @code)">
304         <z:index name="Koha-Auth-Number:w">
305           <xslo:value-of select="."/>
306         </z:index>
307       </xslo:if>
308     </xslo:for-each>
309   </xslo:template>
310   <xslo:template mode="index_subfields" match="marc:datafield[@tag='600']">
311     <xslo:for-each select="marc:subfield">
312       <xslo:if test="contains('a', @code)">
313         <z:index name="Name-and-title:w Name:w Personal-name:w Subject-name-personal:w Subject:w Subject:p">
314           <xslo:value-of select="."/>
315         </z:index>
316       </xslo:if>
317     </xslo:for-each>
318     <xslo:for-each select="marc:subfield">
319       <xslo:if test="contains('t', @code)">
320         <z:index name="Name-and-title:w Title:w Subject:w Subject:p">
321           <xslo:value-of select="."/>
322         </z:index>
323       </xslo:if>
324     </xslo:for-each>
325     <xslo:for-each select="marc:subfield">
326       <xslo:if test="contains('9', @code)">
327         <z:index name="Koha-Auth-Number:w">
328           <xslo:value-of select="."/>
329         </z:index>
330       </xslo:if>
331     </xslo:for-each>
332   </xslo:template>
333   <xslo:template mode="index_subfields" match="marc:datafield[@tag='610']">
334     <xslo:for-each select="marc:subfield">
335       <xslo:if test="contains('a', @code)">
336         <z:index name="Name-and-title:w Subject:w Subject:p">
337           <xslo:value-of select="."/>
338         </z:index>
339       </xslo:if>
340     </xslo:for-each>
341     <xslo:for-each select="marc:subfield">
342       <xslo:if test="contains('t', @code)">
343         <z:index name="Name-and-title:w Title:w Subject:w Subject:p">
344           <xslo:value-of select="."/>
345         </z:index>
346       </xslo:if>
347     </xslo:for-each>
348     <xslo:for-each select="marc:subfield">
349       <xslo:if test="contains('9', @code)">
350         <z:index name="Koha-Auth-Number:w">
351           <xslo:value-of select="."/>
352         </z:index>
353       </xslo:if>
354     </xslo:for-each>
355   </xslo:template>
356   <xslo:template mode="index_subfields" match="marc:datafield[@tag='611']">
357     <xslo:for-each select="marc:subfield">
358       <xslo:if test="contains('a', @code)">
359         <z:index name="Name-and-title:w Subject:w Subject:p">
360           <xslo:value-of select="."/>
361         </z:index>
362       </xslo:if>
363     </xslo:for-each>
364     <xslo:for-each select="marc:subfield">
365       <xslo:if test="contains('t', @code)">
366         <z:index name="Name-and-title:w Title:w Subject:w Subject:p">
367           <xslo:value-of select="."/>
368         </z:index>
369       </xslo:if>
370     </xslo:for-each>
371     <xslo:for-each select="marc:subfield">
372       <xslo:if test="contains('9', @code)">
373         <z:index name="Koha-Auth-Number:w">
374           <xslo:value-of select="."/>
375         </z:index>
376       </xslo:if>
377     </xslo:for-each>
378   </xslo:template>
379   <xslo:template mode="index_subfields" match="marc:datafield[@tag='630']">
380     <xslo:for-each select="marc:subfield">
381       <xslo:if test="contains('i', @code)">
382         <z:index name="Thematic-number:w Subject:w Subject:p">
383           <xslo:value-of select="."/>
384         </z:index>
385       </xslo:if>
386     </xslo:for-each>
387     <xslo:for-each select="marc:subfield">
388       <xslo:if test="contains('n', @code)">
389         <z:index name="Thematic-number:w Subject:w Subject:p">
390           <xslo:value-of select="."/>
391         </z:index>
392       </xslo:if>
393     </xslo:for-each>
394     <xslo:for-each select="marc:subfield">
395       <xslo:if test="contains('r', @code)">
396         <z:index name="Music-key:w Subject:w Subject:p">
397           <xslo:value-of select="."/>
398         </z:index>
399       </xslo:if>
400     </xslo:for-each>
401     <xslo:for-each select="marc:subfield">
402       <xslo:if test="contains('9', @code)">
403         <z:index name="Koha-Auth-Number:w">
404           <xslo:value-of select="."/>
405         </z:index>
406       </xslo:if>
407     </xslo:for-each>
408   </xslo:template>
409   <xslo:template mode="index_subfields" match="marc:datafield[@tag='650']">
410     <xslo:for-each select="marc:subfield">
411       <xslo:if test="contains('9', @code)">
412         <z:index name="Koha-Auth-Number:w">
413           <xslo:value-of select="."/>
414         </z:index>
415       </xslo:if>
416     </xslo:for-each>
417   </xslo:template>
418   <xslo:template mode="index_subfields" match="marc:datafield[@tag='651']">
419     <xslo:for-each select="marc:subfield">
420       <xslo:if test="contains('9', @code)">
421         <z:index name="Koha-Auth-Number:w">
422           <xslo:value-of select="."/>
423         </z:index>
424       </xslo:if>
425     </xslo:for-each>
426   </xslo:template>
427   <xslo:template mode="index_subfields" match="marc:datafield[@tag='652']">
428     <xslo:for-each select="marc:subfield">
429       <xslo:if test="contains('9', @code)">
430         <z:index name="Koha-Auth-Number:w">
431           <xslo:value-of select="."/>
432         </z:index>
433       </xslo:if>
434     </xslo:for-each>
435   </xslo:template>
436   <xslo:template mode="index_subfields" match="marc:datafield[@tag='653']">
437     <xslo:for-each select="marc:subfield">
438       <xslo:if test="contains('9', @code)">
439         <z:index name="Koha-Auth-Number:w">
440           <xslo:value-of select="."/>
441         </z:index>
442       </xslo:if>
443     </xslo:for-each>
444   </xslo:template>
445   <xslo:template mode="index_subfields" match="marc:datafield[@tag='654']">
446     <xslo:for-each select="marc:subfield">
447       <xslo:if test="contains('9', @code)">
448         <z:index name="Koha-Auth-Number:w">
449           <xslo:value-of select="."/>
450         </z:index>
451       </xslo:if>
452     </xslo:for-each>
453   </xslo:template>
454   <xslo:template mode="index_subfields" match="marc:datafield[@tag='655']">
455     <xslo:for-each select="marc:subfield">
456       <xslo:if test="contains('9', @code)">
457         <z:index name="Koha-Auth-Number:w">
458           <xslo:value-of select="."/>
459         </z:index>
460       </xslo:if>
461     </xslo:for-each>
462   </xslo:template>
463   <xslo:template mode="index_subfields" match="marc:datafield[@tag='656']">
464     <xslo:for-each select="marc:subfield">
465       <xslo:if test="contains('9', @code)">
466         <z:index name="Koha-Auth-Number:w">
467           <xslo:value-of select="."/>
468         </z:index>
469       </xslo:if>
470     </xslo:for-each>
471   </xslo:template>
472   <xslo:template mode="index_subfields" match="marc:datafield[@tag='657']">
473     <xslo:for-each select="marc:subfield">
474       <xslo:if test="contains('9', @code)">
475         <z:index name="Koha-Auth-Number:w">
476           <xslo:value-of select="."/>
477         </z:index>
478       </xslo:if>
479     </xslo:for-each>
480   </xslo:template>
481   <xslo:template mode="index_subfields" match="marc:datafield[@tag='690']">
482     <xslo:for-each select="marc:subfield">
483       <xslo:if test="contains('9', @code)">
484         <z:index name="Koha-Auth-Number:w">
485           <xslo:value-of select="."/>
486         </z:index>
487       </xslo:if>
488     </xslo:for-each>
489   </xslo:template>
490   <xslo:template mode="index_subfields" match="marc:datafield[@tag='700']">
491     <xslo:for-each select="marc:subfield">
492       <xslo:if test="contains('9', @code)">
493         <z:index name="Cross-Reference:w Koha-Auth-Number:w">
494           <xslo:value-of select="."/>
495         </z:index>
496       </xslo:if>
497     </xslo:for-each>
498     <xslo:for-each select="marc:subfield">
499       <xslo:if test="contains('a', @code)">
500         <z:index name="Author:w Author:p">
501           <xslo:value-of select="."/>
502         </z:index>
503       </xslo:if>
504     </xslo:for-each>
505     <xslo:for-each select="marc:subfield">
506       <xslo:if test="contains('i', @code)">
507         <z:index name="Thematic-number:w">
508           <xslo:value-of select="."/>
509         </z:index>
510       </xslo:if>
511     </xslo:for-each>
512     <xslo:for-each select="marc:subfield">
513       <xslo:if test="contains('n', @code)">
514         <z:index name="Thematic-number:w">
515           <xslo:value-of select="."/>
516         </z:index>
517       </xslo:if>
518     </xslo:for-each>
519     <xslo:for-each select="marc:subfield">
520       <xslo:if test="contains('r', @code)">
521         <z:index name="Music-key:w">
522           <xslo:value-of select="."/>
523         </z:index>
524       </xslo:if>
525     </xslo:for-each>
526     <xslo:for-each select="marc:subfield">
527       <xslo:if test="contains('t', @code)">
528         <z:index name="Author-title:w Name-and-title:w Title:w Title-uniform:w">
529           <xslo:value-of select="."/>
530         </z:index>
531       </xslo:if>
532     </xslo:for-each>
533   </xslo:template>
534   <xslo:template mode="index_subfields" match="marc:datafield[@tag='710']">
535     <xslo:for-each select="marc:subfield">
536       <xslo:if test="contains('t', @code)">
537         <z:index name="Author-title:w Name-and-title:w Title:w Title-uniform:w">
538           <xslo:value-of select="."/>
539         </z:index>
540       </xslo:if>
541     </xslo:for-each>
542     <xslo:for-each select="marc:subfield">
543       <xslo:if test="contains('a', @code)">
544         <z:index name="Name-and-title:w">
545           <xslo:value-of select="."/>
546         </z:index>
547       </xslo:if>
548     </xslo:for-each>
549     <xslo:for-each select="marc:subfield">
550       <xslo:if test="contains('i', @code)">
551         <z:index name="Thematic-number:w">
552           <xslo:value-of select="."/>
553         </z:index>
554       </xslo:if>
555     </xslo:for-each>
556     <xslo:for-each select="marc:subfield">
557       <xslo:if test="contains('9', @code)">
558         <z:index name="Koha-Auth-Number:w">
559           <xslo:value-of select="."/>
560         </z:index>
561       </xslo:if>
562     </xslo:for-each>
563   </xslo:template>
564   <xslo:template mode="index_subfields" match="marc:datafield[@tag='711']">
565     <xslo:for-each select="marc:subfield">
566       <xslo:if test="contains('a', @code)">
567         <z:index name="Name-and-title:w">
568           <xslo:value-of select="."/>
569         </z:index>
570       </xslo:if>
571     </xslo:for-each>
572     <xslo:for-each select="marc:subfield">
573       <xslo:if test="contains('t', @code)">
574         <z:index name="Author-title:w Title:w Title-uniform:w">
575           <xslo:value-of select="."/>
576         </z:index>
577       </xslo:if>
578     </xslo:for-each>
579     <xslo:for-each select="marc:subfield">
580       <xslo:if test="contains('9', @code)">
581         <z:index name="Koha-Auth-Number:w">
582           <xslo:value-of select="."/>
583         </z:index>
584       </xslo:if>
585     </xslo:for-each>
586   </xslo:template>
587   <xslo:template mode="index_subfields" match="marc:datafield[@tag='730']">
588     <xslo:for-each select="marc:subfield">
589       <xslo:if test="contains('i', @code)">
590         <z:index name="Thematic-number:w">
591           <xslo:value-of select="."/>
592         </z:index>
593       </xslo:if>
594     </xslo:for-each>
595     <xslo:for-each select="marc:subfield">
596       <xslo:if test="contains('n', @code)">
597         <z:index name="Thematic-number:w">
598           <xslo:value-of select="."/>
599         </z:index>
600       </xslo:if>
601     </xslo:for-each>
602     <xslo:for-each select="marc:subfield">
603       <xslo:if test="contains('r', @code)">
604         <z:index name="Music-key:w">
605           <xslo:value-of select="."/>
606         </z:index>
607       </xslo:if>
608     </xslo:for-each>
609     <xslo:for-each select="marc:subfield">
610       <xslo:if test="contains('9', @code)">
611         <z:index name="Koha-Auth-Number:w">
612           <xslo:value-of select="."/>
613         </z:index>
614       </xslo:if>
615     </xslo:for-each>
616   </xslo:template>
617   <xslo:template mode="index_subfields" match="marc:datafield[@tag='773']">
618     <xslo:for-each select="marc:subfield">
619       <xslo:if test="contains('t', @code)">
620         <z:index name="Host-item:w">
621           <xslo:value-of select="."/>
622         </z:index>
623       </xslo:if>
624     </xslo:for-each>
625   </xslo:template>
626   <xslo:template mode="index_subfields" match="marc:datafield[@tag='780']">
627     <xslo:for-each select="marc:subfield">
628       <xslo:if test="contains('t', @code)">
629         <z:index name="Title:w">
630           <xslo:value-of select="."/>
631         </z:index>
632       </xslo:if>
633     </xslo:for-each>
634   </xslo:template>
635   <xslo:template mode="index_subfields" match="marc:datafield[@tag='800']">
636     <xslo:for-each select="marc:subfield">
637       <xslo:if test="contains('a', @code)">
638         <z:index name="Name-and-title:w">
639           <xslo:value-of select="."/>
640         </z:index>
641       </xslo:if>
642     </xslo:for-each>
643     <xslo:for-each select="marc:subfield">
644       <xslo:if test="contains('t', @code)">
645         <z:index name="Author-title:w Name-and-title:w Title:w Title-series:w">
646           <xslo:value-of select="."/>
647         </z:index>
648       </xslo:if>
649     </xslo:for-each>
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='810']">
659     <xslo:for-each select="marc:subfield">
660       <xslo:if test="contains('a', @code)">
661         <z:index name="Name-and-title:w">
662           <xslo:value-of select="."/>
663         </z:index>
664       </xslo:if>
665     </xslo:for-each>
666     <xslo:for-each select="marc:subfield">
667       <xslo:if test="contains('t', @code)">
668         <z:index name="Author-title:w Name-and-title:w Title:w Title-series:w">
669           <xslo:value-of select="."/>
670         </z:index>
671       </xslo:if>
672     </xslo:for-each>
673     <xslo:for-each select="marc:subfield">
674       <xslo:if test="contains('9', @code)">
675         <z:index name="Koha-Auth-Number:w">
676           <xslo:value-of select="."/>
677         </z:index>
678       </xslo:if>
679     </xslo:for-each>
680   </xslo:template>
681   <xslo:template mode="index_subfields" match="marc:datafield[@tag='811']">
682     <xslo:for-each select="marc:subfield">
683       <xslo:if test="contains('a', @code)">
684         <z:index name="Name-and-title:w">
685           <xslo:value-of select="."/>
686         </z:index>
687       </xslo:if>
688     </xslo:for-each>
689     <xslo:for-each select="marc:subfield">
690       <xslo:if test="contains('9', @code)">
691         <z:index name="Koha-Auth-Number:w">
692           <xslo:value-of select="."/>
693         </z:index>
694       </xslo:if>
695     </xslo:for-each>
696     <xslo:for-each select="marc:subfield">
697       <xslo:if test="contains('t', @code)">
698         <z:index name="Author-title:w Name-and-title:w Title:w Title-series:w">
699           <xslo:value-of select="."/>
700         </z:index>
701       </xslo:if>
702     </xslo:for-each>
703   </xslo:template>
704   <xslo:template mode="index_subfields" match="marc:datafield[@tag='830']">
705     <xslo:for-each select="marc:subfield">
706       <xslo:if test="contains('9', @code)">
707         <z:index name="Koha-Auth-Number:w">
708           <xslo:value-of select="."/>
709         </z:index>
710       </xslo:if>
711     </xslo:for-each>
712   </xslo:template>
713   <xslo:template mode="index_subfields" match="marc:datafield[@tag='999']">
714     <xslo:for-each select="marc:subfield">
715       <xslo:if test="contains('c', @code)">
716         <z:index name="Local-Number:n Local-Number:w Local-Number:s">
717           <xslo:value-of select="."/>
718         </z:index>
719       </xslo:if>
720     </xslo:for-each>
721     <xslo:for-each select="marc:subfield">
722       <xslo:if test="contains('d', @code)">
723         <z:index name="biblioitemnumber:n biblioitemnumber:w biblioitemnumber:s">
724           <xslo:value-of select="."/>
725         </z:index>
726       </xslo:if>
727     </xslo:for-each>
728   </xslo:template>
729   <xslo:template mode="index_subfields" match="marc:datafield[@tag='942']">
730     <xslo:for-each select="marc:subfield">
731       <xslo:if test="contains('0', @code)">
732         <z:index name="totalissues:n totalissues:s">
733           <xslo:value-of select="."/>
734         </z:index>
735       </xslo:if>
736     </xslo:for-each>
737     <xslo:for-each select="marc:subfield">
738       <xslo:if test="contains('2', @code)">
739         <z:index name="cn-bib-source:w">
740           <xslo:value-of select="."/>
741         </z:index>
742       </xslo:if>
743     </xslo:for-each>
744     <xslo:for-each select="marc:subfield">
745       <xslo:if test="contains('6', @code)">
746         <z:index name="cn-bib-sort:n cn-bib-sort:s">
747           <xslo:value-of select="."/>
748         </z:index>
749       </xslo:if>
750     </xslo:for-each>
751     <xslo:for-each select="marc:subfield">
752       <xslo:if test="contains('c', @code)">
753         <z:index name="itemtype:w">
754           <xslo:value-of select="."/>
755         </z:index>
756       </xslo:if>
757     </xslo:for-each>
758     <xslo:for-each select="marc:subfield">
759       <xslo:if test="contains('n', @code)">
760         <z:index name="Suppress:w Suppress:n">
761           <xslo:value-of select="."/>
762         </z:index>
763       </xslo:if>
764     </xslo:for-each>
765     <xslo:for-each select="marc:subfield">
766       <xslo:if test="contains('h', @code)">
767         <z:index name="cn-class:w">
768           <xslo:value-of select="."/>
769         </z:index>
770       </xslo:if>
771     </xslo:for-each>
772     <xslo:for-each select="marc:subfield">
773       <xslo:if test="contains('i', @code)">
774         <z:index name="cn-item:w">
775           <xslo:value-of select="."/>
776         </z:index>
777       </xslo:if>
778     </xslo:for-each>
779     <xslo:for-each select="marc:subfield">
780       <xslo:if test="contains('k', @code)">
781         <z:index name="cn-prefix:w">
782           <xslo:value-of select="."/>
783         </z:index>
784       </xslo:if>
785     </xslo:for-each>
786     <xslo:for-each select="marc:subfield">
787       <xslo:if test="contains('m', @code)">
788         <z:index name="cn-suffix: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='952']">
795     <xslo:for-each select="marc:subfield">
796       <xslo:if test="contains('0', @code)">
797         <z:index name="withdrawn:n withdrawn:w">
798           <xslo:value-of select="."/>
799         </z:index>
800       </xslo:if>
801     </xslo:for-each>
802     <xslo:for-each select="marc:subfield">
803       <xslo:if test="contains('1', @code)">
804         <z:index name="lost:w lost:n">
805           <xslo:value-of select="."/>
806         </z:index>
807       </xslo:if>
808     </xslo:for-each>
809     <xslo:for-each select="marc:subfield">
810       <xslo:if test="contains('2', @code)">
811         <z:index name="classification-source:w">
812           <xslo:value-of select="."/>
813         </z:index>
814       </xslo:if>
815     </xslo:for-each>
816     <xslo:for-each select="marc:subfield">
817       <xslo:if test="contains('3', @code)">
818         <z:index name="materials-specified:w">
819           <xslo:value-of select="."/>
820         </z:index>
821       </xslo:if>
822     </xslo:for-each>
823     <xslo:for-each select="marc:subfield">
824       <xslo:if test="contains('4', @code)">
825         <z:index name="damaged:n damaged:w">
826           <xslo:value-of select="."/>
827         </z:index>
828       </xslo:if>
829     </xslo:for-each>
830     <xslo:for-each select="marc:subfield">
831       <xslo:if test="contains('5', @code)">
832         <z:index name="restricted:n restricted:w">
833           <xslo:value-of select="."/>
834         </z:index>
835       </xslo:if>
836     </xslo:for-each>
837     <xslo:for-each select="marc:subfield">
838       <xslo:if test="contains('6', @code)">
839         <z:index name="cn-sort:n cn-sort:s">
840           <xslo:value-of select="."/>
841         </z:index>
842       </xslo:if>
843     </xslo:for-each>
844     <xslo:for-each select="marc:subfield">
845       <xslo:if test="contains('7', @code)">
846         <z:index name="notforloan:n notforloan:w">
847           <xslo:value-of select="."/>
848         </z:index>
849       </xslo:if>
850     </xslo:for-each>
851     <xslo:for-each select="marc:subfield">
852       <xslo:if test="contains('8', @code)">
853         <z:index name="ccode:w">
854           <xslo:value-of select="."/>
855         </z:index>
856       </xslo:if>
857     </xslo:for-each>
858     <xslo:for-each select="marc:subfield">
859       <xslo:if test="contains('9', @code)">
860         <z:index name="itemnumber:n itemnumber:s">
861           <xslo:value-of select="."/>
862         </z:index>
863       </xslo:if>
864     </xslo:for-each>
865     <xslo:for-each select="marc:subfield">
866       <xslo:if test="contains('a', @code)">
867         <z:index name="homebranch:w">
868           <xslo:value-of select="."/>
869         </z:index>
870       </xslo:if>
871     </xslo:for-each>
872     <xslo:for-each select="marc:subfield">
873       <xslo:if test="contains('b', @code)">
874         <z:index name="holdingbranch:w">
875           <xslo:value-of select="."/>
876         </z:index>
877       </xslo:if>
878     </xslo:for-each>
879     <xslo:for-each select="marc:subfield">
880       <xslo:if test="contains('c', @code)">
881         <z:index name="location:w">
882           <xslo:value-of select="."/>
883         </z:index>
884       </xslo:if>
885     </xslo:for-each>
886     <xslo:for-each select="marc:subfield">
887       <xslo:if test="contains('d', @code)">
888         <z:index name="Date-of-acquisition:w Date-of-acquisition:d Date-of-acquisition:s">
889           <xslo:value-of select="."/>
890         </z:index>
891       </xslo:if>
892     </xslo:for-each>
893     <xslo:for-each select="marc:subfield">
894       <xslo:if test="contains('e', @code)">
895         <z:index name="acqsource:w">
896           <xslo:value-of select="."/>
897         </z:index>
898       </xslo:if>
899     </xslo:for-each>
900     <xslo:for-each select="marc:subfield">
901       <xslo:if test="contains('f', @code)">
902         <z:index name="coded-location-qualifier:w">
903           <xslo:value-of select="."/>
904         </z:index>
905       </xslo:if>
906     </xslo:for-each>
907     <xslo:for-each select="marc:subfield">
908       <xslo:if test="contains('g', @code)">
909         <z:index name="price:w">
910           <xslo:value-of select="."/>
911         </z:index>
912       </xslo:if>
913     </xslo:for-each>
914     <xslo:for-each select="marc:subfield">
915       <xslo:if test="contains('j', @code)">
916         <z:index name="stack:n stack:w">
917           <xslo:value-of select="."/>
918         </z:index>
919       </xslo:if>
920     </xslo:for-each>
921     <xslo:for-each select="marc:subfield">
922       <xslo:if test="contains('l', @code)">
923         <z:index name="issues:n issues:w issues:s">
924           <xslo:value-of select="."/>
925         </z:index>
926       </xslo:if>
927     </xslo:for-each>
928     <xslo:for-each select="marc:subfield">
929       <xslo:if test="contains('m', @code)">
930         <z:index name="renewals:n renewals:w">
931           <xslo:value-of select="."/>
932         </z:index>
933       </xslo:if>
934     </xslo:for-each>
935     <xslo:for-each select="marc:subfield">
936       <xslo:if test="contains('n', @code)">
937         <z:index name="reserves:n reserves:w">
938           <xslo:value-of select="."/>
939         </z:index>
940       </xslo:if>
941     </xslo:for-each>
942     <xslo:for-each select="marc:subfield">
943       <xslo:if test="contains('o', @code)">
944         <z:index name="Local-classification:w Local-classification:p Local-classification:s">
945           <xslo:value-of select="."/>
946         </z:index>
947       </xslo:if>
948     </xslo:for-each>
949     <xslo:for-each select="marc:subfield">
950       <xslo:if test="contains('p', @code)">
951         <z:index name="barcode:w barcode:n">
952           <xslo:value-of select="."/>
953         </z:index>
954       </xslo:if>
955     </xslo:for-each>
956     <xslo:for-each select="marc:subfield">
957       <xslo:if test="contains('q', @code)">
958         <z:index name="onloan:n onloan:w">
959           <xslo:value-of select="."/>
960         </z:index>
961       </xslo:if>
962     </xslo:for-each>
963     <xslo:for-each select="marc:subfield">
964       <xslo:if test="contains('r', @code)">
965         <z:index name="datelastseen:w">
966           <xslo:value-of select="."/>
967         </z:index>
968       </xslo:if>
969     </xslo:for-each>
970     <xslo:for-each select="marc:subfield">
971       <xslo:if test="contains('s', @code)">
972         <z:index name="datelastborrowed:w">
973           <xslo:value-of select="."/>
974         </z:index>
975       </xslo:if>
976     </xslo:for-each>
977     <xslo:for-each select="marc:subfield">
978       <xslo:if test="contains('t', @code)">
979         <z:index name="copynumber:w">
980           <xslo:value-of select="."/>
981         </z:index>
982       </xslo:if>
983     </xslo:for-each>
984     <xslo:for-each select="marc:subfield">
985       <xslo:if test="contains('u', @code)">
986         <z:index name="uri:u">
987           <xslo:value-of select="."/>
988         </z:index>
989       </xslo:if>
990     </xslo:for-each>
991     <xslo:for-each select="marc:subfield">
992       <xslo:if test="contains('v', @code)">
993         <z:index name="replacementprice:w">
994           <xslo:value-of select="."/>
995         </z:index>
996       </xslo:if>
997     </xslo:for-each>
998     <xslo:for-each select="marc:subfield">
999       <xslo:if test="contains('w', @code)">
1000         <z:index name="replacementpricedate:w">
1001           <xslo:value-of select="."/>
1002         </z:index>
1003       </xslo:if>
1004     </xslo:for-each>
1005     <xslo:for-each select="marc:subfield">
1006       <xslo:if test="contains('y', @code)">
1007         <z:index name="itype:w">
1008           <xslo:value-of select="."/>
1009         </z:index>
1010       </xslo:if>
1011     </xslo:for-each>
1012   </xslo:template>
1013   <xslo:template mode="index_data_field" match="marc:datafield[@tag='010']">
1014     <z:index name="LC-card-number:w Identifier-standard:w">
1015       <xslo:variable name="raw_heading">
1016         <xslo:for-each select="marc:subfield">
1017           <xslo:if test="position() &gt; 1">
1018             <xslo:value-of select="substring(' ', 1, 1)"/>
1019           </xslo:if>
1020           <xslo:value-of select="."/>
1021         </xslo:for-each>
1022       </xslo:variable>
1023       <xslo:value-of select="normalize-space($raw_heading)"/>
1024     </z:index>
1025   </xslo:template>
1026   <xslo:template mode="index_data_field" match="marc:datafield[@tag='015']">
1027     <z:index name="BNB-card-number:w BGF-number:w Number-db:w Number-natl-biblio:w Identifier-standard:w">
1028       <xslo:variable name="raw_heading">
1029         <xslo:for-each select="marc:subfield">
1030           <xslo:if test="position() &gt; 1">
1031             <xslo:value-of select="substring(' ', 1, 1)"/>
1032           </xslo:if>
1033           <xslo:value-of select="."/>
1034         </xslo:for-each>
1035       </xslo:variable>
1036       <xslo:value-of select="normalize-space($raw_heading)"/>
1037     </z:index>
1038   </xslo:template>
1039   <xslo:template mode="index_data_field" match="marc:datafield[@tag='020']">
1040     <z:index name="ISBN:w Identifier-standard:w">
1041       <xslo:variable name="raw_heading">
1042         <xslo:for-each select="marc:subfield">
1043           <xslo:if test="position() &gt; 1">
1044             <xslo:value-of select="substring(' ', 1, 1)"/>
1045           </xslo:if>
1046           <xslo:value-of select="."/>
1047         </xslo:for-each>
1048       </xslo:variable>
1049       <xslo:value-of select="normalize-space($raw_heading)"/>
1050     </z:index>
1051   </xslo:template>
1052   <xslo:template mode="index_data_field" match="marc:datafield[@tag='022']">
1053     <z:index name="ISSN:w Identifier-standard:w">
1054       <xslo:variable name="raw_heading">
1055         <xslo:for-each select="marc:subfield">
1056           <xslo:if test="position() &gt; 1">
1057             <xslo:value-of select="substring(' ', 1, 1)"/>
1058           </xslo:if>
1059           <xslo:value-of select="."/>
1060         </xslo:for-each>
1061       </xslo:variable>
1062       <xslo:value-of select="normalize-space($raw_heading)"/>
1063     </z:index>
1064   </xslo:template>
1065   <xslo:template mode="index_data_field" match="marc:datafield[@tag='024']">
1066     <z:index name="Identifier-standard:w">
1067       <xslo:variable name="raw_heading">
1068         <xslo:for-each select="marc:subfield">
1069           <xslo:if test="position() &gt; 1">
1070             <xslo:value-of select="substring(' ', 1, 1)"/>
1071           </xslo:if>
1072           <xslo:value-of select="."/>
1073         </xslo:for-each>
1074       </xslo:variable>
1075       <xslo:value-of select="normalize-space($raw_heading)"/>
1076     </z:index>
1077   </xslo:template>
1078   <xslo:template mode="index_data_field" match="marc:datafield[@tag='025']">
1079     <z:index name="Identifier-standard:w">
1080       <xslo:variable name="raw_heading">
1081         <xslo:for-each select="marc:subfield">
1082           <xslo:if test="position() &gt; 1">
1083             <xslo:value-of select="substring(' ', 1, 1)"/>
1084           </xslo:if>
1085           <xslo:value-of select="."/>
1086         </xslo:for-each>
1087       </xslo:variable>
1088       <xslo:value-of select="normalize-space($raw_heading)"/>
1089     </z:index>
1090   </xslo:template>
1091   <xslo:template mode="index_data_field" match="marc:datafield[@tag='027']">
1092     <z:index name="Report-number:w Identifier-standard:w">
1093       <xslo:variable name="raw_heading">
1094         <xslo:for-each select="marc:subfield">
1095           <xslo:if test="position() &gt; 1">
1096             <xslo:value-of select="substring(' ', 1, 1)"/>
1097           </xslo:if>
1098           <xslo:value-of select="."/>
1099         </xslo:for-each>
1100       </xslo:variable>
1101       <xslo:value-of select="normalize-space($raw_heading)"/>
1102     </z:index>
1103   </xslo:template>
1104   <xslo:template mode="index_data_field" match="marc:datafield[@tag='028']">
1105     <z:index name="Number-music-publisher:w Identifier-standard:w">
1106       <xslo:variable name="raw_heading">
1107         <xslo:for-each select="marc:subfield">
1108           <xslo:if test="position() &gt; 1">
1109             <xslo:value-of select="substring(' ', 1, 1)"/>
1110           </xslo:if>
1111           <xslo:value-of select="."/>
1112         </xslo:for-each>
1113       </xslo:variable>
1114       <xslo:value-of select="normalize-space($raw_heading)"/>
1115     </z:index>
1116   </xslo:template>
1117   <xslo:template mode="index_data_field" match="marc:datafield[@tag='030']">
1118     <z:index name="CODEN:w Identifier-standard:w">
1119       <xslo:variable name="raw_heading">
1120         <xslo:for-each select="marc:subfield">
1121           <xslo:if test="position() &gt; 1">
1122             <xslo:value-of select="substring(' ', 1, 1)"/>
1123           </xslo:if>
1124           <xslo:value-of select="."/>
1125         </xslo:for-each>
1126       </xslo:variable>
1127       <xslo:value-of select="normalize-space($raw_heading)"/>
1128     </z:index>
1129   </xslo:template>
1130   <xslo:template mode="index_data_field" match="marc:datafield[@tag='040']">
1131     <z:index name="Code-institution:w Record-source:w">
1132       <xslo:variable name="raw_heading">
1133         <xslo:for-each select="marc:subfield">
1134           <xslo:if test="position() &gt; 1">
1135             <xslo:value-of select="substring(' ', 1, 1)"/>
1136           </xslo:if>
1137           <xslo:value-of select="."/>
1138         </xslo:for-each>
1139       </xslo:variable>
1140       <xslo:value-of select="normalize-space($raw_heading)"/>
1141     </z:index>
1142   </xslo:template>
1143   <xslo:template mode="index_data_field" match="marc:datafield[@tag='041']">
1144     <z:index name="ln:w">
1145       <xslo:variable name="raw_heading">
1146         <xslo:for-each select="marc:subfield">
1147           <xslo:if test="position() &gt; 1">
1148             <xslo:value-of select="substring(' ', 1, 1)"/>
1149           </xslo:if>
1150           <xslo:value-of select="."/>
1151         </xslo:for-each>
1152       </xslo:variable>
1153       <xslo:value-of select="normalize-space($raw_heading)"/>
1154     </z:index>
1155   </xslo:template>
1156   <xslo:template mode="index_data_field" match="marc:datafield[@tag='043']">
1157     <z:index name="Code-geographic:w">
1158       <xslo:variable name="raw_heading">
1159         <xslo:for-each select="marc:subfield">
1160           <xslo:if test="position() &gt; 1">
1161             <xslo:value-of select="substring(' ', 1, 1)"/>
1162           </xslo:if>
1163           <xslo:value-of select="."/>
1164         </xslo:for-each>
1165       </xslo:variable>
1166       <xslo:value-of select="normalize-space($raw_heading)"/>
1167     </z:index>
1168   </xslo:template>
1169   <xslo:template mode="index_data_field" match="marc:datafield[@tag='060']">
1170     <z:index name="NLM-call-number:w">
1171       <xslo:variable name="raw_heading">
1172         <xslo:for-each select="marc:subfield">
1173           <xslo:if test="position() &gt; 1">
1174             <xslo:value-of select="substring(' ', 1, 1)"/>
1175           </xslo:if>
1176           <xslo:value-of select="."/>
1177         </xslo:for-each>
1178       </xslo:variable>
1179       <xslo:value-of select="normalize-space($raw_heading)"/>
1180     </z:index>
1181   </xslo:template>
1182   <xslo:template mode="index_data_field" match="marc:datafield[@tag='080']">
1183     <z:index name="UDC-classification:w">
1184       <xslo:variable name="raw_heading">
1185         <xslo:for-each select="marc:subfield">
1186           <xslo:if test="position() &gt; 1">
1187             <xslo:value-of select="substring(' ', 1, 1)"/>
1188           </xslo:if>
1189           <xslo:value-of select="."/>
1190         </xslo:for-each>
1191       </xslo:variable>
1192       <xslo:value-of select="normalize-space($raw_heading)"/>
1193     </z:index>
1194   </xslo:template>
1195   <xslo:template mode="index_data_field" match="marc:datafield[@tag='082']">
1196     <z:index name="Dewey-classification:w Dewey-classification:s">
1197       <xslo:variable name="raw_heading">
1198         <xslo:for-each select="marc:subfield">
1199           <xslo:if test="position() &gt; 1">
1200             <xslo:value-of select="substring(' ', 1, 1)"/>
1201           </xslo:if>
1202           <xslo:value-of select="."/>
1203         </xslo:for-each>
1204       </xslo:variable>
1205       <xslo:value-of select="normalize-space($raw_heading)"/>
1206     </z:index>
1207   </xslo:template>
1208   <xslo:template mode="index_data_field" match="marc:datafield[@tag='100']">
1209     <z:index name="Author:w Author-title:w Author-name-personal:w Name:w Name-and-title:w Personal-name:w">
1210       <xslo:variable name="raw_heading">
1211         <xslo:for-each select="marc:subfield">
1212           <xslo:if test="position() &gt; 1">
1213             <xslo:value-of select="substring(' ', 1, 1)"/>
1214           </xslo:if>
1215           <xslo:value-of select="."/>
1216         </xslo:for-each>
1217       </xslo:variable>
1218       <xslo:value-of select="normalize-space($raw_heading)"/>
1219     </z:index>
1220   </xslo:template>
1221   <xslo:template mode="index_data_field" match="marc:datafield[@tag='110']">
1222     <z:index name="Author:w Author-title:w Author-name-corporate:w Name:w Name-and-title:w Corporate-name:w">
1223       <xslo:variable name="raw_heading">
1224         <xslo:for-each select="marc:subfield">
1225           <xslo:if test="position() &gt; 1">
1226             <xslo:value-of select="substring(' ', 1, 1)"/>
1227           </xslo:if>
1228           <xslo:value-of select="."/>
1229         </xslo:for-each>
1230       </xslo:variable>
1231       <xslo:value-of select="normalize-space($raw_heading)"/>
1232     </z:index>
1233   </xslo:template>
1234   <xslo:template mode="index_data_field" match="marc:datafield[@tag='111']">
1235     <z:index name="Author:w Author-title:w Author-name-corporate:w Name:w Name-and-title:w Conference-name:w">
1236       <xslo:variable name="raw_heading">
1237         <xslo:for-each select="marc:subfield">
1238           <xslo:if test="position() &gt; 1">
1239             <xslo:value-of select="substring(' ', 1, 1)"/>
1240           </xslo:if>
1241           <xslo:value-of select="."/>
1242         </xslo:for-each>
1243       </xslo:variable>
1244       <xslo:value-of select="normalize-space($raw_heading)"/>
1245     </z:index>
1246   </xslo:template>
1247   <xslo:template mode="index_data_field" match="marc:datafield[@tag='130']">
1248     <z:index name="Title:w Title-uniform:w">
1249       <xslo:variable name="raw_heading">
1250         <xslo:for-each select="marc:subfield">
1251           <xslo:if test="position() &gt; 1">
1252             <xslo:value-of select="substring(' ', 1, 1)"/>
1253           </xslo:if>
1254           <xslo:value-of select="."/>
1255         </xslo:for-each>
1256       </xslo:variable>
1257       <xslo:value-of select="normalize-space($raw_heading)"/>
1258     </z:index>
1259   </xslo:template>
1260   <xslo:template mode="index_data_field" match="marc:datafield[@tag='210']">
1261     <z:index name="Title:w Title-abbreviated:w">
1262       <xslo:variable name="raw_heading">
1263         <xslo:for-each select="marc:subfield">
1264           <xslo:if test="position() &gt; 1">
1265             <xslo:value-of select="substring(' ', 1, 1)"/>
1266           </xslo:if>
1267           <xslo:value-of select="."/>
1268         </xslo:for-each>
1269       </xslo:variable>
1270       <xslo:value-of select="normalize-space($raw_heading)"/>
1271     </z:index>
1272   </xslo:template>
1273   <xslo:template mode="index_data_field" match="marc:datafield[@tag='222']">
1274     <z:index name="Title:w Title-key:w">
1275       <xslo:variable name="raw_heading">
1276         <xslo:for-each select="marc:subfield">
1277           <xslo:if test="position() &gt; 1">
1278             <xslo:value-of select="substring(' ', 1, 1)"/>
1279           </xslo:if>
1280           <xslo:value-of select="."/>
1281         </xslo:for-each>
1282       </xslo:variable>
1283       <xslo:value-of select="normalize-space($raw_heading)"/>
1284     </z:index>
1285   </xslo:template>
1286   <xslo:template mode="index_data_field" match="marc:datafield[@tag='240']">
1287     <z:index name="Title:w Title:p Title-uniform:w">
1288       <xslo:variable name="raw_heading">
1289         <xslo:for-each select="marc:subfield">
1290           <xslo:if test="position() &gt; 1">
1291             <xslo:value-of select="substring(' ', 1, 1)"/>
1292           </xslo:if>
1293           <xslo:value-of select="."/>
1294         </xslo:for-each>
1295       </xslo:variable>
1296       <xslo:value-of select="normalize-space($raw_heading)"/>
1297     </z:index>
1298   </xslo:template>
1299   <xslo:template mode="index_data_field" match="marc:datafield[@tag='245']">
1300     <z:index name="Title:w Title:p">
1301       <xslo:variable name="raw_heading">
1302         <xslo:for-each select="marc:subfield">
1303           <xslo:if test="position() &gt; 1">
1304             <xslo:value-of select="substring(' ', 1, 1)"/>
1305           </xslo:if>
1306           <xslo:value-of select="."/>
1307         </xslo:for-each>
1308       </xslo:variable>
1309       <xslo:value-of select="normalize-space($raw_heading)"/>
1310     </z:index>
1311   </xslo:template>
1312   <xslo:template mode="index_data_field" match="marc:datafield[@tag='246']">
1313     <z:index name="Title:w Title:p Title-abbreviated:w Title-expanded:w Title-former:w">
1314       <xslo:variable name="raw_heading">
1315         <xslo:for-each select="marc:subfield">
1316           <xslo:if test="position() &gt; 1">
1317             <xslo:value-of select="substring(' ', 1, 1)"/>
1318           </xslo:if>
1319           <xslo:value-of select="."/>
1320         </xslo:for-each>
1321       </xslo:variable>
1322       <xslo:value-of select="normalize-space($raw_heading)"/>
1323     </z:index>
1324   </xslo:template>
1325   <xslo:template mode="index_data_field" match="marc:datafield[@tag='260']">
1326     <z:index name="pl:w">
1327       <xslo:variable name="raw_heading">
1328         <xslo:for-each select="marc:subfield">
1329           <xslo:if test="position() &gt; 1">
1330             <xslo:value-of select="substring(' ', 1, 1)"/>
1331           </xslo:if>
1332           <xslo:value-of select="."/>
1333         </xslo:for-each>
1334       </xslo:variable>
1335       <xslo:value-of select="normalize-space($raw_heading)"/>
1336     </z:index>
1337   </xslo:template>
1338   <xslo:template mode="index_data_field" match="marc:datafield[@tag='300']">
1339     <z:index name="Extent:w Extent:p">
1340       <xslo:variable name="raw_heading">
1341         <xslo:for-each select="marc:subfield">
1342           <xslo:if test="position() &gt; 1">
1343             <xslo:value-of select="substring(' ', 1, 1)"/>
1344           </xslo:if>
1345           <xslo:value-of select="."/>
1346         </xslo:for-each>
1347       </xslo:variable>
1348       <xslo:value-of select="normalize-space($raw_heading)"/>
1349     </z:index>
1350   </xslo:template>
1351   <xslo:template mode="index_data_field" match="marc:datafield[@tag='440']">
1352     <z:index name="Title-series:w Title-series:p Title:w Title-series:w">
1353       <xslo:variable name="raw_heading">
1354         <xslo:for-each select="marc:subfield">
1355           <xslo:if test="position() &gt; 1">
1356             <xslo:value-of select="substring(' ', 1, 1)"/>
1357           </xslo:if>
1358           <xslo:value-of select="."/>
1359         </xslo:for-each>
1360       </xslo:variable>
1361       <xslo:value-of select="normalize-space($raw_heading)"/>
1362     </z:index>
1363   </xslo:template>
1364   <xslo:template mode="index_data_field" match="marc:datafield[@tag='490']">
1365     <z:index name="Title:w Title-series:w">
1366       <xslo:variable name="raw_heading">
1367         <xslo:for-each select="marc:subfield">
1368           <xslo:if test="position() &gt; 1">
1369             <xslo:value-of select="substring(' ', 1, 1)"/>
1370           </xslo:if>
1371           <xslo:value-of select="."/>
1372         </xslo:for-each>
1373       </xslo:variable>
1374       <xslo:value-of select="normalize-space($raw_heading)"/>
1375     </z:index>
1376   </xslo:template>
1377   <xslo:template mode="index_data_field" match="marc:datafield[@tag='502']">
1378     <z:index name="Material-type:w">
1379       <xslo:variable name="raw_heading">
1380         <xslo:for-each select="marc:subfield">
1381           <xslo:if test="position() &gt; 1">
1382             <xslo:value-of select="substring(' ', 1, 1)"/>
1383           </xslo:if>
1384           <xslo:value-of select="."/>
1385         </xslo:for-each>
1386       </xslo:variable>
1387       <xslo:value-of select="normalize-space($raw_heading)"/>
1388     </z:index>
1389   </xslo:template>
1390   <xslo:template mode="index_data_field" match="marc:datafield[@tag='505']">
1391     <z:index name="Note:w Note:p">
1392       <xslo:variable name="raw_heading">
1393         <xslo:for-each select="marc:subfield">
1394           <xslo:if test="position() &gt; 1">
1395             <xslo:value-of select="substring(' ', 1, 1)"/>
1396           </xslo:if>
1397           <xslo:value-of select="."/>
1398         </xslo:for-each>
1399       </xslo:variable>
1400       <xslo:value-of select="normalize-space($raw_heading)"/>
1401     </z:index>
1402   </xslo:template>
1403   <xslo:template mode="index_data_field" match="marc:datafield[@tag='510']">
1404     <z:index name="Indexed-by:w">
1405       <xslo:variable name="raw_heading">
1406         <xslo:for-each select="marc:subfield">
1407           <xslo:if test="position() &gt; 1">
1408             <xslo:value-of select="substring(' ', 1, 1)"/>
1409           </xslo:if>
1410           <xslo:value-of select="."/>
1411         </xslo:for-each>
1412       </xslo:variable>
1413       <xslo:value-of select="normalize-space($raw_heading)"/>
1414     </z:index>
1415   </xslo:template>
1416   <xslo:template mode="index_data_field" match="marc:datafield[@tag='520']">
1417     <z:index name="Abstract:w Abstract:p">
1418       <xslo:variable name="raw_heading">
1419         <xslo:for-each select="marc:subfield">
1420           <xslo:if test="position() &gt; 1">
1421             <xslo:value-of select="substring(' ', 1, 1)"/>
1422           </xslo:if>
1423           <xslo:value-of select="."/>
1424         </xslo:for-each>
1425       </xslo:variable>
1426       <xslo:value-of select="normalize-space($raw_heading)"/>
1427     </z:index>
1428   </xslo:template>
1429   <xslo:template mode="index_data_field" match="marc:datafield[@tag='600']">
1430     <z:index name="Name:w Personal-name:w Subject-name-personal:w Subject:w Subject:p">
1431       <xslo:variable name="raw_heading">
1432         <xslo:for-each select="marc:subfield">
1433           <xslo:if test="position() &gt; 1">
1434             <xslo:value-of select="substring(' ', 1, 1)"/>
1435           </xslo:if>
1436           <xslo:value-of select="."/>
1437         </xslo:for-each>
1438       </xslo:variable>
1439       <xslo:value-of select="normalize-space($raw_heading)"/>
1440     </z:index>
1441   </xslo:template>
1442   <xslo:template mode="index_data_field" match="marc:datafield[@tag='610']">
1443     <z:index name="Name:w Subject:w Corporate-name:w Subject:w Subject:p">
1444       <xslo:variable name="raw_heading">
1445         <xslo:for-each select="marc:subfield">
1446           <xslo:if test="position() &gt; 1">
1447             <xslo:value-of select="substring(' ', 1, 1)"/>
1448           </xslo:if>
1449           <xslo:value-of select="."/>
1450         </xslo:for-each>
1451       </xslo:variable>
1452       <xslo:value-of select="normalize-space($raw_heading)"/>
1453     </z:index>
1454   </xslo:template>
1455   <xslo:template mode="index_data_field" match="marc:datafield[@tag='611']">
1456     <z:index name="Conference-name:w Subject:w Subject:p">
1457       <xslo:variable name="raw_heading">
1458         <xslo:for-each select="marc:subfield">
1459           <xslo:if test="position() &gt; 1">
1460             <xslo:value-of select="substring(' ', 1, 1)"/>
1461           </xslo:if>
1462           <xslo:value-of select="."/>
1463         </xslo:for-each>
1464       </xslo:variable>
1465       <xslo:value-of select="normalize-space($raw_heading)"/>
1466     </z:index>
1467     <z:index name="Name:w Subject:w Subject:p">
1468       <xslo:variable name="raw_heading">
1469         <xslo:for-each select="marc:subfield">
1470           <xslo:if test="position() &gt; 1">
1471             <xslo:value-of select="substring(' ', 1, 1)"/>
1472           </xslo:if>
1473           <xslo:value-of select="."/>
1474         </xslo:for-each>
1475       </xslo:variable>
1476       <xslo:value-of select="normalize-space($raw_heading)"/>
1477     </z:index>
1478   </xslo:template>
1479   <xslo:template mode="index_data_field" match="marc:datafield[@tag='630']">
1480     <z:index name="Subject:w Subject:p">
1481       <xslo:variable name="raw_heading">
1482         <xslo:for-each select="marc:subfield">
1483           <xslo:if test="position() &gt; 1">
1484             <xslo:value-of select="substring(' ', 1, 1)"/>
1485           </xslo:if>
1486           <xslo:value-of select="."/>
1487         </xslo:for-each>
1488       </xslo:variable>
1489       <xslo:value-of select="normalize-space($raw_heading)"/>
1490     </z:index>
1491   </xslo:template>
1492   <xslo:template mode="index_data_field" match="marc:datafield[@tag='650']">
1493     <z:index name="Subject:w Subject:p">
1494       <xslo:variable name="raw_heading">
1495         <xslo:for-each select="marc:subfield">
1496           <xslo:if test="position() &gt; 1">
1497             <xslo:value-of select="substring(' ', 1, 1)"/>
1498           </xslo:if>
1499           <xslo:value-of select="."/>
1500         </xslo:for-each>
1501       </xslo:variable>
1502       <xslo:value-of select="normalize-space($raw_heading)"/>
1503     </z:index>
1504   </xslo:template>
1505   <xslo:template mode="index_data_field" match="marc:datafield[@tag='651']">
1506     <z:index name="Name-geographic:w Subject:w Subject:p">
1507       <xslo:variable name="raw_heading">
1508         <xslo:for-each select="marc:subfield">
1509           <xslo:if test="position() &gt; 1">
1510             <xslo:value-of select="substring(' ', 1, 1)"/>
1511           </xslo:if>
1512           <xslo:value-of select="."/>
1513         </xslo:for-each>
1514       </xslo:variable>
1515       <xslo:value-of select="normalize-space($raw_heading)"/>
1516     </z:index>
1517   </xslo:template>
1518   <xslo:template mode="index_data_field" match="marc:datafield[@tag='653']">
1519     <z:index name="Subject:w Subject:p">
1520       <xslo:variable name="raw_heading">
1521         <xslo:for-each select="marc:subfield">
1522           <xslo:if test="position() &gt; 1">
1523             <xslo:value-of select="substring(' ', 1, 1)"/>
1524           </xslo:if>
1525           <xslo:value-of select="."/>
1526         </xslo:for-each>
1527       </xslo:variable>
1528       <xslo:value-of select="normalize-space($raw_heading)"/>
1529     </z:index>
1530   </xslo:template>
1531   <xslo:template mode="index_data_field" match="marc:datafield[@tag='654']">
1532     <z:index name="Subject:w Subject:p">
1533       <xslo:variable name="raw_heading">
1534         <xslo:for-each select="marc:subfield">
1535           <xslo:if test="position() &gt; 1">
1536             <xslo:value-of select="substring(' ', 1, 1)"/>
1537           </xslo:if>
1538           <xslo:value-of select="."/>
1539         </xslo:for-each>
1540       </xslo:variable>
1541       <xslo:value-of select="normalize-space($raw_heading)"/>
1542     </z:index>
1543   </xslo:template>
1544   <xslo:template mode="index_data_field" match="marc:datafield[@tag='655']">
1545     <z:index name="Subject:w Subject:p">
1546       <xslo:variable name="raw_heading">
1547         <xslo:for-each select="marc:subfield">
1548           <xslo:if test="position() &gt; 1">
1549             <xslo:value-of select="substring(' ', 1, 1)"/>
1550           </xslo:if>
1551           <xslo:value-of select="."/>
1552         </xslo:for-each>
1553       </xslo:variable>
1554       <xslo:value-of select="normalize-space($raw_heading)"/>
1555     </z:index>
1556   </xslo:template>
1557   <xslo:template mode="index_data_field" match="marc:datafield[@tag='656']">
1558     <z:index name="Subject:w Subject:p">
1559       <xslo:variable name="raw_heading">
1560         <xslo:for-each select="marc:subfield">
1561           <xslo:if test="position() &gt; 1">
1562             <xslo:value-of select="substring(' ', 1, 1)"/>
1563           </xslo:if>
1564           <xslo:value-of select="."/>
1565         </xslo:for-each>
1566       </xslo:variable>
1567       <xslo:value-of select="normalize-space($raw_heading)"/>
1568     </z:index>
1569   </xslo:template>
1570   <xslo:template mode="index_data_field" match="marc:datafield[@tag='657']">
1571     <z:index name="Subject:w Subject:p">
1572       <xslo:variable name="raw_heading">
1573         <xslo:for-each select="marc:subfield">
1574           <xslo:if test="position() &gt; 1">
1575             <xslo:value-of select="substring(' ', 1, 1)"/>
1576           </xslo:if>
1577           <xslo:value-of select="."/>
1578         </xslo:for-each>
1579       </xslo:variable>
1580       <xslo:value-of select="normalize-space($raw_heading)"/>
1581     </z:index>
1582   </xslo:template>
1583   <xslo:template mode="index_data_field" match="marc:datafield[@tag='690']">
1584     <z:index name="Subject:w Subject:p">
1585       <xslo:variable name="raw_heading">
1586         <xslo:for-each select="marc:subfield">
1587           <xslo:if test="position() &gt; 1">
1588             <xslo:value-of select="substring(' ', 1, 1)"/>
1589           </xslo:if>
1590           <xslo:value-of select="."/>
1591         </xslo:for-each>
1592       </xslo:variable>
1593       <xslo:value-of select="normalize-space($raw_heading)"/>
1594     </z:index>
1595   </xslo:template>
1596   <xslo:template mode="index_data_field" match="marc:datafield[@tag='700']">
1597     <z:index name="Author:w Author-name-corporate:w Author-name-personal:w Name:w Editor:w Personal-name:w">
1598       <xslo:variable name="raw_heading">
1599         <xslo:for-each select="marc:subfield">
1600           <xslo:if test="position() &gt; 1">
1601             <xslo:value-of select="substring(' ', 1, 1)"/>
1602           </xslo:if>
1603           <xslo:value-of select="."/>
1604         </xslo:for-each>
1605       </xslo:variable>
1606       <xslo:value-of select="normalize-space($raw_heading)"/>
1607     </z:index>
1608   </xslo:template>
1609   <xslo:template mode="index_data_field" match="marc:datafield[@tag='710']">
1610     <z:index name="Author:w Corporate-name:w">
1611       <xslo:variable name="raw_heading">
1612         <xslo:for-each select="marc:subfield">
1613           <xslo:if test="position() &gt; 1">
1614             <xslo:value-of select="substring(' ', 1, 1)"/>
1615           </xslo:if>
1616           <xslo:value-of select="."/>
1617         </xslo:for-each>
1618       </xslo:variable>
1619       <xslo:value-of select="normalize-space($raw_heading)"/>
1620     </z:index>
1621     <z:index name="Author:w Name:w">
1622       <xslo:variable name="raw_heading">
1623         <xslo:for-each select="marc:subfield">
1624           <xslo:if test="position() &gt; 1">
1625             <xslo:value-of select="substring(' ', 1, 1)"/>
1626           </xslo:if>
1627           <xslo:value-of select="."/>
1628         </xslo:for-each>
1629       </xslo:variable>
1630       <xslo:value-of select="normalize-space($raw_heading)"/>
1631     </z:index>
1632   </xslo:template>
1633   <xslo:template mode="index_data_field" match="marc:datafield[@tag='711']">
1634     <z:index name="Author-name-corporate:w Name:w Conference-name:w">
1635       <xslo:variable name="raw_heading">
1636         <xslo:for-each select="marc:subfield">
1637           <xslo:if test="position() &gt; 1">
1638             <xslo:value-of select="substring(' ', 1, 1)"/>
1639           </xslo:if>
1640           <xslo:value-of select="."/>
1641         </xslo:for-each>
1642       </xslo:variable>
1643       <xslo:value-of select="normalize-space($raw_heading)"/>
1644     </z:index>
1645   </xslo:template>
1646   <xslo:template mode="index_data_field" match="marc:datafield[@tag='730']">
1647     <z:index name="Title:w Title-uniform:w">
1648       <xslo:variable name="raw_heading">
1649         <xslo:for-each select="marc:subfield">
1650           <xslo:if test="position() &gt; 1">
1651             <xslo:value-of select="substring(' ', 1, 1)"/>
1652           </xslo:if>
1653           <xslo:value-of select="."/>
1654         </xslo:for-each>
1655       </xslo:variable>
1656       <xslo:value-of select="normalize-space($raw_heading)"/>
1657     </z:index>
1658   </xslo:template>
1659   <xslo:template mode="index_data_field" match="marc:datafield[@tag='740']">
1660     <z:index name="Title:w Title-other-variant:w">
1661       <xslo:variable name="raw_heading">
1662         <xslo:for-each select="marc:subfield">
1663           <xslo:if test="position() &gt; 1">
1664             <xslo:value-of select="substring(' ', 1, 1)"/>
1665           </xslo:if>
1666           <xslo:value-of select="."/>
1667         </xslo:for-each>
1668       </xslo:variable>
1669       <xslo:value-of select="normalize-space($raw_heading)"/>
1670     </z:index>
1671   </xslo:template>
1672   <xslo:template mode="index_data_field" match="marc:datafield[@tag='780']">
1673     <z:index name="Title:w Title-former:w Related-periodical:w">
1674       <xslo:variable name="raw_heading">
1675         <xslo:for-each select="marc:subfield">
1676           <xslo:if test="position() &gt; 1">
1677             <xslo:value-of select="substring(' ', 1, 1)"/>
1678           </xslo:if>
1679           <xslo:value-of select="."/>
1680         </xslo:for-each>
1681       </xslo:variable>
1682       <xslo:value-of select="normalize-space($raw_heading)"/>
1683     </z:index>
1684   </xslo:template>
1685   <xslo:template mode="index_data_field" match="marc:datafield[@tag='785']">
1686     <z:index name="Related-periodical:w">
1687       <xslo:variable name="raw_heading">
1688         <xslo:for-each select="marc:subfield">
1689           <xslo:if test="position() &gt; 1">
1690             <xslo:value-of select="substring(' ', 1, 1)"/>
1691           </xslo:if>
1692           <xslo:value-of select="."/>
1693         </xslo:for-each>
1694       </xslo:variable>
1695       <xslo:value-of select="normalize-space($raw_heading)"/>
1696     </z:index>
1697   </xslo:template>
1698   <xslo:template mode="index_data_field" match="marc:datafield[@tag='800']">
1699     <z:index name="Author:w Author-name-personal:w Name:w Personal-name:w">
1700       <xslo:variable name="raw_heading">
1701         <xslo:for-each select="marc:subfield">
1702           <xslo:if test="position() &gt; 1">
1703             <xslo:value-of select="substring(' ', 1, 1)"/>
1704           </xslo:if>
1705           <xslo:value-of select="."/>
1706         </xslo:for-each>
1707       </xslo:variable>
1708       <xslo:value-of select="normalize-space($raw_heading)"/>
1709     </z:index>
1710   </xslo:template>
1711   <xslo:template mode="index_data_field" match="marc:datafield[@tag='810']">
1712     <z:index name="Author:w Corporate-name:w Author-name-corporate:w Name:w">
1713       <xslo:variable name="raw_heading">
1714         <xslo:for-each select="marc:subfield">
1715           <xslo:if test="position() &gt; 1">
1716             <xslo:value-of select="substring(' ', 1, 1)"/>
1717           </xslo:if>
1718           <xslo:value-of select="."/>
1719         </xslo:for-each>
1720       </xslo:variable>
1721       <xslo:value-of select="normalize-space($raw_heading)"/>
1722     </z:index>
1723   </xslo:template>
1724   <xslo:template mode="index_data_field" match="marc:datafield[@tag='811']">
1725     <z:index name="Author:w Author-name-corporate:w Name:w Conference-name:w">
1726       <xslo:variable name="raw_heading">
1727         <xslo:for-each select="marc:subfield">
1728           <xslo:if test="position() &gt; 1">
1729             <xslo:value-of select="substring(' ', 1, 1)"/>
1730           </xslo:if>
1731           <xslo:value-of select="."/>
1732         </xslo:for-each>
1733       </xslo:variable>
1734       <xslo:value-of select="normalize-space($raw_heading)"/>
1735     </z:index>
1736   </xslo:template>
1737   <xslo:template mode="index_data_field" match="marc:datafield[@tag='830']">
1738     <z:index name="Title:w Title-series:w">
1739       <xslo:variable name="raw_heading">
1740         <xslo:for-each select="marc:subfield">
1741           <xslo:if test="position() &gt; 1">
1742             <xslo:value-of select="substring(' ', 1, 1)"/>
1743           </xslo:if>
1744           <xslo:value-of select="."/>
1745         </xslo:for-each>
1746       </xslo:variable>
1747       <xslo:value-of select="normalize-space($raw_heading)"/>
1748     </z:index>
1749   </xslo:template>
1750   <xslo:template match="*">
1751     <z:index name="Any:w Any:p">
1752       <xslo:value-of select="."/>
1753     </z:index>
1754   </xslo:template>
1755   <xslo:template name="chopPunctuation">
1756     <xslo:param name="chopString"/>
1757     <xslo:variable name="length" select="string-length($chopString)"/>
1758     <xslo:choose>
1759       <xslo:when test="$length=0"/>
1760       <xslo:when test="contains('-,.:=;!%/', substring($chopString,$length,1))">
1761         <xslo:call-template name="chopPunctuation">
1762           <xslo:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
1763         </xslo:call-template>
1764       </xslo:when>
1765       <xslo:when test="not($chopString)"/>
1766       <xslo:otherwise>
1767         <xslo:value-of select="$chopString"/>
1768       </xslo:otherwise>
1769     </xslo:choose>
1770     <xslo:text/>
1771   </xslo:template>
1772 </xslo:stylesheet>