From 12de861e66f89336e2aac029dea079dd6f0bc697 Mon Sep 17 00:00:00 2001
From: Mathieu Saby <mathsabypro@gmail.com>
Date: Mon, 1 Sep 2014 23:33:49 +0200
Subject: [PATCH] Bug 9352: Add a new XSLT template for indexing goup of
subfields as a whole
This patch adds a new template in koha-indexdefs-to-zebra.xsl in order to index a specific goup of subfields as a whole.
It can be used for indexing as a "phrase" a string resulting from the concatenation of some indexes (with a space between them)
To use this new template, use the new "index_group_of_subfields" element in biblio-koha-indexdefs.xml, in the same way you used index_subfields
Ex : to index the concatenation of "$a $b $d $g" subfields of 700 UNIMARC field in Author:p
<index_group_of_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="700" subfields="abdg">
<target_index>Author:p</target_index>
</index_group_of_subfields>
This patch also change the biblio-koha-indexdefs.xml and biblio-zebra-indexdefs.xsl for UNIMARC, in order to use this new template for 700-712 fields
For 700 and 710, it also indexes in "Author:s" (used for sorting) the concatenation of subfields instead of only the $a subfield
To test : in a DOM UNIMARC Koha, apply all the patches, copy the modified files in your Zebra configuration directory, rebuild zebra, and make some tests
Everything should be the same as when only the first 2 patches were applied, EXCEPT this behavior:
- create a record with 700$aDoe$bJohn (and nothing in 200$f or $g)
- Go in Advanced Search, and select the "Author as phrase" index
- with only the first 2 patches, you will have 0 result if you enter "Doe John" or "Doe John"
- with the 3 patches, you will have 1 result if you enter "Doe John" or "Doe John"
- same kind of test for 710 field
- the logic is the same for 701, 702,711, 712. So, no need to test
- make some searches and test the sorting of your results by author name ("Author A-Z" and "Author Z-A"). The complete name of main author (700 and 710) sould be used for sorting the results, instead of only $&
Note that this it better to test it in advanced search, because the behavior of "au:" CCL index in simple search is maybe bugged
(it searches the phrase index, while it should probably searches the word index)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
---
.../unimarc/biblios/biblio-koha-indexdefs.xml | 60 +++------
.../unimarc/biblios/biblio-zebra-indexdefs.xsl | 148 +++++++++++++--------
etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl | 46 +++++++
3 files changed, 156 insertions(+), 98 deletions(-)
diff --git a/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml b/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml
index cf27720..55e5cdd 100644
--- a/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml
+++ b/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml
@@ -302,24 +302,16 @@
</index_subfields>
<!--700 : Physical author (main)-->
<!--Do not index $f (dates),$c (additions other than dates),$p (affiliation/address),$3,$4. Index $9 only in Koha-Auth-Number. Index $a in Author:s-->
- <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="700" subfields="9">
- <target_index>Koha-Auth-Number:w</target_index>
- <target_index>Koha-Auth-Number:n</target_index>
- </index_subfields>
- <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="700" subfields="a">
- <target_index>Author:w</target_index>
- <target_index>Personal-name:w</target_index>
+ <index_group_of_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="700" subfields="abdg">
<target_index>Author:p</target_index>
- <target_index>Personal-name:p</target_index>
- <target_index>Personal-name:w</target_index>
- <target_index>Author:s</target_index>
- </index_subfields>
- <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="700" subfields="bdg">
<target_index>Author:w</target_index>
- <target_index>Personal-name:w</target_index>
- <target_index>Author:p</target_index>
<target_index>Personal-name:p</target_index>
<target_index>Personal-name:w</target_index>
+ <target_index>Author:s</target_index>
+ </index_group_of_subfields>
+ <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="700" subfields="9">
+ <target_index>Koha-Auth-Number:w</target_index>
+ <target_index>Koha-Auth-Number:n</target_index>
</index_subfields>
<!--701 : Physical author (other)-->
<!--Index $9 only in Koha-Auth-Number-->
@@ -327,33 +319,29 @@
<target_index>Koha-Auth-Number:w</target_index>
<target_index>Koha-Auth-Number:n</target_index>
</index_subfields>
- <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="701" subfields="abdg">
- <target_index>Author:w</target_index>
- <target_index>Personal-name:w</target_index>
+ <index_group_of_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="701" subfields="abdg">
<target_index>Author:p</target_index>
+ <target_index>Author:w</target_index>
<target_index>Personal-name:p</target_index>
<target_index>Personal-name:w</target_index>
- </index_subfields>
- <!--702 : Physical author (secondary)-->
+ </index_group_of_subfields>
<!--Index $9 only in Koha-Auth-Number-->
<index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="702" subfields="9">
<target_index>Koha-Auth-Number:w</target_index>
<target_index>Koha-Auth-Number:n</target_index>
</index_subfields>
- <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="702" subfields="abdg">
- <target_index>Author:w</target_index>
- <target_index>Personal-name:w</target_index>
+ <index_group_of_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="702" subfields="abdg">
<target_index>Author:p</target_index>
+ <target_index>Author:w</target_index>
<target_index>Personal-name:p</target_index>
<target_index>Personal-name:w</target_index>
- </index_subfields>
- <!--710 : Collective author (main)-->
+ </index_group_of_subfields>
<!--Do not index $p (affiliation/address),$3,$4. Index $a in Author:s. Index $9 only in Koha-Auth-Number-->
<index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="710" subfields="9">
<target_index>Koha-Auth-Number:w</target_index>
<target_index>Koha-Auth-Number:n</target_index>
</index_subfields>
- <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="710" subfields="a">
+ <index_group_of_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="710" subfields="abcdefgh">
<target_index>Author:w</target_index>
<target_index>Author-name-corporate:w</target_index>
<target_index>Author-name-conference:w</target_index>
@@ -365,26 +353,14 @@
<target_index>Corporate-name:p</target_index>
<target_index>Conference-name:p</target_index>
<target_index>Author:s</target_index>
- </index_subfields>
- <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="710" subfields="bcdefgh">
- <target_index>Author:w</target_index>
- <target_index>Author-name-corporate:w</target_index>
- <target_index>Author-name-conference:w</target_index>
- <target_index>Corporate-name:w</target_index>
- <target_index>Conference-name:w</target_index>
- <target_index>Author:p</target_index>
- <target_index>Author-name-corporate:p</target_index>
- <target_index>Author-name-conference:p</target_index>
- <target_index>Corporate-name:p</target_index>
- <target_index>Conference-name:p</target_index>
- </index_subfields>
+ </index_group_of_subfields>
<!--711 : Collective author (other)-->
<!--Index $9 only in Koha-Auth-Number-->
<index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="711" subfields="9">
<target_index>Koha-Auth-Number:w</target_index>
<target_index>Koha-Auth-Number:n</target_index>
</index_subfields>
- <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="711" subfields="abcdefgh">
+ <index_group_of_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="711" subfields="abcdefgh">
<target_index>Author:w</target_index>
<target_index>Author-name-corporate:w</target_index>
<target_index>Author-name-conference:w</target_index>
@@ -395,14 +371,14 @@
<target_index>Author-name-conference:p</target_index>
<target_index>Corporate-name:p</target_index>
<target_index>Conference-name:p</target_index>
- </index_subfields>
+ </index_group_of_subfields>
<!--712 : Collective author (secondary)-->
<!--Index $9 only in Koha-Auth-Number-->
<index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="712" subfields="9">
<target_index>Koha-Auth-Number:w</target_index>
<target_index>Koha-Auth-Number:n</target_index>
</index_subfields>
- <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="712" subfields="abcdefgh">
+ <index_group_of_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="712" subfields="abcdefgh">
<target_index>Author:w</target_index>
<target_index>Author-name-corporate:w</target_index>
<target_index>Author-name-conference:w</target_index>
@@ -413,7 +389,7 @@
<target_index>Author-name-conference:p</target_index>
<target_index>Corporate-name:p</target_index>
<target_index>Conference-name:p</target_index>
- </index_subfields>
+ </index_group_of_subfields>
<!--716$a : Trademark-->
<!--Do not index $f (dates),$c (additions other than dates),$3,$4. Index $9 only in Koha-Auth-Number-->
<index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="716" subfields="9">
diff --git a/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl b/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl
index c66b377..ad4332a 100644
--- a/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl
+++ b/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl
@@ -10,6 +10,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
<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">
<xslo:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
<xslo:template match="text()"/>
+ <xslo:template match="text()" mode="index_group_of_subfields"/>
<xslo:template match="text()" mode="index_subfields"/>
<xslo:template match="text()" mode="index_data_field"/>
<xslo:template match="text()" mode="index_heading"/>
@@ -33,6 +34,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
<xslo:value-of select="$idfield"/>
</xslo:attribute>
<xslo:apply-templates/>
+ <xslo:apply-templates mode="index_group_of_subfields"/>
<xslo:apply-templates mode="index_subfields"/>
<xslo:apply-templates mode="index_data_field"/>
<xslo:apply-templates mode="index_heading"/>
@@ -58,6 +60,96 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
<xslo:value-of select="."/>
</z:index>
</xslo:template>
+ <xslo:template mode="index_group_of_subfields" match="marc:datafield[@tag='700']">
+ <z:index name="Author:p Author:w Personal-name:p Personal-name:w Author:s">
+ <xslo:variable name="group_of_subfields">
+ <xslo:for-each select="marc:subfield">
+ <xslo:if test="contains('abdg', @code)">
+ <xslo:value-of select="."/>
+ <xslo:if test="position() != last()">
+ <xslo:value-of select="substring(' ', 1, 1)"/>
+ </xslo:if>
+ </xslo:if>
+ </xslo:for-each>
+ </xslo:variable>
+ <xslo:value-of select="normalize-space($group_of_subfields)"/>
+ </z:index>
+ </xslo:template>
+ <xslo:template mode="index_group_of_subfields" match="marc:datafield[@tag='701']">
+ <z:index name="Author:p Author:w Personal-name:p Personal-name:w">
+ <xslo:variable name="group_of_subfields">
+ <xslo:for-each select="marc:subfield">
+ <xslo:if test="contains('abdg', @code)">
+ <xslo:value-of select="."/>
+ <xslo:if test="position() != last()">
+ <xslo:value-of select="substring(' ', 1, 1)"/>
+ </xslo:if>
+ </xslo:if>
+ </xslo:for-each>
+ </xslo:variable>
+ <xslo:value-of select="normalize-space($group_of_subfields)"/>
+ </z:index>
+ </xslo:template>
+ <xslo:template mode="index_group_of_subfields" match="marc:datafield[@tag='702']">
+ <z:index name="Author:p Author:w Personal-name:p Personal-name:w">
+ <xslo:variable name="group_of_subfields">
+ <xslo:for-each select="marc:subfield">
+ <xslo:if test="contains('abdg', @code)">
+ <xslo:value-of select="."/>
+ <xslo:if test="position() != last()">
+ <xslo:value-of select="substring(' ', 1, 1)"/>
+ </xslo:if>
+ </xslo:if>
+ </xslo:for-each>
+ </xslo:variable>
+ <xslo:value-of select="normalize-space($group_of_subfields)"/>
+ </z:index>
+ </xslo:template>
+ <xslo:template mode="index_group_of_subfields" match="marc:datafield[@tag='710']">
+ <z:index name="Author:w Author-name-corporate:w Author-name-conference:w Corporate-name:w Conference-name:w Author:p Author-name-corporate:p Author-name-conference:p Corporate-name:p Conference-name:p Author:s">
+ <xslo:variable name="group_of_subfields">
+ <xslo:for-each select="marc:subfield">
+ <xslo:if test="contains('abcdefgh', @code)">
+ <xslo:value-of select="."/>
+ <xslo:if test="position() != last()">
+ <xslo:value-of select="substring(' ', 1, 1)"/>
+ </xslo:if>
+ </xslo:if>
+ </xslo:for-each>
+ </xslo:variable>
+ <xslo:value-of select="normalize-space($group_of_subfields)"/>
+ </z:index>
+ </xslo:template>
+ <xslo:template mode="index_group_of_subfields" match="marc:datafield[@tag='711']">
+ <z:index name="Author:w Author-name-corporate:w Author-name-conference:w Corporate-name:w Conference-name:w Author:p Author-name-corporate:p Author-name-conference:p Corporate-name:p Conference-name:p">
+ <xslo:variable name="group_of_subfields">
+ <xslo:for-each select="marc:subfield">
+ <xslo:if test="contains('abcdefgh', @code)">
+ <xslo:value-of select="."/>
+ <xslo:if test="position() != last()">
+ <xslo:value-of select="substring(' ', 1, 1)"/>
+ </xslo:if>
+ </xslo:if>
+ </xslo:for-each>
+ </xslo:variable>
+ <xslo:value-of select="normalize-space($group_of_subfields)"/>
+ </z:index>
+ </xslo:template>
+ <xslo:template mode="index_group_of_subfields" match="marc:datafield[@tag='712']">
+ <z:index name="Author:w Author-name-corporate:w Author-name-conference:w Corporate-name:w Conference-name:w Author:p Author-name-corporate:p Author-name-conference:p Corporate-name:p Conference-name:p">
+ <xslo:variable name="group_of_subfields">
+ <xslo:for-each select="marc:subfield">
+ <xslo:if test="contains('abcdefgh', @code)">
+ <xslo:value-of select="."/>
+ <xslo:if test="position() != last()">
+ <xslo:value-of select="substring(' ', 1, 1)"/>
+ </xslo:if>
+ </xslo:if>
+ </xslo:for-each>
+ </xslo:variable>
+ <xslo:value-of select="normalize-space($group_of_subfields)"/>
+ </z:index>
+ </xslo:template>
<xslo:template mode="index_subfields" match="marc:datafield[@tag='090']">
<xslo:for-each select="marc:subfield">
<xslo:if test="contains('9', @code)">
@@ -669,20 +761,6 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
</z:index>
</xslo:if>
</xslo:for-each>
- <xslo:for-each select="marc:subfield">
- <xslo:if test="contains('a', @code)">
- <z:index name="Author:w Personal-name:w Author:p Personal-name:p Personal-name:w Author:s">
- <xslo:value-of select="."/>
- </z:index>
- </xslo:if>
- </xslo:for-each>
- <xslo:for-each select="marc:subfield">
- <xslo:if test="contains('bdg', @code)">
- <z:index name="Author:w Personal-name:w Author:p Personal-name:p Personal-name:w">
- <xslo:value-of select="."/>
- </z:index>
- </xslo:if>
- </xslo:for-each>
</xslo:template>
<xslo:template mode="index_subfields" match="marc:datafield[@tag='701']">
<xslo:for-each select="marc:subfield">
@@ -692,13 +770,6 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
</z:index>
</xslo:if>
</xslo:for-each>
- <xslo:for-each select="marc:subfield">
- <xslo:if test="contains('abdg', @code)">
- <z:index name="Author:w Personal-name:w Author:p Personal-name:p Personal-name:w">
- <xslo:value-of select="."/>
- </z:index>
- </xslo:if>
- </xslo:for-each>
</xslo:template>
<xslo:template mode="index_subfields" match="marc:datafield[@tag='702']">
<xslo:for-each select="marc:subfield">
@@ -708,13 +779,6 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
</z:index>
</xslo:if>
</xslo:for-each>
- <xslo:for-each select="marc:subfield">
- <xslo:if test="contains('abdg', @code)">
- <z:index name="Author:w Personal-name:w Author:p Personal-name:p Personal-name:w">
- <xslo:value-of select="."/>
- </z:index>
- </xslo:if>
- </xslo:for-each>
</xslo:template>
<xslo:template mode="index_subfields" match="marc:datafield[@tag='710']">
<xslo:for-each select="marc:subfield">
@@ -724,20 +788,6 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
</z:index>
</xslo:if>
</xslo:for-each>
- <xslo:for-each select="marc:subfield">
- <xslo:if test="contains('a', @code)">
- <z:index name="Author:w Author-name-corporate:w Author-name-conference:w Corporate-name:w Conference-name:w Author:p Author-name-corporate:p Author-name-conference:p Corporate-name:p Conference-name:p Author:s">
- <xslo:value-of select="."/>
- </z:index>
- </xslo:if>
- </xslo:for-each>
- <xslo:for-each select="marc:subfield">
- <xslo:if test="contains('bcdefgh', @code)">
- <z:index name="Author:w Author-name-corporate:w Author-name-conference:w Corporate-name:w Conference-name:w Author:p Author-name-corporate:p Author-name-conference:p Corporate-name:p Conference-name:p">
- <xslo:value-of select="."/>
- </z:index>
- </xslo:if>
- </xslo:for-each>
</xslo:template>
<xslo:template mode="index_subfields" match="marc:datafield[@tag='711']">
<xslo:for-each select="marc:subfield">
@@ -747,13 +797,6 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
</z:index>
</xslo:if>
</xslo:for-each>
- <xslo:for-each select="marc:subfield">
- <xslo:if test="contains('abcdefgh', @code)">
- <z:index name="Author:w Author-name-corporate:w Author-name-conference:w Corporate-name:w Conference-name:w Author:p Author-name-corporate:p Author-name-conference:p Corporate-name:p Conference-name:p">
- <xslo:value-of select="."/>
- </z:index>
- </xslo:if>
- </xslo:for-each>
</xslo:template>
<xslo:template mode="index_subfields" match="marc:datafield[@tag='712']">
<xslo:for-each select="marc:subfield">
@@ -763,13 +806,6 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
</z:index>
</xslo:if>
</xslo:for-each>
- <xslo:for-each select="marc:subfield">
- <xslo:if test="contains('abcdefgh', @code)">
- <z:index name="Author:w Author-name-corporate:w Author-name-conference:w Corporate-name:w Conference-name:w Author:p Author-name-corporate:p Author-name-conference:p Corporate-name:p Conference-name:p">
- <xslo:value-of select="."/>
- </z:index>
- </xslo:if>
- </xslo:for-each>
</xslo:template>
<xslo:template mode="index_subfields" match="marc:datafield[@tag='716']">
<xslo:for-each select="marc:subfield">
diff --git a/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl b/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl
index 1488b1c..ad2a61f 100644
--- a/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl
+++ b/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl
@@ -14,6 +14,7 @@
<!-- Keys on tags referenced in the index definitions -->
<xsl:key name="index_control_field_tag" match="kohaidx:index_control_field" use="@tag"/>
<xsl:key name="index_subfields_tag" match="kohaidx:index_subfields" use="@tag"/>
+ <xsl:key name="index_group_of_subfields_tag" match="kohaidx:index_group_of_subfields" use="@tag"/>
<xsl:key name="index_heading_tag" match="kohaidx:index_heading" use="@tag"/>
<xsl:key name="index_data_field_tag" match="kohaidx:index_data_field" use="@tag"/>
<xsl:key name="index_heading_conditional_tag" match="kohaidx:index_heading_conditional" use="@tag"/>
@@ -31,6 +32,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
<xslo:stylesheet version="1.0">
<xslo:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
<xslo:template match="text()"/>
+ <xslo:template match="text()" mode="index_group_of_subfields"/>
<xslo:template match="text()" mode="index_subfields"/>
<xslo:template match="text()" mode="index_data_field"/>
<xslo:template match="text()" mode="index_heading"/>
@@ -55,6 +57,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
<z:record type="update">
<xslo:attribute name="z:id"><xslo:value-of select="$idfield"/></xslo:attribute>
<xslo:apply-templates/>
+ <xslo:apply-templates mode="index_group_of_subfields"/>
<xslo:apply-templates mode="index_subfields"/>
<xslo:apply-templates mode="index_data_field"/>
<xslo:apply-templates mode="index_heading"/>
@@ -67,6 +70,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
<xsl:call-template name="handle-index-leader"/>
<xsl:call-template name="handle-index-control-field"/>
+ <xsl:call-template name="handle-index-group-of-subfields"/>
<xsl:call-template name="handle-index-subfields"/>
<xsl:call-template name="handle-index-data-field"/>
<xsl:call-template name="handle-index-heading"/>
@@ -237,6 +241,48 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
</z:index>
</xsl:template>
+ <xsl:template name="handle-index-group-of-subfields">
+ <xsl:for-each select="//kohaidx:index_group_of_subfields[generate-id() = generate-id(key('index_group_of_subfields_tag', @tag)[1])]">
+ <xslo:template mode="index_group_of_subfields">
+ <xsl:attribute name="match">
+ <xsl:text>marc:datafield[@tag='</xsl:text>
+ <xsl:value-of select="@tag"/>
+ <xsl:text>']</xsl:text>
+ </xsl:attribute>
+ <xsl:for-each select="key('index_group_of_subfields_tag', @tag)">
+ <xsl:call-template name="handle-one-group-of-subfields"/>
+ </xsl:for-each>
+ </xslo:template>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="handle-one-group-of-subfields">
+ <xsl:variable name="indexes">
+ <xsl:call-template name="get-target-indexes"/>
+ </xsl:variable>
+ <xsl:if test="$indexes">
+ <z:index>
+ <xsl:attribute name="name"><xsl:value-of select="normalize-space($indexes)"/></xsl:attribute>
+ <xslo:variable name="group_of_subfields">
+ <xslo:for-each select="marc:subfield">
+ <xslo:if>
+ <xsl:attribute name="test">
+ <xsl:text>contains('</xsl:text>
+ <xsl:value-of select="@subfields"/>
+ <xsl:text>', @code)</xsl:text>
+ </xsl:attribute>
+ <xslo:value-of select="."/>
+ <xslo:if test="position() != last()">
+ <xslo:value-of select="substring(' ', 1, 1)"/> <!-- FIXME surely there's a better way to specify a space -->
+ </xslo:if>
+ </xslo:if>
+ </xslo:for-each>
+ </xslo:variable>
+ <xslo:value-of select="normalize-space($group_of_subfields)"/>
+ </z:index>
+ </xsl:if>
+ </xsl:template>
+
<xsl:template name="handle-index-subfields">
<xsl:for-each select="//kohaidx:index_subfields[generate-id() = generate-id(key('index_subfields_tag', @tag)[1])]">
<xslo:template mode="index_subfields">
--
1.9.1