Bug 14716: Fix more unencoded url parameters.

Fixes issues found during QA and unifies the SubfieldSelect function across the utils xsl's.

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-10-26 18:13:10 +03:00 committed by Nick Clemens
parent a140843721
commit bffd0d8f11
17 changed files with 119 additions and 74 deletions

View file

@ -23,7 +23,7 @@
<xsl:for-each select="marc:controlfield[@tag=001]">
<id>
<xsl:text>urn:tcn:</xsl:text>
<xsl:value-of select="."/>
<xsl:value-of select="str:encode-uri(., true())"/>
</id>
</xsl:for-each>

View file

@ -261,7 +261,7 @@
<a>
<xsl:choose>
<xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
<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:attribute name="href">/cgi-bin/koha/catalogue/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/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>
@ -278,7 +278,7 @@
<a>
<xsl:choose>
<xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
<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:attribute name="href">/cgi-bin/koha/catalogue/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/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>
@ -653,7 +653,7 @@
<xsl:choose>
<!-- #1807 Strip unwanted parenthesis from subjects for searching -->
<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:when test="$TraceSubjectSubdivisions='1'">
<xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelectSubject">
@ -686,7 +686,7 @@
<xsl:if test="marc:subfield[@code=9]">
<xsl:text> </xsl:text>
<a class='authlink'>
<xsl:attribute name="href">/cgi-bin/koha/authorities/detail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/authorities/detail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">/intranet-tmpl/prog/img/filefind.png</xsl:attribute>
<xsl:attribute name="alt"></xsl:attribute>
@ -712,7 +712,7 @@
<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:when test="$TraceSubjectSubdivisions='1'">
<xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelect">
@ -967,7 +967,7 @@
</a>
</xsl:when>
<xsl:when test="marc:subfield[@code='0']">
<a><xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
<a><xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="str:encode-uri(marc:subfield[@code='0'], true())"/></xsl:attribute>
<xsl:value-of select="$f773"/>
</a>
</xsl:when>
@ -1168,7 +1168,7 @@
<xsl:if test="$OPACBaseURL!=''">
<span class="results_summary"><span class="label">OPAC view: </span>
<a><xsl:attribute name="href"><xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:datafield[@tag=999]/marc:subfield[@code='c']"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute>Open in new window</a>.
<a><xsl:attribute name="href"><xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="str:encode-uri(marc:datafield[@tag=999]/marc:subfield[@code='c'], true())"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute>Open in new window</a>.
</span>
</xsl:if>

View file

@ -306,7 +306,7 @@
<xsl:value-of select="$IntranetBiblioDefaultView"/>
</xsl:with-param>
</xsl:call-template>
<xsl:value-of select="$biblionumber"/>
<xsl:value-of select="str:encode-uri($biblionumber, true())"/>
</xsl:attribute>
<xsl:attribute name="class">title</xsl:attribute>
@ -354,7 +354,7 @@
<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="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>

View file

@ -44,7 +44,7 @@
</xsl:variable>
<xsl:choose>
<xsl:when test="$urlencode=1">
<xsl:value-of select="str:encode-uri(substring($str,1,string-length($str)-string-length($delimeter)) )"/>
<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))"/>
@ -125,16 +125,17 @@
Assumes LOC convention: (OrgCode)recordNumber.
If OrgCode is not present, return full string.
Additionally, handle various brackets/parentheses. Chop leading and trailing spaces.
Returns the value URI-encoded.
-->
<xsl:template name="extractControlNumber">
<xsl:param name="subfieldW"/>
<xsl:variable name="tranW" select="translate($subfieldW,']})&gt;','))))')"/>
<xsl:choose>
<xsl:when test="contains($tranW,')')">
<xsl:value-of select="normalize-space(translate(substring-after($tranW,')'),'[]{}()&lt;&gt;',''))"/>
<xsl:value-of select="str:encode-uri(normalize-space(translate(substring-after($tranW,')'),'[]{}()&lt;&gt;','')), true())"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space($subfieldW)"/>
<xsl:value-of select="str:encode-uri(normalize-space($subfieldW), true())"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
@ -197,13 +198,13 @@
<xsl:choose>
<xsl:when test="boolean($bibno)">
<a>
<xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="$bibno"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="str:encode-uri($bibno, true())"/></xsl:attribute>
<xsl:value-of select="$str"/>
</a>
</xsl:when>
<xsl:when test="boolean($index) and boolean(marc:subfield[@code=9]) and $UseAuthoritiesForTracings='1'">
<a>
<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:value-of select="$str"/>
</a>
</xsl:when>

View file

