]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/html_init.xsl
- the mathql interpreter is not helm-dependent any more
[helm.git] / helm / style / html_init.xsl
index 93791685ce848fbd5780dcf0e7cf7aea8b6ae80d..46fc61b249fa71842a62649809165a69ed6896c4 100644 (file)
@@ -62,6 +62,9 @@
       </xsl:when>
       <xsl:when test="$symbol = 'times'">
        <xsl:value-of select="'&#42;'"/>
+      </xsl:when> 
+      <xsl:when test="$symbol = 'divide'">
+       <xsl:value-of select="'&#47;'"/>
       </xsl:when>
       <xsl:when test="$symbol = 'minus'">
        <xsl:value-of select="'&#45;'"/>
       <xsl:when test="$symbol = 'times'">
        <xsl:value-of select="'&#8727;'"/>
       </xsl:when>
+      <xsl:when test="$symbol = 'divide'">
+       <xsl:value-of select="'&#47;'"/>
+      </xsl:when>
       <xsl:when test="$symbol = 'minus'">
        <xsl:value-of select="'&#8722;'"/>
       </xsl:when>
 
 <!-- INLINE MODE : BASIC OPERATORS -->
 
+<xsl:template mode="inline" match="m:infinity">
+ <xsl:choose>
+  <xsl:when test="$UNICODEvsSYMBOL = 'symbol'">
+   <FONT FACE="symbol" color="'blue'">
+    <xsl:value-of select="'&#165;'"/>
+   </FONT>
+  </xsl:when>
+  <xsl:otherwise>
+   <FONT color="'blue'">
+    <!-- VERIFICARE -->
+    <xsl:value-of select="'&#165;'"/>
+   </FONT>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template mode="inline" match="m:eq|m:leq|m:lt|m:geq|m:gt">
+  <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
+  <xsl:choose>
+  <xsl:when test="$uri != ''">
+   <a href="{$uri}">
+    <xsl:call-template name="mksymbol-init">
+     <xsl:with-param name="symbol" select="local-name(.)"/>
+    </xsl:call-template>
+   </a>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:call-template name="mksymbol-init">
+     <xsl:with-param name="symbol" select="local-name(.)"/>
+   </xsl:call-template>
+  </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
  <xsl:template mode="inline" match="m:apply[m:and|m:or|m:eq|m:neq|m:leq|m:lt
-       |m:geq|m:gt|m:plus|m:times]">
-  <xsl:variable name="uri">
-   <xsl:value-of select="*[1]/@definitionURL"/>
-  </xsl:variable>
+       |m:geq|m:gt|m:plus|m:times|m:divide]">
+  <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
   <xsl:text>(</xsl:text>
   <xsl:apply-templates mode="inline" select="*[2]"/>
-  <a href="{$uri}">
+  <xsl:choose>
+  <xsl:when test="$uri != ''">
+   <a href="{$uri}">
+    <xsl:call-template name="mksymbol-init">
+     <xsl:with-param name="symbol" select="local-name(*[1])"/>
+    </xsl:call-template>
+   </a>
+  </xsl:when>
+  <xsl:otherwise>
    <xsl:call-template name="mksymbol-init">
-    <xsl:with-param name="symbol" select="local-name(*[1])"/>
+     <xsl:with-param name="symbol" select="local-name(*[1])"/>
    </xsl:call-template>
-  </a>
+  </xsl:otherwise>
+  </xsl:choose>
   <xsl:apply-templates mode="inline" select="*[3]"/>
   <xsl:text>)</xsl:text>
  </xsl:template>
 <!-- INLINE MODE - MINUS (can be unary!) -->
 
 <xsl:template mode="inline" match="m:apply[m:minus]">
-  <xsl:variable name="uri">
-   <xsl:value-of select="*[1]/@definitionURL"/>
-  </xsl:variable>
+  <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
   <xsl:choose>
    <xsl:when test="count(child::*)=2">
-    <a href="{$uri}">
+    <xsl:choose>
+    <xsl:when test="$uri != ''">
+     <a href="{$uri}">
+      <xsl:call-template name="mksymbol-init">
+       <xsl:with-param name="symbol" select="'minus'"/>
+      </xsl:call-template>
+     </a>
+    </xsl:when>
+    <xsl:otherwise>
      <xsl:call-template name="mksymbol-init">
-      <xsl:with-param name="symbol" select="'minus'"/>
+       <xsl:with-param name="symbol" select="'minus'"/>
      </xsl:call-template>
