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>
<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>
<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>
<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>
<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">
<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>
<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">
</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>
<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>
<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>
<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>
</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))"/>
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,']})>','))))')"/>
<xsl:choose>
<xsl:when test="contains($tranW,')')">
- <xsl:value-of select="normalize-space(translate(substring-after($tranW,')'),'[]{}()<>',''))"/>
+ <xsl:value-of select="str:encode-uri(normalize-space(translate(substring-after($tranW,')'),'[]{}()<>','')), 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>
<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>
<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>
<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>
<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>
<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>
<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'">
<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>
<!-- 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>
<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>
<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>
<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>
<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>
<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>
<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: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">
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,']})>','))))')"/>
<xsl:choose>
<xsl:when test="contains($tranW,')')">
- <xsl:value-of select="normalize-space(translate(substring-after($tranW,')'),'[]{}()<>',''))"/>
+ <xsl:value-of select="str:encode-uri(normalize-space(translate(substring-after($tranW,')'),'[]{}()<>','')), 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>
<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>
<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>
<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)">
</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">
<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>
<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>
<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'">
</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>
<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">
<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>
</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>
<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">
</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>
</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>
<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>
</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>
<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: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: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">
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,']})>','))))')"/>
<xsl:choose>
<xsl:when test="contains($tranW,')')">
- <xsl:value-of select="normalize-space(translate(substring-after($tranW,')'),'[]{}()<>',''))"/>
+ <xsl:value-of select="str:encode-uri(normalize-space(translate(substring-after($tranW,')'),'[]{}()<>','')), 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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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'">
</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>
<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: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>
<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: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">
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,']})>','))))')"/>
<xsl:choose>
<xsl:when test="contains($tranW,')')">
- <xsl:value-of select="normalize-space(translate(substring-after($tranW,')'),'[]{}()<>',''))"/>
+ <xsl:value-of select="str:encode-uri(normalize-space(translate(substring-after($tranW,')'),'[]{}()<>','')), 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>
<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>
<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" />
<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)">
</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">
<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) > 0">
<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>
<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>