@ -106,7 +106,7 @@
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9]">
<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="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
@ -121,7 +121,7 @@
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9]">
<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="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
@ -135,7 +135,7 @@
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9]">
<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="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
@ -248,7 +248,7 @@
<xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
</xsl:when>
<xsl:when test="marc:subfield[@code='0']">
<a><xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
<a><xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="str:encode-uri(marc:subfield[@code='0'], true())"/></xsl:attribute>
<xsl:value-of select="$f773"/>
</a>
</xsl:when>
@ -408,7 +408,7 @@
<xsl:choose>
<!-- Will implement this later
<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:when test="$TraceSubjectSubdivisions='1'">
@ -417,6 +417,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>
@ -602,7 +603,7 @@
<!-- This will only work if the OPACBaseURL syspref is set. -->
<xsl:if test="string-length($OPACBaseURL) > 0">
<p>OPAC View: <a>
<xsl:attribute name="href"><xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
<xsl:attribute name="href"><xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="str:encode-uri($biblionumber, true())"/></xsl:attribute>
<xsl:attribute name="target">_blank</xsl:attribute>
Open in new window
</a></p>

View file

@ -260,7 +260,7 @@
<xsl:value-of select="$IntranetBiblioDefaultView"/>
</xsl:with-param>
</xsl:call-template>
<xsl:value-of select="$biblionumber"/>
<xsl:value-of select="str:encode-uri($biblionumber, true())"/>
</xsl:attribute>
<xsl:attribute name="class">title</xsl:attribute>
@ -306,7 +306,7 @@
<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="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
@ -321,7 +321,7 @@
<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="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
@ -343,7 +343,7 @@
<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="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
@ -448,7 +448,7 @@
<xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
</xsl:when>
<xsl:when test="marc:subfield[@code='0']">
<a><xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
<a><xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="str:encode-uri(marc:subfield[@code='0'], true())"/></xsl:attribute>
<xsl:value-of select="$f773"/>
</a>
</xsl:when>

View file

@ -32,6 +32,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)">
@ -42,7 +43,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:template name="buildSpaces">
@ -99,16 +107,17 @@
Assumes LOC convention: (OrgCode)recordNumber.
If OrgCode is not present, return full string.
Additionally, handle various brackets/parentheses. Chop leading and trailing spaces.
Returns the value URI-encoded.
-->
<xsl:template name="extractControlNumber">
<xsl:param name="subfieldW"/>
<xsl:variable name="tranW" select="translate($subfieldW,']})&gt;','))))')"/>
<xsl:choose>
<xsl:when test="contains($tranW,')')">
<xsl:value-of select="normalize-space(translate(substring-after($tranW,')'),'[]{}()&lt;&gt;',''))"/>
<xsl:value-of select="str:encode-uri(normalize-space(translate(substring-after($tranW,')'),'[]{}()&lt;&gt;','')), true())"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space($subfieldW)"/>
<xsl:value-of select="str:encode-uri(normalize-space($subfieldW), true())"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
@ -218,13 +227,13 @@
<xsl:choose>
<xsl:when test="boolean($bibno)">
<a>
<xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="$bibno"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="str:encode-uri($bibno, true())"/></xsl:attribute>
<xsl:value-of select="$str"/>
</a>
</xsl:when>
<xsl:when test="boolean($index) and boolean(marc:subfield[@code=9])">
<a>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
<xsl:value-of select="$str"/>
</a>
</xsl:when>

View file

@ -34,7 +34,7 @@
<xsl:value-of select="$IntranetBiblioDefaultView"/>
</xsl:with-param>
</xsl:call-template>
<xsl:value-of select="$biblionumber"/>
<xsl:value-of select="str:encode-uri($biblionumber, true())"/>
</xsl:attribute>
<xsl:attribute name="class">title</xsl:attribute>

View file

@ -115,6 +115,7 @@
<xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
<xsl:param name="subdivCodes"/>
<xsl:param name="subdivDelimiter"/>
<xsl:param name="urlencode"/>
<xsl:variable name="str">
<xsl:for-each select="marc:subfield">
<xsl:if test="contains($codes, @code)">
@ -125,7 +126,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:template name="buildSpaces">
@ -250,7 +258,7 @@
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9]">
<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=su:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
@ -287,7 +295,7 @@
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9]">
<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="str:encode-uri(marc:subfield[@code='a'], true())"/><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='b']"/></xsl:attribute>

View file

