Bug 14716: Fix more unencoded url parameters.
[koha-ffzg.git] / koha-tmpl / intranet-tmpl / prog / en / xslt / UNIMARCslimUtils.xsl
index 07d755b..48d50c5 100644 (file)
@@ -1,5 +1,13 @@
 <?xml version='1.0'?>
-<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<!DOCTYPE stylesheet [<!ENTITY nbsp "&#160;" >]>
+
+<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"/>
@@ -22,7 +30,7 @@
 
   <xsl:template name="tag_210">
     <li>
-      <strong>Édition: </strong>
+      <strong>Publication: </strong>
       <xsl:for-each select="marc:datafield[@tag=210]">
         <span>
           <xsl:call-template name="addClassRtl" />
@@ -82,7 +90,7 @@
        <xsl:template name="tag_4xx">
     <xsl:for-each select="marc:datafield[@tag=464 or @tag=461]">
         <li>
-        <strong>Extrait de: </strong>
+        <strong>Linked with: </strong>
         <span>
           <xsl:call-template name="addClassRtl" />
           <xsl:if test="marc:subfield[@code='t']">
                <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">
                </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)"/>
           <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="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">
             <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="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']">
     </xsl:if>
   </xsl:template>
 
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>