Use a user-specified field for z:id.
This patch also fixes an excess space before the index in the MARC21
biblio index definitions, which someone fixed in the generated file
but not in the source file it should have been fixed in.
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Elliott Davis <elliott@bywatersolutions.com>
authority-zebra-indexdefs.xsl`
-->
<kohaidx:index_defs xmlns:kohaidx="http://www.koha-community.org/schemas/index-defs">
+ <id>marc:controlfield[@tag='001']</id>
<!-- variables -->
<kohaidx:var name="form_subdivision_subfield">v</kohaidx:var>
<kohaidx:var name="general_subdivision_subfield">x</kohaidx:var>
</xslo:if>
</xslo:template>
<xslo:template match="marc:record">
- <xslo:variable name="controlField001" select="normalize-space(marc:controlfield[@tag='001'])"/>
+ <xslo:variable name="idfield" select="normalize-space(marc:controlfield[@tag='001'])"/>
<z:record type="update">
<xslo:attribute name="z:id">
- <xslo:value-of select="$controlField001"/>
+ <xslo:value-of select="$idfield"/>
</xslo:attribute>
<xslo:apply-templates/>
<xslo:apply-templates mode="index_subfields"/>
<xslo:value-of select="normalize-space($raw_heading)"/>
</z:index>
</xslo:template>
- <xslo:template mode="index_heading_conditional" match="marc:datafield[@tag='450']">
+ <xslo:template mode="index_heading_conditional">
<xslo:if test="substring(marc:subfield[@code='w']/text(), 2, 1)">
<z:index name="Previous-heading-see-from:p">
<xslo:variable name="raw_heading">
<?xml version="1.0" encoding="utf-8"?>
<kohaidx:index_defs xmlns:kohaidx="http://www.koha-community.org/schemas/index-defs">
<!--record.abs line 40: xelm /record/leader llength:w:range(data,0,5),rtype:w:range(data,6,1),Bib-level:w:range(data,7,1)-->
+ <id>marc:datafield[@tag='999']/marc:subfield[@code='c']</id>
<index_leader xmlns="http://www.koha-community.org/schemas/index-defs" offset="0" length="5">
<target_index>llength:w</target_index>
</index_leader>
</index_subfields>
<!--record.abs line 286: melm 952$3 materials-specified -->
<index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="3">
- <target_index>materials-specified :w</target_index>
+ <target_index>materials-specified:w</target_index>
</index_subfields>
<!--record.abs line 287: melm 952$4 damaged:n,damaged:w-->
<index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="4">
<xslo:template match="text()" mode="index_subfields"/>
<xslo:template match="text()" mode="index_data_field"/>
<xslo:template match="text()" mode="index_heading"/>
+ <xslo:template match="text()" mode="index_heading_conditional"/>
<xslo:template match="text()" mode="index_match_heading"/>
<xslo:template match="text()" mode="index_subject_thesaurus"/>
<xslo:template match="/">
</xslo:if>
</xslo:template>
<xslo:template match="marc:record">
- <xslo:variable name="controlField001" select="normalize-space(marc:controlfield[@tag='001'])"/>
+ <xslo:variable name="idfield" select="normalize-space(marc:datafield[@tag='999']/marc:subfield[@code='c'])"/>
<z:record type="update">
<xslo:attribute name="z:id">
- <xslo:value-of select="$controlField001"/>
+ <xslo:value-of select="$idfield"/>
</xslo:attribute>
<xslo:apply-templates/>
<xslo:apply-templates mode="index_subfields"/>
<xslo:apply-templates mode="index_data_field"/>
<xslo:apply-templates mode="index_heading"/>
+ <xslo:apply-templates mode="index_heading_conditional"/>
<xslo:apply-templates mode="index_match_heading"/>
<xslo:apply-templates mode="index_subject_thesaurus"/>
</z:record>
<?xml version="1.0" encoding="utf-8"?>
<kohaidx:index_defs xmlns:kohaidx="http://www.koha-community.org/schemas/index-defs">
+ <id>marc:controlfield[@tag='001']</id>
<!--record.abs line 24: melm 001 Local-number,Local-number:n-->
<index_control_field xmlns="http://www.koha-community.org/schemas/index-defs" tag="001">
<target_index>Local-number:w</target_index>
<xslo:template match="text()" mode="index_subfields"/>
<xslo:template match="text()" mode="index_data_field"/>
<xslo:template match="text()" mode="index_heading"/>
+ <xslo:template match="text()" mode="index_heading_conditional"/>
<xslo:template match="text()" mode="index_match_heading"/>
<xslo:template match="text()" mode="index_subject_thesaurus"/>
<xslo:template match="/">
</xslo:if>
</xslo:template>
<xslo:template match="marc:record">
- <xslo:variable name="controlField001" select="normalize-space(marc:controlfield[@tag='001'])"/>
+ <xslo:variable name="idfield" select="normalize-space(marc:controlfield[@tag='001'])"/>
<z:record type="update">
<xslo:attribute name="z:id">
- <xslo:value-of select="$controlField001"/>
+ <xslo:value-of select="$idfield"/>
</xslo:attribute>
<xslo:apply-templates/>
<xslo:apply-templates mode="index_subfields"/>
<xslo:apply-templates mode="index_data_field"/>
<xslo:apply-templates mode="index_heading"/>
+ <xslo:apply-templates mode="index_heading_conditional"/>
<xslo:apply-templates mode="index_match_heading"/>
<xslo:apply-templates mode="index_subject_thesaurus"/>
</z:record>
</xslo:template>
<xslo:template match="marc:record">
- <xslo:variable name="controlField001" select="normalize-space(marc:controlfield[@tag='001'])"/>
+ <xslo:variable name="idfield">
+ <xsl:attribute name="select">normalize-space(<xsl:value-of select="//id"/>)</xsl:attribute>
+ </xslo:variable>
<z:record type="update">
- <xslo:attribute name="z:id"><xslo:value-of select="$controlField001"/></xslo:attribute>
+ <xslo:attribute name="z:id"><xslo:value-of select="$idfield"/></xslo:attribute>
<xslo:apply-templates/>
<xslo:apply-templates mode="index_subfields"/>
<xslo:apply-templates mode="index_data_field"/>