@ -725,7 +725,7 @@
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
</xsl:when>
<!-- #1807 Strip unwanted parenthesis from subjects for searching -->
<xsl:when test="$TraceSubjectSubdivisions='1'">
@ -756,7 +756,7 @@
</span>
<xsl:if test="marc:subfield[@code=9]">
<a class='authlink'>
<xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
<xsl:attribute name="style">vertical-align:middle</xsl:attribute>
@ -781,7 +781,7 @@
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
</xsl:when>
<xsl:when test="$TraceSubjectSubdivisions='1'">
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:call-template name="subfieldSelectSubject">
@ -839,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="str:encode-uri(marc:subfield[@code='w'], true())"/>
<xsl:value-of select="marc:subfield[@code='w']"/>
</xsl:with-param>
</xsl:call-template>
</xsl:attribute>
@ -1070,12 +1070,12 @@
</a>
</xsl:when>
<xsl:when test="marc:subfield[@code='0']">
<a><xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
<a><xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="str:encode-uri(marc:subfield[@code='0'], true())"/></xsl:attribute>
<xsl:value-of select="$f773"/>
</a>
</xsl:when>
<xsl:otherwise>
<a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
<a><xsl:attribute name="href">/cgi-bin/koha/opac-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>
@ -1166,7 +1166,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($f775, '()', '')"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-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">
@ -1225,7 +1225,7 @@
</a>
</xsl:when>
<xsl:otherwise>
<a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
<a><xsl:attribute name="href">/cgi-bin/koha/opac-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>
@ -1288,7 +1288,7 @@
</a>
</xsl:when>
<xsl:otherwise>
<a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
<a><xsl:attribute name="href">/cgi-bin/koha/opac-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>
@ -1335,10 +1335,10 @@
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:"<xsl:value-of select="marc:subfield[@code=9]"/>"</xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-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/opac-search.pl?q=au:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<span resource="#record"><span>
@ -1568,7 +1568,7 @@
</a>
<xsl:if test="marc:subfield[@code=9]">
<a class='authlink'>
<xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
<xsl:attribute name="style">vertical-align:middle</xsl:attribute>

View file

@ -413,7 +413,7 @@
<xsl:value-of select="$BiblioDefaultView"/>
</xsl:with-param>
</xsl:call-template>
<xsl:value-of select="$biblionumber"/>
<xsl:value-of select="str:encode-uri($biblionumber, true())"/>
</xsl:attribute>
<xsl:attribute name="class">title</xsl:attribute>

View file

@ -31,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)">
@ -41,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)), 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:template name="subfieldSelectSpan">
@ -114,16 +122,17 @@
Assumes LOC convention: (OrgCode)recordNumber.
If OrgCode is not present, return full string.
Additionally, handle various brackets/parentheses. Chop leading and trailing spaces.
Returns the value URI-encoded.
-->
<xsl:template name="extractControlNumber">
<xsl:param name="subfieldW"/>
<xsl:variable name="tranW" select="translate($subfieldW,']})&gt;','))))')"/>
<xsl:choose>
<xsl:when test="contains($tranW,')')">
<xsl:value-of select="normalize-space(translate(substring-after($tranW,')'),'[]{}()&lt;&gt;',''))"/>
<xsl:value-of select="str:encode-uri(normalize-space(translate(substring-after($tranW,')'),'[]{}()&lt;&gt;','')), true())"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space($subfieldW)"/>
<xsl:value-of select="str:encode-uri(normalize-space($subfieldW), true())"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
@ -186,13 +195,13 @@
<xsl:choose>
<xsl:when test="boolean($bibno)">
<a>
<xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="$bibno"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="str:encode-uri($bibno, true())"/></xsl:attribute>
<xsl:value-of select="$str"/>
</a>
</xsl:when>
<xsl:when test="boolean($index) and boolean(marc:subfield[@code=9])">
<a>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
<xsl:value-of select="$str"/>
</a>
</xsl:when>

View file

@ -101,7 +101,7 @@
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9]">
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-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/opac-search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
@ -110,7 +110,7 @@
<xsl:call-template name="nameABCDQ"/></a>
<xsl:if test="marc:subfield[@code=9]">
<a class='authlink'>
<xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
<xsl:attribute name="style">vertical-align:middle</xsl:attribute>
@ -127,7 +127,7 @@
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9]">
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-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/opac-search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
@ -136,7 +136,7 @@
<xsl:call-template name="nameABCDN"/></a>
<xsl:if test="marc:subfield[@code=9]">
<a class='authlink'>
<xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
<xsl:attribute name="style">vertical-align:middle</xsl:attribute>
@ -152,7 +152,7 @@
<a>
<xsl:choose>
<xsl:when test="marc:subfield[@code=9]">
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-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/opac-search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
@ -161,7 +161,7 @@
<xsl:call-template name="nameACDEQ"/></a>
<xsl:if test="marc:subfield[@code=9]">
<a class='authlink'>
<xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
<xsl:attribute name="style">vertical-align:middle</xsl:attribute>
@ -277,7 +277,7 @@
<xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
</xsl:when>
<xsl:when test="marc:subfield[@code='0']">
<a><xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
<a><xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="str:encode-uri(marc:subfield[@code='0'], true())"/></xsl:attribute>
<xsl:value-of select="$f773"/>
</a>
</xsl:when>
@ -437,7 +437,7 @@
<xsl:choose>
<!-- Will implement this later
<xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
</xsl:when>
-->
<xsl:when test="$TraceSubjectSubdivisions='1'">
@ -465,7 +465,7 @@
</a>
<xsl:if test="marc:subfield[@code=9]">
<a class='authlink'>
<xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
<xsl:attribute name="style">vertical-align:middle</xsl:attribute>

