Bugzilla – Attachment 120943 Details for
Bug 18540
koha-indexdefs-to-zebra.xsl introduces MARC21 stuff into UNIMARC xslts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18540: Handle indexing sort title only when needed
Bug-18540-Handle-indexing-sort-title-only-when-nee.patch (text/plain), 6.88 KB, created by
Nick Clemens (kidclamp)
on 2021-05-13 16:47:59 UTC
(
hide
)
Description:
Bug 18540: Handle indexing sort title only when needed
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-05-13 16:47:59 UTC
Size:
6.88 KB
patch
obsolete
>From 75989590a8e99e809aa52be4a4aaecf8af23942f Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 13 May 2021 16:34:38 +0000 >Subject: [PATCH] Bug 18540: Handle indexing sort title only when needed > >This patch moves the code that generates the xsl for MARC21 biblio sorting >to it's own template that is only called when specified in the xml > >To test: > 1 - xsltproc etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml > etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl > 2 - git diff > 3 - Note that authority-zebra-indexdefs.xsl now has 245 Title:s info > 4 - Apply patch > 5 - xsltproc etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml > etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl > 6 - git diff > 7 - There are lines added about title sort, but no 245 block > 8 - xsltproc etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml > etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl > 9 - git diff >10 - Note lines changes to ...title_sort >11 - 245 block does not change >--- > .../marc21/biblios/biblio-koha-indexdefs.xml | 3 ++ > etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl | 42 +++++++++++++++------- > 2 files changed, 32 insertions(+), 13 deletions(-) > >diff --git a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml b/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml >index e1941793c9..925d18cef8 100644 >--- a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml >+++ b/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml >@@ -390,6 +390,9 @@ > <target_index>Title-collective:w</target_index> > </index_data_field> > <!--record.abs line 113: melm 245$a Title-cover:w,Title-cover:p,Title-cover:s,Title:w,Title:p,Title:s--> >+ <index_sort_title tag="245" subfields="a"> >+ <target_index>Title:s</target_index> >+ </index_sort_title> > <index_subfields tag="245" subfields="a"> > <target_index>Title-cover:w</target_index> > <target_index>Title-cover:p</target_index> >diff --git a/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl b/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl >index 59876caf73..6c40025bc6 100644 >--- a/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl >+++ b/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl >@@ -19,6 +19,7 @@ > <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"/> > <xsl:key name="index_match_heading_tag" match="kohaidx:index_match_heading" use="@tag"/> >+ <xsl:key name="index_sort_title_tag" match="kohaidx:index_sort_title" use="@tag"/> > > <xsl:template match="kohaidx:index_defs"> > <xsl:comment> >@@ -39,7 +40,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > <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="text()" mode="index_sort_tit"/> >+ <xslo:template match="text()" mode="index_sort_title"/> > <xslo:template match="/"> > <xslo:if test="marc:collection"> > <collection> >@@ -66,7 +67,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > <xslo:apply-templates mode="index_match_heading"/> > <xslo:apply-templates mode="index_subject_thesaurus"/> > <xslo:apply-templates mode="index_all"/> >- <xslo:apply-templates mode="index_sort_tit"/> >+ <xslo:apply-templates mode="index_sort_title"/> > </z:record> > </xslo:template> > >@@ -78,23 +79,13 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > <xsl:call-template name="handle-index-heading"/> > <xsl:call-template name="handle-index-heading-conditional"/> > <xsl:call-template name="handle-index-match-heading"/> >+ <xsl:call-template name="handle-index-sort-title"/> > <xsl:apply-templates/> > <xslo:template mode="index_all" match="text()"> > <z:index name="Any:w Any:p"> > <xslo:value-of select="."/> > </z:index> > </xslo:template> >- <xslo:template mode="index_sort_tit" match="marc:datafield[@tag='245']"> >- <xslo:variable name="chop"> >- <xslo:choose> >- <xslo:when test="not(number(@ind2))">0</xslo:when> >- <xslo:otherwise><xslo:value-of select="number(@ind2)"/></xslo:otherwise> >- </xslo:choose> >- </xslo:variable> >- <z:index name="Title:s"> >- <xslo:value-of select="substring(marc:subfield[@code='a'], $chop+1)"/> >- </z:index> >- </xslo:template> > <xslo:template name="chopPunctuation"> > <xslo:param name="chopString"/> > <xslo:variable name="length" select="string-length($chopString)"/> >@@ -450,6 +441,31 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > </z:index> > </xsl:template> > >+ <xsl:template name="handle-index-sort-title"> >+ <xsl:for-each select="//kohaidx:index_sort_title[generate-id() = generate-id(key('index_sort_title_tag', @tag)[1])]"> >+ <xslo:template mode="index_sort_title"> >+ <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_sort_title_tag', @tag)"> >+ <xslo:variable name="chop"> >+ <xslo:choose> >+ <xslo:when test="not(number(@ind2))">0</xslo:when> >+ <xslo:otherwise> >+ <xslo:value-of select="number(@ind2)"/> >+ </xslo:otherwise> >+ </xslo:choose> >+ </xslo:variable> >+ <z:index name="Title:s"> >+ <xslo:value-of select="substring(marc:subfield[@code='a'], $chop+1)"/> >+ </z:index> >+ </xsl:for-each> >+ </xslo:template> >+ </xsl:for-each> >+ </xsl:template> >+ > <xsl:template name="handle-index-match-heading"> > <xsl:for-each select="//kohaidx:index_match_heading[generate-id() = generate-id(key('index_match_heading_tag', @tag)[1])]"> > <xslo:template mode="index_match_heading"> >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18540
:
120943
|
128724
|
129165
|
129166
|
129167