Bug 14716: URI-encode URLs in UNIMARC 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: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Ere Maijala 2018-02-22 15:37:25 +02:00 committed by Nick Clemens
parent 217c8a656f
commit 8bdde43465
2 changed files with 10 additions and 8 deletions

View file

@ -6,7 +6,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:template name="datafield">
<xsl:param name="tag"/>
@ -252,7 +253,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=su:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="chopPunctuation">
@ -289,7 +290,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:text> </xsl:text><xsl:value-of select="marc:subfield[@code='b']"/></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:text> </xsl:text><xsl:value-of select="marc:subfield[@code='b']"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="marc:subfield[@code='a']">

View file

@ -6,7 +6,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:template name="datafield">
<xsl:param name="tag"/>
@ -291,7 +292,7 @@
<a>
<xsl:attribute name="href">
<xsl:text>/cgi-bin/koha/opac-search.pl?q=su:</xsl:text>
<xsl:value-of select="marc:subfield[@code='a']"/>
<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>
</xsl:attribute>
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
@ -355,9 +356,9 @@
<xsl:otherwise>
<xsl:attribute name="href">
<xsl:text>/cgi-bin/koha/opac-search.pl?q=au:</xsl:text>
<xsl:value-of select="marc:subfield[@code='a']"/>
<xsl:text> </xsl:text>
<xsl:value-of select="marc:subfield[@code='b']"/>
<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>
<xsl:text>%20</xsl:text>
<xsl:value-of select="str:encode-uri(marc:subfield[@code='b'], true())"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>