]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/nuprl_stylesheets/nuprl_links_library.xsl
First commit of the NuPRL stylesheets.
[helm.git] / helm / nuprl_stylesheets / nuprl_links_library.xsl
diff --git a/helm/nuprl_stylesheets/nuprl_links_library.xsl b/helm/nuprl_stylesheets/nuprl_links_library.xsl
new file mode 100644 (file)
index 0000000..d023d77
--- /dev/null
@@ -0,0 +1,369 @@
+<?xml version="1.0"?>
+
+<!-- Copyright (C) 2000, HELM Team                                     -->
+<!--                                                                   -->
+<!-- This file is part of HELM, an Hypertextual, Electronic            -->
+<!-- Library of Mathematics, developed at the Computer Science         -->
+<!-- Department, University of Bologna, Italy.                         -->
+<!--                                                                   -->
+<!-- HELM is free software; you can redistribute it and/or             -->
+<!-- modify it under the terms of the GNU General Public License       -->
+<!-- as published by the Free Software Foundation; either version 2    -->
+<!-- of the License, or (at your option) any later version.            -->
+<!--                                                                   -->
+<!-- HELM is distributed in the hope that it will be useful,           -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of    -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     -->
+<!-- GNU General Public License for more details.                      -->
+<!--                                                                   -->
+<!-- You should have received a copy of the GNU General Public License -->
+<!-- along with HELM; if not, write to the Free Software               -->
+<!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston,            -->
+<!-- MA  02111-1307, USA.                                              -->
+<!--                                                                   -->
+<!-- For details, see the HELM World-Wide-Web page,                    -->
+<!-- http://cs.unibo.it/helm/.                                         -->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                              xmlns:m="http://www.w3.org/1998/Math/MathML">
+
+<!--***********************************************************************--> 
+<!-- auxiliary functions                                                   -->
+<!-- HELM Group: Asperti, Padovani, Sacerdoti, Schena                      -->
+<!--***********************************************************************--> 
+
+<!--      * is used for objects                      -->
+<!--    th* is used for theories                     -->
+<!-- embed* is used for objects embedded in theories -->
+
+<xsl:param name="getterURL" select="'http://localhost:8081/'"/>
+<xsl:param name="processorURL" select="'http://localhost:8080/helm/servlet/uwobo/'"/>
+<xsl:param name="draw_graphURL" select="'http://localhost:8083/'"/>
+<xsl:param name="uri_set_queueURL" select="'http://localhost:8084/'"/>
+<xsl:param name="proofcheckerURL" select="'http://localhost:48084/'"/>
+<!-- URL to the frameset (control + output) -->
+<xsl:param name="topurl" select="''"/>
+<xsl:param name="interfaceURL" select="''"/>
+<xsl:param name="thinterfaceURL" select="''"/>
+
+<xsl:param name="keys" select="'C1,HC2,L'"/>
+<xsl:param name="embedkeys" select="'TC1,HC2,L'"/>
+<xsl:param name="thkeys" select="'T1,T2,L,E'"/>
+
+<xsl:param name="naturalLanguage" select="'yes'"/>
+<xsl:param name="annotations" select="'no'"/>
+<xsl:param name="UNICODEvsSYMBOL" select="'symbol'"/>
+
+<xsl:param name="media-type" select="'text/html'"/>
+<xsl:param name="thmedia-type" select="'text/html'"/>
+<xsl:param name="doctype-public" select="'-//W3C//DTD XHTML 1.0 Transitional//EN'"/>
+<xsl:param name="encoding" select="'iso-8859-1'"/>
+<xsl:param name="thencoding" select="'iso-8859-1'"/>
+
+
+<xsl:template name="quote">
+ <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 = ' '">
+     <xsl:call-template name="quote">
+      <xsl:with-param name="s" select="substring($s,2)"/>
+      <xsl:with-param name="news" select="concat($news,'%20')"/>
+     </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$char = '&amp;'">
+     <xsl:call-template name="quote">
+      <xsl:with-param name="s" select="substring($s,2)"/>
+      <xsl:with-param name="news" select="concat($news,'%26')"/>
+     </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$char = '?'">
+     <xsl:call-template name="quote">
+      <xsl:with-param name="s" select="substring($s,2)"/>
+      <xsl:with-param name="news" select="concat($news,'%3F')"/>
+     </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$char = '='">
+     <xsl:call-template name="quote">
+      <xsl:with-param name="s" select="substring($s,2)"/>
+      <xsl:with-param name="news" select="concat($news,'%3D')"/>
+     </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$char = '%'">
+     <xsl:call-template name="quote">
+      <xsl:with-param name="s" select="substring($s,2)"/>
+      <xsl:with-param name="news" select="concat($news,'%25')"/>
+     </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$char = ','">
+     <xsl:call-template name="quote">
+      <xsl:with-param name="s" select="substring($s,2)"/>
+      <xsl:with-param name="news" select="concat($news,'%2C')"/>
+     </xsl:call-template>
+    </xsl:when>
+<!--CSC: This breaks all the rest ;-)
+    <xsl:when test="$char = ':'">
+     <xsl:call-template name="quote">
+      <xsl:with-param name="s" select="substring($s,2)"/>
+      <xsl:with-param name="news" select="concat($news,'%3A')"/>
+     </xsl:call-template>
+    </xsl:when>
+-->
+    <xsl:otherwise>
+     <xsl:call-template name="quote">
+      <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:variable name="absPath">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s"><xsl:value-of select="$getterURL"/>getxml?uri=</xsl:with-param>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="escaped-doctype-public">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$doctype-public"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="escaped-processorURL">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$processorURL"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="escaped-getterURL">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$getterURL"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="escaped-interfaceURL">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$interfaceURL"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="escaped-topurl">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$topurl"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="escaped-thinterfaceURL">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$thinterfaceURL"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="quotedthkeys">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$thkeys"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="quotedembedkeys">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$embedkeys"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="quotedkeys">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$keys"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="quotedquotedkeys">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$quotedkeys"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="quotedquotedthkeys">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$quotedthkeys"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="quotedquotedembedkeys">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$quotedembedkeys"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="header0"><xsl:value-of select="$interfaceURL"/>?url=</xsl:variable>
+<xsl:variable name="thheader0"><xsl:value-of select="$thinterfaceURL"/>?url=</xsl:variable>
+<xsl:variable name="header1"><xsl:value-of select="$escaped-processorURL"/>apply?keys=</xsl:variable>
+<xsl:variable name="bothheader2">&#x26;param.naturalLanguage=<xsl:value-of select="$naturalLanguage"/>&#x26;param.proofcheckerURL=<xsl:value-of select="$proofcheckerURL"/>&#x26;param.draw_graphURL=<xsl:value-of select="$draw_graphURL"/>&#x26;param.uri_set_queueURL=<xsl:value-of select="$uri_set_queueURL"/>&#x26;param.UNICODEvsSYMBOL=<xsl:value-of select="$UNICODEvsSYMBOL"/>&#x26;param.annotations=<xsl:value-of select="$annotations"/>&#x26;prop.doctype-public=<xsl:value-of select="$escaped-doctype-public"/>&#x26;param.doctype-public=<xsl:value-of select="$escaped-doctype-public"/>&#x26;param.encoding=<xsl:value-of select="$encoding"/>&#x26;param.media-type=<xsl:value-of select="$media-type"/>&#x26;param.keys=<xsl:value-of select="$quotedkeys"/>&#x26;param.getterURL=<xsl:value-of select="$escaped-getterURL"/>&#x26;param.processorURL=<xsl:value-of select="$escaped-processorURL"/>&#x26;param.interfaceURL=<xsl:value-of select="$escaped-interfaceURL"/>&#x26;param.topurl=<xsl:value-of select="$escaped-topurl"/>&#x26;xmluri=<xsl:value-of select="$absPath"/></xsl:variable>
+<xsl:variable name="header2">&#x26;prop.media-type=<xsl:value-of select="$media-type"/>&#x26;prop.encoding=<xsl:value-of select="$encoding"/></xsl:variable>
+<xsl:variable name="thheader2">&#x26;prop.media-type=<xsl:value-of select="$thmedia-type"/>&#x26;param.thmedia-type=<xsl:value-of select="$thmedia-type"/>&#x26;param.thkeys=<xsl:value-of select="$quotedthkeys"/>&#x26;param.embedkeys=<xsl:value-of select="$quotedembedkeys"/>&#x26;param.thinterfaceURL=<xsl:value-of select="$escaped-thinterfaceURL"/>&#x26;param.thencoding=<xsl:value-of select="$thencoding"/>&#x26;prop.encoding=<xsl:value-of select="$thencoding"/></xsl:variable>
+
+<xsl:variable name="quotedheader1">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$header1"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="quotedbothheader2">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$bothheader2"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="quotedheader2">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$header2"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:variable name="quotedthheader2">
+ <xsl:call-template name="quote">
+  <xsl:with-param name="s" select="$thheader2"/>
+ </xsl:call-template>
+</xsl:variable>
+
+<!-- makeURL() maps URIs into URLs               -->
+<!-- The target of the URL is the whole frameset -->
+
+<xsl:variable name="biquotedfixedheader">
+ <xsl:value-of select="$header0"/>
+ <xsl:value-of select="$quotedheader1"/>
+ <xsl:value-of select="$quotedquotedkeys"/>
+ <xsl:value-of select="$quotedheader2"/>
+ <xsl:value-of select="$quotedbothheader2"/>
+</xsl:variable>
+
+<xsl:variable name="biquotedthfixedheader">
+ <xsl:value-of select="$thheader0"/>
+ <xsl:value-of select="$quotedheader1"/>
+ <xsl:value-of select="$quotedquotedthkeys"/>
+ <xsl:value-of select="$quotedthheader2"/>
+ <xsl:value-of select="$quotedbothheader2"/>
+</xsl:variable>
+
+<!-- NOTE: embedkeys and thkeys are propagated, but we are sure that -->
+<!-- they won't never be used.                                       -->
+<!--CSC: fixare il punto sopra!!! -->
+<!-- type, instead, is not propagated                                -->
+<xsl:template name="makeURL">
+<xsl:param name="uri" select="''"/>
+ <xsl:variable name="uri_after_sharp" select="substring-after($uri,'#')"/>
+ <xsl:variable name="cleanuri">
+  <xsl:choose>
+   <xsl:when test="$uri_after_sharp">
+    <xsl:value-of select="substring-before($uri,'#')"/>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:value-of select="$uri"/>
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="sharpsuffix">
+  <xsl:choose>
+   <xsl:when test="$uri_after_sharp">%23<xsl:value-of select="$uri_after_sharp"/></xsl:when>
+   <xsl:otherwise></xsl:otherwise>
+  </xsl:choose>
+ </xsl:variable>
+  <!-- CIC CODE removed -->
+  <!-- NuPRL CODE -->
+     <xsl:text>http://mowgli.cs.unibo.it:58080/apply?keys=NT,NC2,NL&amp;prop.doctype-public=&amp;prop.media-type=text/html&amp;param.doctype-public=&amp;param.encoding=&amp;param.media-type=text/html&amp;param.CICURI=cic:/CICURI.con&amp;param.naturalLanguage=yes&amp;param.annotations=no&amp;param.topurl=http://helm.cs.unibo.it/helm&amp;param.UNICODEvsSYMBOL=SYMBOL&amp;xmluri=</xsl:text>
+     <xsl:call-template name="quote">
+      <!-- The hard-coded getterURL -->
+      <xsl:with-param name="s" select="'http://mowgli.cs.unibo.it:58081/getxml?uri='"/>
+     </xsl:call-template>
+     <xsl:value-of select="$cleanuri"/>
+     <xsl:value-of select="$sharpsuffix"/>
+</xsl:template>
+
+<xsl:template name="makeTheoryURL">
+<xsl:param name="uri" select="''"/>
+ <xsl:variable name="uri_after_sharp" select="substring-after($uri,'#')"/>
+ <xsl:variable name="cleanuri">
+  <xsl:choose>
+   <xsl:when test="$uri_after_sharp">
+    <xsl:value-of select="substring-before($uri,'#')"/>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:value-of select="$uri"/>
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="sharpsuffix">
+  <xsl:choose>
+   <xsl:when test="$uri_after_sharp">%23<xsl:value-of select="$uri_after_sharp"/></xsl:when>
+   <xsl:otherwise></xsl:otherwise>
+  </xsl:choose>
+ </xsl:variable>
+     <xsl:value-of select="$biquotedthfixedheader"/>
+     <xsl:value-of select="$cleanuri"/>%26param.CICURI%3D<xsl:value-of select="$cleanuri"/>
+     <xsl:value-of select="$sharpsuffix"/>
+</xsl:template>
+
+<!-- makeURL4embedding() maps URIs into URLs              -->
+<!-- The target of the URL is only the processed document -->
+
+<xsl:template name="makeURL4embedding">
+<xsl:param name="uri" select="''"/>
+<xsl:param name="type" select="'standalone'"/>
+ <xsl:variable name="uri_after_sharp" select="substring-after($uri,'#')"/>
+ <xsl:variable name="cleanuri">
+  <xsl:choose>
+   <xsl:when test="$uri_after_sharp">
+    <xsl:value-of select="substring-before($uri,'#')"/>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:value-of select="$uri"/>
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="sharpsuffix">
+  <xsl:choose>
+   <xsl:when test="$uri_after_sharp">%23<xsl:value-of select="$uri_after_sharp"/></xsl:when>
+   <xsl:otherwise></xsl:otherwise>
+  </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$header1"/>
+ <xsl:value-of select="$quotedembedkeys"/>
+ <xsl:value-of select="$header2"/>
+ <xsl:value-of select="$bothheader2"/>
+ <xsl:value-of select="$cleanuri"/>&#x26;param.CICURI=<xsl:value-of select="$cleanuri"/>&#x26;param.type=<xsl:value-of select="$type"/><xsl:value-of select="$sharpsuffix"/>
+</xsl:template>
+
+<!-- makeURL4InnerTypes() maps URIs into URLs              -->
+<!-- The target of the URL is only the processed document -->
+
+<xsl:template name="makeURL4InnerTypes">
+<xsl:param name="uri" select="''"/>
+ <xsl:variable name="uri_after_sharp" select="substring-after($uri,'#')"/>
+ <xsl:variable name="cleanuri">
+  <xsl:choose>
+   <xsl:when test="$uri_after_sharp">
+    <xsl:value-of select="substring-before($uri,'#')"/>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:value-of select="$uri"/>
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="sharpsuffix">
+  <xsl:choose>
+   <xsl:when test="$uri_after_sharp">%23<xsl:value-of select="$uri_after_sharp"/></xsl:when>
+   <xsl:otherwise></xsl:otherwise>
+  </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$header1"/>d_c&#x26;param.getterURL=<xsl:value-of select="$escaped-getterURL"/>&#x26;param.CICURI=<xsl:value-of select="$cleanuri"/>&#x26;xmluri=<xsl:value-of select="$absPath"/><xsl:value-of select="$cleanuri"/>
+ <xsl:value-of select="$sharpsuffix"/>
+</xsl:template>
+
+</xsl:stylesheet>