-    </a>
+    </xsl:otherwise>
+    </xsl:choose>
     <xsl:apply-templates mode="inline" select="*[2]"/>
    </xsl:when>
    <xsl:otherwise>
     <xsl:text>(</xsl:text>
     <xsl:apply-templates mode="inline" select="*[2]"/>
-    <a href="{$uri}">
+    <xsl:choose>
+    <xsl:when test="$uri != ''">
+     <a href="{$uri}">
+      <xsl:call-template name="mksymbol-init">
+       <xsl:with-param name="symbol" select="'minus'"/>
+      </xsl:call-template>
+     </a>
+    </xsl:when>
+    <xsl:otherwise>
      <xsl:call-template name="mksymbol-init">
-      <xsl:with-param name="symbol" select="'minus'"/>
+       <xsl:with-param name="symbol" select="'minus'"/>
      </xsl:call-template>
-    </a>
+    </xsl:otherwise>
+    </xsl:choose>
     <xsl:apply-templates mode="inline" select="*[3]"/>
     <xsl:text>)</xsl:text>
    </xsl:otherwise>
 
 <!-- INLINE MODE NOT -->
 
- <xsl:template mode="inline" match="m:apply[m:not]">
-  <xsl:variable name="uri">
-   <xsl:value-of select="m:not/@definitionURL"/>
-  </xsl:variable>
-     <a href="{$uri}">
-      <xsl:call-template name="mksymbol-init">
-       <xsl:with-param name="symbol" select="'not'"/>
-      </xsl:call-template>
-     </a>
-     <xsl:apply-templates mode="inline" select="*[2]"/>
- </xsl:template>
+<xsl:template mode="inline" match="m:apply[m:not]">
+  <xsl:variable name="uri"><xsl:value-of select="m:not/@definitionURL"/></xsl:variable>
+  <xsl:choose>
+  <xsl:when test="$uri != ''">
+   <a href="{$uri}">
+    <xsl:call-template name="mksymbol-init">
+     <xsl:with-param name="symbol" select="'not'"/>
+    </xsl:call-template>
+   </a>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:call-template name="mksymbol-init">
+    <xsl:with-param name="symbol" select="'not'"/>
+   </xsl:call-template>
+  </xsl:otherwise>
+  </xsl:choose>
+  <xsl:apply-templates mode="inline" select="*[2]"/>
+</xsl:template>
 
 <!-- INLINE MODE EXISTS -->
 
  <xsl:template mode="inline" match="m:apply[m:exists]">
-  <xsl:variable name="uri">
-   <xsl:value-of select="m:exists/@definitionURL"/>
-  </xsl:variable>
-  <a href="{$uri}">
+  <xsl:variable name="uri"><xsl:value-of select="m:exists/@definitionURL"/></xsl:variable>
+  <xsl:choose>
+  <xsl:when test="$uri != ''">
+   <a href="{$uri}">
+    <xsl:call-template name="mksymbol-init">
+     <xsl:with-param name="symbol" select="'exists'"/>
+    </xsl:call-template>
+   </a>
+  </xsl:when>
+  <xsl:otherwise>
    <xsl:call-template name="mksymbol-init">
     <xsl:with-param name="symbol" select="'exists'"/>
    </xsl:call-template>
-  </a>
+  </xsl:otherwise>
+  </xsl:choose>
   <xsl:apply-templates select="m:bvar/m:ci"/>
   <xsl:text>:</xsl:text>
   <xsl:apply-templates mode="inline" select="m:condition"/>
 <!-- BASIC OPERATORS -->
 
  <xsl:template match="m:apply[m:and|m:or|m:eq|m:neq|m:leq|m:lt
-       |m:geq|m:gt|m:plus|m:times]">
+       |m:geq|m:gt|m:plus|m:times|m:divide]">
   <xsl:param name="current_indent" select="0"/> 
   <xsl:param name="width" select="$framewidth"/>
-  <xsl:variable name="uri">
-   <xsl:value-of select="*[1]/@definitionURL"/>
-  </xsl:variable>
+  <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
   <xsl:variable name="charlength">
    <xsl:apply-templates select="*[1]" mode="charcount"/>
   </xsl:variable>
      <xsl:call-template name="make_indent">
       <xsl:with-param name="current_indent" select="$current_indent + 2"/> 
      </xsl:call-template>
-     <a href="{$uri}">
-      <xsl:call-template name="mksymbol-init">
-       <xsl:with-param name="symbol" select="local-name(*[1])"/>
-      </xsl:call-template>
-     </a>
+     <xsl:choose>
+     <xsl:when test="$uri != ''">
+      <a href="{$uri}">
+       <xsl:call-template name="mksymbol-init">
+        <xsl:with-param name="symbol" select="local-name(*[1])"/>
+       </xsl:call-template>
+      </a>
+     </xsl:when>
+     <xsl:otherwise>
+       <xsl:call-template name="mksymbol-init">
+        <xsl:with-param name="symbol" select="local-name(*[1])"/>
+       </xsl:call-template>
+     </xsl:otherwise>
+     </xsl:choose>
      <xsl:apply-templates select="*[3]">
       <xsl:with-param name="current_indent" select="$current_indent + 2"/>
      </xsl:apply-templates>
 <xsl:template match="m:apply[m:minus]">
   <xsl:param name="current_indent" select="0"/> 
   <xsl:param name="width" select="$framewidth"/>
