Bugzilla – Attachment 81052 Details for
Bug 14716
Correctly URI-encode URLs in XSLT result lists and detail pages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14716: URI-encode URLs in MARC21 xsl templates.
Bug-14716-URI-encode-URLs-in-MARC21-xsl-templates.patch (text/plain), 32.57 KB, created by
Ere Maijala
on 2018-10-24 09:42:11 UTC
(
hide
)
Description:
Bug 14716: URI-encode URLs in MARC21 xsl templates.
Filename:
MIME Type:
Creator:
Ere Maijala
Created:
2018-10-24 09:42:11 UTC
Size:
32.57 KB
patch
obsolete
>From c5a1c6fdee9b76c72145e606c1ab4bada6b031a5 Mon Sep 17 00:00:00 2001 >From: Ere Maijala <ere.maijala@helsinki.fi> >Date: Thu, 22 Feb 2018 15:37:25 +0200 >Subject: [PATCH] Bug 14716: URI-encode URLs in MARC21 xsl templates. > >https://bugs.koha-community.org/show_bug.cgi?id=14716 > >Test plan: > >1. Catalog a record with series name "Series & more" >2. Find the record >3. Make sure clicking the "Series & more" link works and the ampersand is properly encoded in the URL. >4. Also try the attached test records and make sure their links work. > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../prog/en/xslt/MARC21slim2intranetDetail.xsl | 46 ++++++++++++++-------- > .../prog/en/xslt/MARC21slim2intranetResults.xsl | 5 ++- > .../intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl | 21 ++++++++-- > .../bootstrap/en/xslt/MARC21slim2OPACDetail.xsl | 40 ++++++++++++------- > .../bootstrap/en/xslt/MARC21slimUtils.xsl | 11 ++++-- > 5 files changed, 82 insertions(+), 41 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >index 8e0ec68..a5a9454 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >@@ -8,7 +8,8 @@ > xmlns:marc="http://www.loc.gov/MARC21/slim" > xmlns:items="http://www.koha-community.org/items" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >- exclude-result-prefixes="marc items"> >+ xmlns:str="http://exslt.org/strings" >+ exclude-result-prefixes="marc items str"> > <xsl:import href="MARC21slimUtils.xsl"/> > <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/> > <xsl:template match="/"> >@@ -190,7 +191,7 @@ > <span class="results_summary series"><span class="label">Series: </span> > <!-- 440 --> > <xsl:for-each select="marc:datafield[@tag=440]"> >- <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute> >+ <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se,phr:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute> > <xsl:call-template name="chopPunctuation"> > <xsl:with-param name="chopString"> > <xsl:call-template name="subfieldSelect"> >@@ -205,7 +206,7 @@ > > <!-- 490 Series not traced, Ind1 = 0 --> > <xsl:for-each select="marc:datafield[@tag=490][@ind1!=1]"> >- <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute> >+ <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se,phr:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute> > <xsl:call-template name="chopPunctuation"> > <xsl:with-param name="chopString"> > <xsl:call-template name="subfieldSelect"> >@@ -222,7 +223,7 @@ > <xsl:for-each select="marc:datafield[@tag=800 or @tag=810 or @tag=811 or @tag=830]"> > <xsl:choose> > <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']"> >- <a href="/cgi-bin/koha/catalogue/search.pl?q=rcn:{marc:subfield[@code='w']}"> >+ <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:subfield[@code='w'], true())"/></xsl:attribute> > <xsl:call-template name="chopPunctuation"> > <xsl:with-param name="chopString"> > <xsl:call-template name="subfieldSelect"> >@@ -233,7 +234,7 @@ > </a> > </xsl:when> > <xsl:otherwise> >- <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='t']"/>"&q=au:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute> >+ <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se,phr:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='t'], true())"/>"&q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute> > <xsl:call-template name="chopPunctuation"> > <xsl:with-param name="chopString"> > <xsl:call-template name="subfieldSelect"> >@@ -263,7 +264,7 @@ > <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+and+(bib-level:a+or+bib-level:b)</xsl:attribute> > </xsl:when> > <xsl:otherwise> >- <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Host-item:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Host-item:<xsl:value-of select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/></xsl:attribute> > </xsl:otherwise> > </xsl:choose> > <xsl:text>Show analytics</xsl:text> >@@ -280,7 +281,7 @@ > <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+not+(bib-level:a+or+bib-level:b)</xsl:attribute> > </xsl:when> > <xsl:otherwise> >- <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/></xsl:attribute> > </xsl:otherwise> > </xsl:choose> > <xsl:text>Show volumes</xsl:text> >@@ -298,7 +299,7 @@ > <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute> > </xsl:when> > <xsl:otherwise> >- <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', ''), true())"/></xsl:attribute> > </xsl:otherwise> > </xsl:choose> > <xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" /> >@@ -338,7 +339,8 @@ > </xsl:if> > <xsl:text> </xsl:text> > <xsl:if test="marc:subfield[@code='b']"> >- <a href="/cgi-bin/koha/catalogue/search.pl?q=Provider:{marc:subfield[@code='b']}"> >+ <a> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Provider:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='b'], true())"/>"</xsl:attribute> > <xsl:call-template name="subfieldSelect"> > <xsl:with-param name="codes">b</xsl:with-param> > </xsl:call-template> >@@ -659,13 +661,14 @@ > <xsl:with-param name="delimeter"> AND </xsl:with-param> > <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param> > <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param> >+ <xsl:with-param name="urlencode">1</xsl:with-param> > </xsl:call-template> > </xsl:attribute> > </xsl:when> > > <!-- #1807 Strip unwanted parenthesis from subjects for searching --> > <xsl:otherwise> >- <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="translate(marc:subfield[@code='a'],'()','')"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='a'],'()',''), true())"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute> > </xsl:otherwise> > </xsl:choose> > >@@ -717,6 +720,7 @@ > <xsl:with-param name="delimeter"> AND </xsl:with-param> > <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param> > <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param> >+ <xsl:with-param name="urlencode">1</xsl:with-param> > </xsl:call-template> > </xsl:attribute> > </xsl:when> >@@ -968,7 +972,7 @@ > </a> > </xsl:when> > <xsl:otherwise> >- <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute> >+ <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f773, '()', ''), true())"/></xsl:attribute> > <xsl:value-of select="$f773"/> > </a> > </xsl:otherwise> >@@ -1031,7 +1035,7 @@ > <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute> > </xsl:when> > <xsl:otherwise> >- <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f775, '()', '')"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f775, '()', ''), true())"/></xsl:attribute> > </xsl:otherwise> > </xsl:choose> > <xsl:call-template name="subfieldSelect"> >@@ -1090,7 +1094,7 @@ > </a> > </xsl:when> > <xsl:otherwise> >- <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute> >+ <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f780, '()', ''), true())"/></xsl:attribute> > <xsl:value-of select="translate($f780, '()', '')"/> > </a> > </xsl:otherwise> >@@ -1152,7 +1156,7 @@ > </a> > </xsl:when> > <xsl:otherwise> >- <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute> >+ <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f785, '()', ''), true())"/></xsl:attribute> > <xsl:value-of select="translate($f785, '()', '')"/> > </a> > </xsl:otherwise> >@@ -1261,10 +1265,10 @@ > <a> > <xsl:choose> > <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'"> >- <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute> > </xsl:when> > <xsl:otherwise> >- <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute> > </xsl:otherwise> > </xsl:choose> > <xsl:choose> >@@ -1489,6 +1493,7 @@ > <xsl:param name="subdivDelimiter"/> > <xsl:param name="prefix"/> > <xsl:param name="suffix"/> >+ <xsl:param name="urlencode"/> > <xsl:variable name="str"> > <xsl:for-each select="marc:subfield"> > <xsl:if test="contains($codes, @code)"> >@@ -1499,7 +1504,14 @@ > </xsl:if> > </xsl:for-each> > </xsl:variable> >- <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/> >+ <xsl:choose> >+ <xsl:when test="$urlencode=1"> >+ <xsl:value-of select="str:encode-uri(substring($str,1,string-length($str)-string-length($delimeter)), true())"/> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/> >+ </xsl:otherwise> >+ </xsl:choose> > </xsl:template> > > </xsl:stylesheet> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl >index 7ab4e49..266e06d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl >@@ -5,7 +5,8 @@ > xmlns:marc="http://www.loc.gov/MARC21/slim" > xmlns:items="http://www.koha-community.org/items" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >- exclude-result-prefixes="marc items"> >+ xmlns:str="http://exslt.org/strings" >+ exclude-result-prefixes="marc items str"> > <xsl:import href="MARC21slimUtils.xsl"/> > <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/> > <xsl:key name="item-by-status" match="items:item" use="items:status"/> >@@ -356,7 +357,7 @@ > <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute> > </xsl:when> > <xsl:otherwise> >- <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute> > </xsl:otherwise> > </xsl:choose> > <xsl:call-template name="chopPunctuation"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl >index a3db596..68ebd80 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl >@@ -1,6 +1,10 @@ > <?xml version='1.0'?> > <!DOCTYPE stylesheet [<!ENTITY nbsp " " >]> >-<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="marc"> >+<xsl:stylesheet version="1.0" >+ xmlns:marc="http://www.loc.gov/MARC21/slim" >+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >+ xmlns:str="http://exslt.org/strings" >+ exclude-result-prefixes="marc"> > <xsl:template name="datafield"> > <xsl:param name="tag"/> > <xsl:param name="ind1"><xsl:text> </xsl:text></xsl:param> >@@ -27,6 +31,7 @@ > <xsl:param name="subdivDelimiter"/> > <xsl:param name="prefix"/> > <xsl:param name="suffix"/> >+ <xsl:param name="urlencode"/> > <xsl:variable name="str"> > <xsl:for-each select="marc:subfield"> > <xsl:if test="contains($codes, @code)"> >@@ -37,7 +42,14 @@ > </xsl:if> > </xsl:for-each> > </xsl:variable> >- <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/> >+ <xsl:choose> >+ <xsl:when test="$urlencode=1"> >+ <xsl:value-of select="str:encode-uri(substring($str,1,string-length($str)-string-length($delimeter)) )"/> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/> >+ </xsl:otherwise> >+ </xsl:choose> > </xsl:template> > > <xsl:template name="subfieldSelectSpan"> >@@ -197,7 +209,7 @@ > </xsl:when> > <xsl:when test="boolean($index)"> > <a> >- <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="$index"/>:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="str:encode-uri($index, true())"/>:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute> > <xsl:value-of select="$str"/> > </a> > </xsl:when> >@@ -271,7 +283,8 @@ > <xsl:choose> > <xsl:when test="$url='1'"> > <xsl:if test="$field/marc:subfield[@code='b']"> >- <a href="/cgi-bin/koha/catalogue/search.pl?q=Provider:{$field/marc:subfield[@code='b']}"> >+ <a> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Provider:<xsl:value-of select="str:encode-uri($field/marc:subfield[@code='b'], true())"/></xsl:attribute> > <xsl:call-template name="subfieldSelect"> > <xsl:with-param name="codes">b</xsl:with-param> > </xsl:call-template> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >index c6f1518..d878c65 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >@@ -7,7 +7,7 @@ > xmlns:items="http://www.koha-community.org/items" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:str="http://exslt.org/strings" >- exclude-result-prefixes="marc items"> >+ exclude-result-prefixes="marc items str"> > <xsl:import href="MARC21slimUtils.xsl"/> > <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/> > >@@ -207,7 +207,7 @@ > <span class="results_summary series"><span class="label">Series: </span> > <!-- 440 --> > <xsl:for-each select="marc:datafield[@tag=440]"> >- <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute> >+ <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se,phr:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute> > <xsl:call-template name="chopPunctuation"> > <xsl:with-param name="chopString"> > <xsl:call-template name="subfieldSelect"> >@@ -222,7 +222,7 @@ > > <!-- 490 Series not traced, Ind1 = 0 --> > <xsl:for-each select="marc:datafield[@tag=490][@ind1!=1]"> >- <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute> >+ <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se,phr:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute> > <xsl:call-template name="chopPunctuation"> > <xsl:with-param name="chopString"> > <xsl:call-template name="subfieldSelect"> >@@ -239,7 +239,7 @@ > <xsl:for-each select="marc:datafield[@tag=800 or @tag=810 or @tag=811 or @tag=830]"> > <xsl:choose> > <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']"> >- <a href="/cgi-bin/koha/opac-search.pl?q=rcn:{marc:subfield[@code='w']}"> >+ <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:subfield[@code='w'], true())"/></xsl:attribute> > <xsl:call-template name="chopPunctuation"> > <xsl:with-param name="chopString"> > <xsl:call-template name="subfieldSelect"> >@@ -250,7 +250,7 @@ > </a> > </xsl:when> > <xsl:otherwise> >- <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='t']"/>"&q=au:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute> >+ <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se,phr:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='t'], true())"/>"&q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute> > <xsl:call-template name="chopPunctuation"> > <xsl:with-param name="chopString"> > <xsl:call-template name="subfieldSelect"> >@@ -276,10 +276,10 @@ > <a> > <xsl:choose> > <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]"> >- <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+and+(bib-level:a+or+bib-level:b)</xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:controlfield[@tag=001], true())"/>+and+(bib-level:a+or+bib-level:b)</xsl:attribute> > </xsl:when> > <xsl:otherwise> >- <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Host-item:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Host-item:<xsl:value-of select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/></xsl:attribute> > </xsl:otherwise> > </xsl:choose> > <xsl:text>Show analytics</xsl:text> >@@ -293,10 +293,10 @@ > <a> > <xsl:choose> > <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]"> >- <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+not+(bib-level:a+or+bib-level:b)</xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:controlfield[@tag=001], true())"/>+not+(bib-level:a+or+bib-level:b)</xsl:attribute> > </xsl:when> > <xsl:otherwise> >- <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/></xsl:attribute> > </xsl:otherwise> > </xsl:choose> > <xsl:text>Show volumes</xsl:text> >@@ -314,7 +314,7 @@ > <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute> > </xsl:when> > <xsl:otherwise> >- <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', ''), true())"/></xsl:attribute> > </xsl:otherwise> > </xsl:choose> > <xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" /> >@@ -357,7 +357,7 @@ > </xsl:if> > <xsl:text> </xsl:text> > <xsl:if test="marc:subfield[@code='b']"> >- <span property="name"><a href="/cgi-bin/koha/opac-search.pl?q=Provider:{marc:subfield[@code='b']}"> >+ <span property="name"><a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Provider:<xsl:value-of select="str:encode-uri(marc:subfield[@code='b'], true())"/></xsl:attribute> > <xsl:call-template name="subfieldSelect"> > <xsl:with-param name="codes">b</xsl:with-param> > </xsl:call-template> >@@ -734,12 +734,13 @@ > <xsl:with-param name="delimeter"> AND </xsl:with-param> > <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param> > <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param> >+ <xsl:with-param name="urlencode">1</xsl:with-param> > </xsl:call-template> > </xsl:attribute> > </xsl:when> > <!-- #1807 Strip unwanted parenthesis from subjects for searching --> > <xsl:otherwise> >- <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="translate(marc:subfield[@code='a'],'()','')"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='a'],'()',''), true())"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute> > </xsl:otherwise> > </xsl:choose> > <xsl:call-template name="chopPunctuation"> >@@ -788,11 +789,12 @@ > <xsl:with-param name="delimeter"> AND </xsl:with-param> > <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param> > <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param> >+ <xsl:with-param name="urlencode">1</xsl:with-param> > </xsl:call-template> > </xsl:attribute> > </xsl:when> > <xsl:otherwise> >- <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="marc:subfield[@code='a']"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute> > </xsl:otherwise> > </xsl:choose> > <xsl:call-template name="subfieldSelect"> >@@ -837,7 +839,7 @@ > <xsl:text>/cgi-bin/koha/opac-search.pl?q=control-number:</xsl:text> > <xsl:call-template name="extractControlNumber"> > <xsl:with-param name="subfieldW"> >- <xsl:value-of select="marc:subfield[@code='w']"/> >+ <xsl:value-of select="str:encode-uri(marc:subfield[@code='w'], true())"/> > </xsl:with-param> > </xsl:call-template> > </xsl:attribute> >@@ -1666,6 +1668,7 @@ > <xsl:param name="subdivDelimiter"/> > <xsl:param name="prefix"/> > <xsl:param name="suffix"/> >+ <xsl:param name="urlencode"/> > <xsl:variable name="str"> > <xsl:for-each select="marc:subfield"> > <xsl:if test="contains($codes, @code)"> >@@ -1676,6 +1679,13 @@ > </xsl:if> > </xsl:for-each> > </xsl:variable> >- <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/> >+ <xsl:choose> >+ <xsl:when test="$urlencode=1"> >+ <xsl:value-of select="str:encode-uri(substring($str,1,string-length($str)-string-length($delimeter)), true())"/> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/> >+ </xsl:otherwise> >+ </xsl:choose> > </xsl:template> > </xsl:stylesheet> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >index 596bddf..e4ab72a 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >@@ -1,6 +1,10 @@ > <?xml version='1.0'?> > <!DOCTYPE stylesheet [<!ENTITY nbsp " " >]> >-<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="marc"> >+<xsl:stylesheet version="1.0" >+ xmlns:marc="http://www.loc.gov/MARC21/slim" >+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >+ xmlns:str="http://exslt.org/strings" >+ exclude-result-prefixes="marc str"> > <xsl:template name="datafield"> > <xsl:param name="tag"/> > <xsl:param name="ind1"><xsl:text> </xsl:text></xsl:param> >@@ -194,7 +198,7 @@ > </xsl:when> > <xsl:when test="boolean($index)"> > <a> >- <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="$index"/>:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="str:encode-uri($index, true())"/>:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute> > <xsl:value-of select="$str"/> > </a> > </xsl:when> >@@ -269,7 +273,8 @@ > <xsl:choose> > <xsl:when test="$url='1'"> > <xsl:if test="$field/marc:subfield[@code='b']"> >- <a href="/cgi-bin/koha/opac-search.pl?q=Provider:{$field/marc:subfield[@code='b']}"> >+ <a> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Provider:<xsl:value-of select="str:encode-uri($field/marc:subfield[@code='b'], true())"/>"</xsl:attribute> > <xsl:call-template name="subfieldSelect"> > <xsl:with-param name="codes">b</xsl:with-param> > </xsl:call-template> >-- >2.7.4
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 14716
:
41870
|
43385
|
43386
|
43412
|
43413
|
44174
|
44175
|
45743
|
72089
|
73598
|
73605
|
74226
|
74227
|
74228
|
74804
|
76425
|
77471
|
78809
|
80701
|
81052
|
81053
|
81054
|
81305
|
81520
|
81521
|
81522
|
81523