View file

@ -299,7 +299,7 @@
<xsl:value-of select="$BiblioDefaultView"/>
</xsl:with-param>
</xsl:call-template>
<xsl:value-of select="$biblionumber"/>
<xsl:value-of select="str:encode-uri($biblionumber, true())"/>
</xsl:attribute>
<xsl:attribute name="class">title</xsl:attribute>
@ -436,7 +436,7 @@
<xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
</xsl:when>
<xsl:when test="marc:subfield[@code='0']">
<a><xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
<a><xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="str:encode-uri(marc:subfield[@code='0'], true())"/></xsl:attribute>
<xsl:value-of select="$f773"/>
</a>
</xsl:when>

View file

@ -31,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)">
@ -41,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)), 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:template name="buildSpaces">
@ -95,16 +103,17 @@
Assumes LOC convention: (OrgCode)recordNumber.
If OrgCode is not present, return full string.
Additionally, handle various brackets/parentheses. Chop leading and trailing spaces.
Returns the value URI-encoded.
-->
<xsl:template name="extractControlNumber">
<xsl:param name="subfieldW"/>
<xsl:variable name="tranW" select="translate($subfieldW,']})&gt;','))))')"/>
<xsl:choose>
<xsl:when test="contains($tranW,')')">
<xsl:value-of select="normalize-space(translate(substring-after($tranW,')'),'[]{}()&lt;&gt;',''))"/>
<xsl:value-of select="str:encode-uri(normalize-space(translate(substring-after($tranW,')'),'[]{}()&lt;&gt;','')), true())"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space($subfieldW)"/>
<xsl:value-of select="str:encode-uri(normalize-space($subfieldW), true())"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
@ -215,13 +224,13 @@
<xsl:choose>
<xsl:when test="boolean($bibno)">
<a>
<xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="$bibno"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="str:encode-uri($bibno, true())"/></xsl:attribute>
<xsl:value-of select="$str"/>
</a>
</xsl:when>
<xsl:when test="boolean($index) and boolean(marc:subfield[@code=9])">
<a>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
<xsl:value-of select="$str"/>
</a>
</xsl:when>

View file

@ -48,7 +48,7 @@
<xsl:value-of select="$BiblioDefaultView"/>
</xsl:with-param>
</xsl:call-template>
<xsl:value-of select="$biblionumber"/>
<xsl:value-of select="str:encode-uri($biblionumber, true())"/>
</xsl:attribute>
<xsl:attribute name="class">title</xsl:attribute>
<xsl:value-of select="$ntitle" />

View file

@ -33,6 +33,7 @@
<xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
<xsl:param name="subdivCodes"/>
<xsl:param name="subdivDelimiter"/>
<xsl:param name="urlencode"/>
<xsl:variable name="str">
<xsl:for-each select="marc:subfield">
<xsl:if test="contains($codes, @code)">
@ -43,7 +44,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:template name="buildSpaces">
@ -265,7 +273,7 @@
<a>
<xsl:attribute name="href">
<xsl:text>/cgi-bin/koha/opac-search.pl?q=an:</xsl:text>
<xsl:value-of select="."/>
<xsl:value-of select="str:encode-uri(., true())"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test="string-length($display) &gt; 0">
@ -350,7 +358,7 @@
<xsl:when test="marc:subfield[@code=9]">
<xsl:attribute name="href">
<xsl:text>/cgi-bin/koha/opac-search.pl?q=an:</xsl:text>
<xsl:value-of select="marc:subfield[@code=9]"/>
<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
@ -381,7 +389,7 @@
<a>
<xsl:attribute name="href">
<xsl:text>/cgi-bin/koha/opac-idref.pl?unimarc3=</xsl:text>
<xsl:value-of select="marc:subfield[@code=3]"/>
<xsl:value-of select="str:encode-uri(marc:subfield[@code=3], true())"/>
</xsl:attribute>
<xsl:attribute name="title">IdRef</xsl:attribute>
<xsl:attribute name="rel">gb_page_center[600,500]</xsl:attribute>