Bug 14716: URI-encode URLs in UNIMARC xsl templates.
[srvgit] / koha-tmpl / intranet-tmpl / prog / en / xslt / UNIMARCslimUtils.xsl
index c04a8e4..e78e8d7 100644 (file)
@@ -2,7 +2,12 @@
 
 <!DOCTYPE stylesheet [<!ENTITY nbsp "&#160;" >]>
 
-<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:stylesheet version="1.0"
+  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:str="http://exslt.org/strings"
+  exclude-result-prefixes="marc items str">
 
   <xsl:template name="datafield">
     <xsl:param name="tag"/>
                </xsl:if>
        </xsl:template>
 
+  <xsl:template name="buildBiblioDefaultViewURL">
+      <xsl:param name="IntranetBiblioDefaultView"/>
+      <xsl:choose>
+          <xsl:when test="$IntranetBiblioDefaultView='normal'">
+              <xsl:text>/cgi-bin/koha/catalogue/detail.pl?biblionumber=</xsl:text>
+          </xsl:when>
+          <xsl:when test="$IntranetBiblioDefaultView='isbd'">
+              <xsl:text>/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=</xsl:text>
+          </xsl:when>
+          <xsl:when test="$IntranetBiblioDefaultView='labeled_marc'">
+              <xsl:text>/cgi-bin/koha/catalogue/labeledMARCdetail.pl?biblionumber=</xsl:text>
+          </xsl:when>
+          <xsl:when test="$IntranetBiblioDefaultView='marc'">
+              <xsl:text>/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+              <xsl:text>/cgi-bin/koha/catalogue/detail.pl?biblionumber=</xsl:text>
+          </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+       <xsl:template name="chopSpecialCharacters">
+        <xsl:param name="title" />
+        <xsl:variable name="ntitle"
+             select="translate($title, '&#x0098;&#x009C;&#xC29C;&#xC29B;&#xC298;&#xC288;&#xC289;','')"/>
+        <xsl:value-of select="$ntitle" />
+    </xsl:template>
+
+
        <xsl:template name="chopPunctuation">
                <xsl:param name="chopString"/>
                <xsl:variable name="length" select="string-length($chopString)"/>
                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
               </xsl:when>
               <xsl:otherwise>
-                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
+                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
               </xsl:otherwise>
             </xsl:choose>
             <xsl:call-template name="chopPunctuation">
                   <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
                 </xsl:when>
                 <xsl:otherwise>
-                  <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='b']"/></xsl:attribute>
+                  <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='b']"/></xsl:attribute>
                 </xsl:otherwise>
               </xsl:choose>
               <xsl:if test="marc:subfield[@code='a']">