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>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
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"
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="/">
<xsl:import href="MARC21slimUtils.xsl"/>
<xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
<xsl:template match="/">
<span class="results_summary series"><span class="label">Series: </span>
<!-- 440 -->
<xsl:for-each select="marc:datafield[@tag=440]">
<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">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<!-- 490 Series not traced, Ind1 = 0 -->
<xsl:for-each select="marc:datafield[@tag=490][@ind1!=1]">
<!-- 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">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<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']">
<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">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
</a>
</xsl:when>
<xsl:otherwise>
</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">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<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=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>
</xsl:otherwise>
</xsl:choose>
<xsl:text>Show analytics</xsl:text>
<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=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>
</xsl:otherwise>
</xsl:choose>
<xsl:text>Show volumes</xsl:text>
<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=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'], '.', '')" />
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
</xsl:if>
<xsl:text> </xsl:text>
<xsl:if test="marc:subfield[@code='b']">
</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>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">b</xsl:with-param>
</xsl:call-template>
<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="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: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>
</xsl:otherwise>
</xsl:choose>
<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="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:call-template>
</xsl:attribute>
</xsl:when>
</a>
</xsl:when>
<xsl:otherwise>
</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>
<xsl:value-of select="$f773"/>
</a>
</xsl:otherwise>
<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=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">
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="subfieldSelect">
</a>
</xsl:when>
<xsl:otherwise>
</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>
<xsl:value-of select="translate($f780, '()', '')"/>
</a>
</xsl:otherwise>
</a>
</xsl:when>
<xsl:otherwise>
</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>
<xsl:value-of select="translate($f785, '()', '')"/>
</a>
</xsl:otherwise>
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
<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: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>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:param name="subdivDelimiter"/>
<xsl:param name="prefix"/>
<xsl:param name="suffix"/>
<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)">
<xsl:variable name="str">
<xsl:for-each select="marc:subfield">
<xsl:if test="contains($codes, @code)">
</xsl:if>
</xsl:for-each>
</xsl:variable>
</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>
</xsl:template>
</xsl:stylesheet>
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"
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"/>
<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"/>
<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=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">
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="chopPunctuation">
<?xml version='1.0'?>
<!DOCTYPE stylesheet [<!ENTITY nbsp " " >]>
<?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>
<xsl:template name="datafield">
<xsl:param name="tag"/>
<xsl:param name="ind1"><xsl:text> </xsl:text></xsl:param>
<xsl:param name="subdivDelimiter"/>
<xsl:param name="prefix"/>
<xsl:param name="suffix"/>
<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)">
<xsl:variable name="str">
<xsl:for-each select="marc:subfield">
<xsl:if test="contains($codes, @code)">
</xsl:if>
</xsl:for-each>
</xsl:variable>
</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">
</xsl:template>
<xsl:template name="subfieldSelectSpan">
</xsl:when>
<xsl:when test="boolean($index)">
<a>
</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>
<xsl:value-of select="$str"/>
</a>
</xsl:when>
<xsl:choose>
<xsl:when test="$url='1'">
<xsl:if test="$field/marc:subfield[@code='b']">
<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>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">b</xsl:with-param>
</xsl:call-template>
xmlns:items="http://www.koha-community.org/items"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:str="http://exslt.org/strings"
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"/>
<xsl:import href="MARC21slimUtils.xsl"/>
<xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
<span class="results_summary series"><span class="label">Series: </span>
<!-- 440 -->
<xsl:for-each select="marc:datafield[@tag=440]">
<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">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<!-- 490 Series not traced, Ind1 = 0 -->
<xsl:for-each select="marc:datafield[@tag=490][@ind1!=1]">
<!-- 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">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<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']">
<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">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
</a>
</xsl:when>
<xsl:otherwise>
</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">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<a>
<xsl:choose>
<xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
<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: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>
</xsl:otherwise>
</xsl:choose>
<xsl:text>Show analytics</xsl:text>
<a>
<xsl:choose>
<xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
<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: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>
</xsl:otherwise>
</xsl:choose>
<xsl:text>Show volumes</xsl:text>
<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=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'], '.', '')" />
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
</xsl:if>
<xsl:text> </xsl:text>
<xsl:if test="marc:subfield[@code='b']">
</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>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">b</xsl:with-param>
</xsl:call-template>
<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="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: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">
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="chopPunctuation">
<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="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: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">
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="subfieldSelect">
<xsl:text>/cgi-bin/koha/opac-search.pl?q=control-number:</xsl:text>
<xsl:call-template name="extractControlNumber">
<xsl:with-param name="subfieldW">
<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>
</xsl:with-param>
</xsl:call-template>
</xsl:attribute>
<xsl:param name="subdivDelimiter"/>
<xsl:param name="prefix"/>
<xsl:param name="suffix"/>
<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)">
<xsl:variable name="str">
<xsl:for-each select="marc:subfield">
<xsl:if test="contains($codes, @code)">
</xsl:if>
</xsl:for-each>
</xsl:variable>
</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>
</xsl:template>
</xsl:stylesheet>
<?xml version='1.0'?>
<!DOCTYPE stylesheet [<!ENTITY nbsp " " >]>
<?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>
<xsl:template name="datafield">
<xsl:param name="tag"/>
<xsl:param name="ind1"><xsl:text> </xsl:text></xsl:param>
</xsl:when>
<xsl:when test="boolean($index)">
<a>
</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>
<xsl:value-of select="$str"/>
</a>
</xsl:when>
<xsl:choose>
<xsl:when test="$url='1'">
<xsl:if test="$field/marc:subfield[@code='b']">
<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>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">b</xsl:with-param>
</xsl:call-template>