]> matita.cs.unibo.it Git - helm.git/commitdiff
There were still many problems with URIs with a ' in the middle.
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Thu, 25 Oct 2001 16:36:04 +0000 (16:36 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Thu, 25 Oct 2001 16:36:04 +0000 (16:36 +0000)
Now they should be all resolved (in theory, at least ;-)

helm/on-line/xslt/ls2html.xsl
helm/on-line/xslt/metadataLib.xsl
helm/on-line/xslt/utils.xsl [new file with mode: 0644]

index a7d27e996128ba943ac57c1ef87ad1202da520bb..965d15f12ecb1d983a2f6e1f5b39a8f1ee4d341c 100644 (file)
@@ -5,6 +5,8 @@
 
 <xsl:output method="html" encoding="iso-8859-1"/>
 
+<xsl:import href="utils.xsl"/>
+
 <!-- uri must end with '/' -->
 <xsl:param name="uri" select="''"/>
 <xsl:param name="keys" select="''"/>
    <img border="0" src="{concat($interfaceURL,'/icons/',$icon)}" alt="[{$alt}]"/>
   </td>
   <td>
-<!-- Substituted with next lines to avoid Mozilla 0.8 bug setting this.search
-    <a
-      onClick=
-       "top.{$target}uri='{$uri}';
-        refresh{$target}Header('{$interfaceURL}/html/library/header.html');
-        this.search='?keys={$keys}' +
-         '&amp;xmluri=' + escape('{$getterURL}ls?format=xml'+'&amp;baseuri={$uri}')+
-         '&amp;param.uri={$uri}' +
-         '&amp;param.keys={$keys}' +
-         '&amp;param.getterURL={$getterURL}' +
-         '&amp;param.target={$target}' +
-         '&amp;param.interfaceURL={$interfaceURL}';"
-      onMouseOver="window.status='{$uri}'; return true"
-      href="apply"
-   ><xsl:value-of select="$basename"/></a>
--->
+    <xsl:variable name="quoteduri">
+     <xsl:call-template name="jsquote">
+      <xsl:with-param name="s" select="$uri"/>
+     </xsl:call-template>
+    </xsl:variable>
     <a
       onClick=
-       "top.{$target}uri='{$uri}';
+       "top.{$target}uri='{$quoteduri}';
         refresh{$target}Header('{$interfaceURL}/html/library/header.html');
         var search='?keys={$keys}' +
-         '&amp;xmluri=' + escape('{$getterURL}ls?format=xml'+'&amp;baseuri={$uri}')+
-         '&amp;param.uri={$uri}' +
+         '&amp;xmluri=' + escape('{$getterURL}ls?format=xml'+'&amp;baseuri={$quoteduri}')+
+         '&amp;param.uri={$quoteduri}' +
          '&amp;param.keys={$keys}' +
          '&amp;param.getterURL={$getterURL}' +
          '&amp;param.target={$target}' +
@@ -75,7 +66,7 @@
          pathname = '/' + pathname;
         this.href=
          this.protocol + '//' + this.host + pathname + search + this.hash;"
-      onMouseOver="window.status='{$uri}'; return true"
+      onMouseOver="window.status='{$quoteduri}'; return true"
       href="apply"
    ><xsl:value-of select="$basename"/></a>
   </td>
    <img border="0" src="{concat($interfaceURL,'/icons/',$icon)}" alt="[{@name}]"/>
   </td>
   <td>
+   <xsl:variable name="quoteduri">
+    <xsl:call-template name="jsquote">
+     <xsl:with-param name="s" select="$uri"/>
+    </xsl:call-template>
+   </xsl:variable>
+   <xsl:variable name="quotedname">
+    <xsl:call-template name="jsquote">
+     <xsl:with-param name="s" select="$name"/>
+    </xsl:call-template>
+   </xsl:variable>
    <a href="" target="{$target}"
-      onClick="this.href=makeURL('{$target}','{concat($uri,$name)}','{$ann}','{$types}')"
-      onMouseOver="window.status='{concat($uri,$name)}'; return true"
+      onClick="this.href=makeURL('{$target}','{concat($quoteduri,$quotedname)}','{$ann}','{$types}')"
+      onMouseOver="window.status='{concat($quoteduri,$quotedname)}'; return true"
    ><xsl:value-of select="$name"/></a>
   </td>
  </tr>
index ef45c40ea8b0e0fbaaead364aa6c75c21d9b0cb0..e807cc00f9e71b9c6c329334b3e7a24afbda7338 100644 (file)
@@ -4,6 +4,8 @@
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:subst="http://www.cs.unibo.it/helm/subst">
 
+<xsl:import href="utils.xsl"/>
+
 <xsl:param name="CICURI" select="''"/>
 <xsl:param name="getterURL" select="''"/>
 <xsl:param name="draw_graphURL" select="''"/>
 <xsl:variable name="BaseRDFURLForward" select="concat($BaseRDFURL,'forward//')"/>
 <xsl:variable name="BaseRDFURLBackward" select="concat($BaseRDFURL,'backward//')"/>
 
-<!-- Next function to quote strings for JavaScript (i.e. ' ==> \' -->
-<xsl:template name="jsquote">
- <xsl:param name="s" select="''"/>
- <xsl:param name="news" select="''"/>
- <xsl:choose>
-  <xsl:when test="$s = ''"><xsl:value-of select="$news"/></xsl:when>
-  <xsl:otherwise>
-   <xsl:variable name="char" select="substring($s,1,1)"/>
-   <xsl:choose>
-    <xsl:when test='$char = "&apos;"'>
-     <xsl:call-template name="jsquote">
-      <xsl:with-param name="s" select="substring($s,2)"/>
-      <xsl:with-param name="news" select='concat($news,"\\\&apos;")'/>
-     </xsl:call-template>
-    </xsl:when>
-    <xsl:otherwise>
-     <xsl:call-template name="jsquote">
-      <xsl:with-param name="s" select="substring($s,2)"/>
-      <xsl:with-param name="news" select="concat($news,$char)"/>
-     </xsl:call-template>
-    </xsl:otherwise>
-   </xsl:choose>
-  </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
 <xsl:template match="/">
  <html>
   <head>
@@ -77,6 +53,7 @@
  <xsl:variable name="quotedCICURI">
   <xsl:call-template name="jsquote">
    <xsl:with-param name="s" select="$CICURI"/>
+   <xsl:with-param name="times" select="2"/>
   </xsl:call-template>
  </xsl:variable>
  <xsl:choose>
diff --git a/helm/on-line/xslt/utils.xsl b/helm/on-line/xslt/utils.xsl
new file mode 100644 (file)
index 0000000..9213c24
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<!-- Next function to quote strings for JavaScript (i.e. ' ==> \' -->
+<xsl:template name="jsquote">
+ <xsl:param name="s" select="''"/>
+ <xsl:param name="news" select="''"/>
+ <xsl:param name="times" select="1"/>
+ <xsl:choose>
+  <xsl:when test="$s = ''"><xsl:value-of select="$news"/></xsl:when>
+  <xsl:otherwise>
+   <xsl:variable name="char" select="substring($s,1,1)"/>
+   <xsl:choose>
+    <xsl:when test='$char = "&apos;" and $times = 1'>
+     <xsl:call-template name="jsquote">
+      <xsl:with-param name="s" select="substring($s,2)"/>
+      <xsl:with-param name="news" select='concat($news,"\&apos;")'/>
+      <xsl:with-param name="times" select="$times"/>
+     </xsl:call-template>
+    </xsl:when>
+    <xsl:when test='$char = "&apos;" and $times = 2'>
+     <xsl:call-template name="jsquote">
+      <xsl:with-param name="s" select="substring($s,2)"/>
+      <xsl:with-param name="news" select='concat($news,"\\\&apos;")'/>
+      <xsl:with-param name="times" select="$times"/>
+     </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:call-template name="jsquote">
+      <xsl:with-param name="s" select="substring($s,2)"/>
+      <xsl:with-param name="news" select="concat($news,$char)"/>
+      <xsl:with-param name="times" select="$times"/>
+     </xsl:call-template>
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>