-  <xsl:variable name="uri">
-   <xsl:value-of select="*[1]/@definitionURL"/>
-  </xsl:variable>
+  <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
   <xsl:choose>
    <xsl:when test="count(child::*)=2">
-    <a href="{$uri}">
-     <xsl:call-template name="mksymbol-init">
-      <xsl:with-param name="symbol" select="'minus'"/>
-     </xsl:call-template>
-    </a>
+    <xsl:choose>
+    <xsl:when test="$uri != ''">
+     <a href="{$uri}">
+      <xsl:call-template name="mksymbol-init">
+       <xsl:with-param name="symbol" select="'minus'"/>
+      </xsl:call-template>
+     </a>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="mksymbol-init">
+       <xsl:with-param name="symbol" select="'minus'"/>
+      </xsl:call-template>
+    </xsl:otherwise>
+    </xsl:choose>
     <xsl:apply-templates select="*[2]">
      <xsl:with-param name="current_indent" select="$current_indent + 1"/>
     </xsl:apply-templates>
       <xsl:call-template name="make_indent">
        <xsl:with-param name="current_indent" select="$current_indent + 2"/> 
       </xsl:call-template>
-      <a href="{$uri}">
-       <xsl:call-template name="mksymbol-init">
-        <xsl:with-param name="symbol" select="'minus'"/>
-       </xsl:call-template>
-      </a>
+      <xsl:choose>
+      <xsl:when test="$uri != ''">
+       <a href="{$uri}">
+        <xsl:call-template name="mksymbol-init">
+         <xsl:with-param name="symbol" select="'minus'"/>
+        </xsl:call-template>
+       </a>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="mksymbol-init">
+         <xsl:with-param name="symbol" select="'minus'"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+      </xsl:choose>  
       <xsl:apply-templates select="*[3]">
        <xsl:with-param name="current_indent" select="$current_indent + 2"/>
       </xsl:apply-templates>
 
 <!-- NOT -->
 
- <xsl:template match="m:apply[m:not]">
+<xsl:template match="m:apply[m:not]">
   <xsl:param name="current_indent" select="0"/> 
   <xsl:param name="width" select="$framewidth"/>
-  <xsl:variable name="uri">
-   <xsl:value-of select="m:not/@definitionURL"/>
-  </xsl:variable>
-     <a href="{$uri}">
-      <xsl:call-template name="mksymbol-init">
-       <xsl:with-param name="symbol" select="'not'"/>
-      </xsl:call-template>
-     </a>
-     <xsl:apply-templates select="*[2]"/>
+  <xsl:variable name="uri"><xsl:value-of select="m:not/@definitionURL"/></xsl:variable>
+   <xsl:choose>
+   <xsl:when test="$uri != ''">
+    <a href="{$uri}">
+     <xsl:call-template name="mksymbol-init">
+      <xsl:with-param name="symbol" select="'not'"/>
+     </xsl:call-template>
+    </a>
+   </xsl:when>
+   <xsl:otherwise>
+     <xsl:call-template name="mksymbol-init">
+      <xsl:with-param name="symbol" select="'not'"/>
+     </xsl:call-template>
+   </xsl:otherwise>
+   </xsl:choose>
+   <xsl:apply-templates select="*[2]"/>
  </xsl:template>
 
 <!-- EXISTS -->
  <xsl:template match="m:apply[m:exists]">
   <xsl:param name="current_indent" select="0"/> 
   <xsl:param name="width" select="$framewidth"/>
-  <xsl:variable name="uri">
-   <xsl:value-of select="m:exists/@definitionURL"/>
-  </xsl:variable>
+  <xsl:variable name="uri"><xsl:value-of select="m:exists/@definitionURL"/></xsl:variable>
   <xsl:variable name="charlength">
    <xsl:apply-templates select="m:exists" mode="charcount"/>
   </xsl:variable>
   <xsl:choose>
     <xsl:when test="$charlength > $framewidth">
-     <a href="{$uri}">
-      <xsl:call-template name="mksymbol-init">
-       <xsl:with-param name="symbol" select="'exists'"/>
-      </xsl:call-template>
-     </a>
+     <xsl:choose>
+     <xsl:when test="$uri != ''">
+      <a href="{$uri}">
+       <xsl:call-template name="mksymbol-init">
+        <xsl:with-param name="symbol" select="'exists'"/>
+       </xsl:call-template>
+      </a>
+     </xsl:when>
+     <xsl:otherwise>
+       <xsl:call-template name="mksymbol-init">
+        <xsl:with-param name="symbol" select="'exists'"/>
+       </xsl:call-template>
+     </xsl:otherwise>
+     </xsl:choose>
      <xsl:apply-templates select="m:bvar/m:ci"/>
      <xsl:text>:</xsl:text>
      <xsl:apply-templates select="m:condition">
 </xsl:template> 
 
 </xsl:stylesheet> 
-
-