Bugzilla – Attachment 129524 Details for
Bug 28976
In MARC21slimUtils.xsl param 'punctuation' is missing in 'chopPunctuation'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28976 : MARC21 Dots from field 100 are omitted in the OPAC and staff client
Bug-28976--MARC21-Dots-from-field-100-are-omitted-.patch (text/plain), 16.46 KB, created by
Marion Durand
on 2022-01-17 13:37:05 UTC
(
hide
)
Description:
Bug 28976 : MARC21 Dots from field 100 are omitted in the OPAC and staff client
Filename:
MIME Type:
Creator:
Marion Durand
Created:
2022-01-17 13:37:05 UTC
Size:
16.46 KB
patch
obsolete
>From 2757fe3165dadc66086ad468260b34ac25fdb607 Mon Sep 17 00:00:00 2001 >From: Marion Durand <marion.durand@biblibre.com> >Date: Tue, 21 Sep 2021 16:07:00 +0200 >Subject: [PATCH] Bug 28976 : MARC21 Dots from field 100 are omitted in the > OPAC and staff client > >When there is some dot in field 100 (for example when the name have an initials at the end) the dot is omitted in the OPAC ans the staff interface. > >To test: >1- Find or create a record with a dot in field 100 >2a- From the staff interface, search the catalog for your record. Observe that the dot is omitted >2b- From the staff interface, go to the detail page of your record. Observe that the dot is omitted >2c- Repeat step 2a and 2b from the OPAC >3- Apply the patch >4- Repeat step 2. Observe that the dot is now display on all the pages. >--- > .../en/xslt/MARC21slim2intranetResults.xsl | 119 +++++++++++++++++- > .../prog/en/xslt/MARC21slimUtils.xsl | 4 +- > .../en/xslt/MARC21slim2OPACResults.xsl | 9 +- > .../bootstrap/en/xslt/MARC21slimUtils.xsl | 4 +- > 4 files changed, 128 insertions(+), 8 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl >index ab6bbb9530..483e7cf09c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl >@@ -440,13 +440,23 @@ > <!-- Prefer j over 4 --> > <xsl:when test="marc:subfield[@code='j']"> > <xsl:for-each select="marc:subfield[@code='j']"> >- <xsl:value-of select="."/> >+ <xsl:call-template name="chopPunctuation"> >+ <xsl:with-param name="chopString"> >+ <xsl:value-of select="text()"/> >+ </xsl:with-param> >+ <xsl:with-param name="punctuation"><xsl:text>.</xsl:text></xsl:with-param> >+ </xsl:call-template> > <xsl:if test="position() != last()">, </xsl:if> > </xsl:for-each> > </xsl:when> > <xsl:otherwise> > <xsl:for-each select="marc:subfield[@code=4]"> >- <xsl:value-of select="."/> >+ <xsl:call-template name="chopPunctuation"> >+ <xsl:with-param name="chopString"> >+ <xsl:value-of select="text()"/> >+ </xsl:with-param> >+ <xsl:with-param name="punctuation"><xsl:text>.</xsl:text></xsl:with-param> >+ </xsl:call-template> > <xsl:if test="position() != last()">, </xsl:if> > </xsl:for-each> > </xsl:otherwise> >@@ -455,13 +465,23 @@ > <!-- Prefer e over 4 --> > <xsl:when test="marc:subfield[@code='e']"> > <xsl:for-each select="marc:subfield[@code='e'][not(@tag=111) or not(@tag=711)]"> >- <xsl:value-of select="."/> >+ <xsl:call-template name="chopPunctuation"> >+ <xsl:with-param name="chopString"> >+ <xsl:value-of select="text()"/> >+ </xsl:with-param> >+ <xsl:with-param name="punctuation"><xsl:text>.</xsl:text></xsl:with-param> >+ </xsl:call-template> > <xsl:if test="position() != last()">, </xsl:if> > </xsl:for-each> > </xsl:when> > <xsl:otherwise> > <xsl:for-each select="marc:subfield[@code=4]"> >- <xsl:value-of select="."/> >+ <xsl:call-template name="chopPunctuation"> >+ <xsl:with-param name="chopString"> >+ <xsl:value-of select="text()"/> >+ </xsl:with-param> >+ <xsl:with-param name="punctuation"><xsl:text>.</xsl:text></xsl:with-param> >+ </xsl:call-template> > <xsl:if test="position() != last()">, </xsl:if> > </xsl:for-each> > </xsl:otherwise> >@@ -470,7 +490,96 @@ > </span> > </xsl:if> > <xsl:choose> >- <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise> >+ <!-- Test to choose if we add a period at the end of the line or if there is already one --> >+ <xsl:when test="position()=last()"> >+ <xsl:choose> >+ <xsl:when test="@tag=100 or @tag=700"> >+ <xsl:choose> >+ <xsl:when test="marc:subfield[@code='e']"> >+ <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[@code='e']"/></xsl:variable> >+ <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable> >+ <xsl:if test="$lastchar != '.'"> >+ <xsl:text>.</xsl:text> >+ </xsl:if> >+ </xsl:when> >+ <xsl:when test="marc:subfield[@code='4']"> >+ <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[@code='4']"/></xsl:variable> >+ <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable> >+ <xsl:if test="$lastchar != '.'"> >+ <xsl:text>.</xsl:text> >+ </xsl:if> >+ </xsl:when> >+ <xsl:when test="marc:subfield[@code='d']"> >+ <xsl:text>.</xsl:text> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[last()]"/></xsl:variable> >+ <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable> >+ <xsl:if test="$lastchar != '.'"> >+ <xsl:text>.</xsl:text> >+ </xsl:if> >+ </xsl:otherwise> >+ </xsl:choose> >+ </xsl:when> >+ <xsl:when test="@tag=110 or @tag=710"> >+ <xsl:choose> >+ <xsl:when test="marc:subfield[@code='e']"> >+ <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[@code='e']"/></xsl:variable> >+ <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable> >+ <xsl:if test="$lastchar != '.'"> >+ <xsl:text>.</xsl:text> >+ </xsl:if> >+ </xsl:when> >+ <xsl:when test="marc:subfield[@code='4']"> >+ <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[@code='4']"/></xsl:variable> >+ <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable> >+ <xsl:if test="$lastchar != '.'"> >+ <xsl:text>.</xsl:text> >+ </xsl:if> >+ </xsl:when> >+ <xsl:when test="marc:subfield[@code='t'] or marc:subfield[@code='n'] or marc:subfield[@code='d'] or marc:subfield[@code='c']"> >+ <xsl:text>.</xsl:text> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[last()]"/></xsl:variable> >+ <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable> >+ <xsl:if test="$lastchar != '.'"> >+ <xsl:text>.</xsl:text> >+ </xsl:if> >+ </xsl:otherwise> >+ </xsl:choose> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:choose> >+ <xsl:when test="marc:subfield[@code='j']"> >+ <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[@code='j']"/></xsl:variable> >+ <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable> >+ <xsl:if test="$lastchar != '.'"> >+ <xsl:text>.</xsl:text> >+ </xsl:if> >+ </xsl:when> >+ <xsl:when test="marc:subfield[@code='4']"> >+ <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[@code='4']"/></xsl:variable> >+ <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable> >+ <xsl:if test="$lastchar != '.'"> >+ <xsl:text>.</xsl:text> >+ </xsl:if> >+ </xsl:when> >+ <xsl:when test="marc:subfield[@code='t'] or marc:subfield[@code='n'] or marc:subfield[@code='g'] or marc:subfield[@code='d'] or marc:subfield[@code='c']"> >+ <xsl:text>.</xsl:text> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[last()]"/></xsl:variable> >+ <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable> >+ <xsl:if test="$lastchar != '.'"> >+ <xsl:text>.</xsl:text> >+ </xsl:if> >+ </xsl:otherwise> >+ </xsl:choose> >+ </xsl:otherwise> >+ </xsl:choose> >+ </xsl:when> >+ <xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise> > </xsl:choose> > </xsl:for-each> > </p> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl >index dfc9cc0186..4b83751449 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl >@@ -114,12 +114,14 @@ > > <xsl:template name="chopPunctuation"> > <xsl:param name="chopString"/> >+ <xsl:param name="punctuation"><xsl:text>.:,;/ </xsl:text></xsl:param> > <xsl:variable name="length" select="string-length($chopString)"/> > <xsl:choose> > <xsl:when test="$length=0"/> >- <xsl:when test="contains('.:,;/ ', substring($chopString,$length,1))"> >+ <xsl:when test="contains($punctuation, substring($chopString,$length,1))"> > <xsl:call-template name="chopPunctuation"> > <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/> >+ <xsl:with-param name="punctuation" select="$punctuation"/> > </xsl:call-template> > </xsl:when> > <xsl:when test="not($chopString)"/> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >index 40e73b4f22..02384bde16 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >@@ -634,7 +634,13 @@ > </span> > </xsl:if> > <xsl:choose> >- <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise> >+ <xsl:when test="position()=last()"> >+ <!-- the test is working but I'm not sure that it's a cood idea to use (global?) variables to do that --> >+ <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[last()]"/></xsl:variable> >+ <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable> >+ <xsl:if test=" ($lastchar != '.') "><xsl:text>.</xsl:text></xsl:if> >+ </xsl:when> >+ <xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise> > </xsl:choose> > </xsl:for-each> > >@@ -1186,6 +1192,7 @@ > <xsl:choose> > <xsl:when test="($Show856uAsImage='Results' or $Show856uAsImage='Both') and (substring($SubqText,1,6)='image/' or $SubqText='img' or $SubqText='bmp' or $SubqText='cod' or $SubqText='gif' or $SubqText='ief' or $SubqText='jpe' or $SubqText='jpeg' or $SubqText='jpg' or $SubqText='jfif' or $SubqText='png' or $SubqText='svg' or $SubqText='tif' or $SubqText='tiff' or $SubqText='ras' or $SubqText='cmx' or $SubqText='ico' or $SubqText='pnm' or $SubqText='pbm' or $SubqText='pgm' or $SubqText='ppm' or $SubqText='rgb' or $SubqText='xbm' or $SubqText='xpm' or $SubqText='xwd')"> > <xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="marc:subfield[@code='y']"/></xsl:attribute><xsl:attribute name="style">height:100px;</xsl:attribute></xsl:element><xsl:text></xsl:text> >+ > </xsl:when> > <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']"> > <xsl:call-template name="subfieldSelect"> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >index 105da508c7..b5e929c7a1 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >@@ -111,12 +111,14 @@ > > <xsl:template name="chopPunctuation"> > <xsl:param name="chopString"/> >+ <xsl:param name="punctuation"><xsl:text>.:,;/ </xsl:text></xsl:param> > <xsl:variable name="length" select="string-length($chopString)"/> > <xsl:choose> > <xsl:when test="$length=0"/> >- <xsl:when test="contains('.:,;/ ', substring($chopString,$length,1))"> >+ <xsl:when test="contains($punctuation, substring($chopString,$length,1))"> > <xsl:call-template name="chopPunctuation"> > <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/> >+ <xsl:with-param name="punctuation" select="$punctuation"/> > </xsl:call-template> > </xsl:when> > <xsl:when test="not($chopString)"/> >-- >2.17.1
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 28976
: 129524 |
129525
|
130529