]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/html_set.xsl
Initial revision
[helm.git] / helm / style / html_set.xsl
index 97e3b1e074c89197115aefec36bbd6edad638203..4003d258c48339b7a20b3e1a3fdb64242007a6f8 100644 (file)
 <!-- HELM Group: Asperti, Padovani, Sacerdoti, Schena                      -->
 <!--***********************************************************************--> 
 
+<xsl:template name="mksymbol">
+ <xsl:param name="symbol" select="''"/>
+  <xsl:choose>
+   <xsl:when test="$UNICODEvsSYMBOL = 'symbol'">
+    <xsl:variable name="fontsymbol">
+     <xsl:choose>
+      <xsl:when test="$symbol = 'emptyset'">
+       <xsl:value-of select="'&#198;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'in'">
+       <xsl:value-of select="'&#206;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'notin'">
+       <xsl:value-of select="'&#207;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'intersect'">
+       <xsl:value-of select="'&#199;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'union'">
+       <xsl:value-of select="'&#200;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'subset'">
+       <xsl:value-of select="'&#205;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'prsubset'">
+       <xsl:value-of select="'&#204;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'setdiff'">
+       <xsl:value-of select="'/'"/>
+      </xsl:when>
+     </xsl:choose>
+    </xsl:variable>
+    <FONT FACE="symbol" mathcolor="blue">
+     <xsl:value-of select="$fontsymbol"/>
+    </FONT>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:variable name="unicodesymbol">
+     <xsl:choose>
+      <xsl:when test="$symbol = 'emptyset'">
+       <xsl:value-of select="'&#8709;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'in'">
+       <xsl:value-of select="'&#8712;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'notin'">
+       <xsl:value-of select="'&#8713;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'intersect'">
+       <xsl:value-of select="'&#8745;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'union'">
+       <xsl:value-of select="'&#8746;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'subset'">
+       <xsl:value-of select="'&#8838;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'prsubset'">
+       <xsl:value-of select="'&#8834;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'setdiff'">
+       <xsl:value-of select="'&#47;'"/>
+      </xsl:when>
+     </xsl:choose>
+    </xsl:variable>
+    <xsl:value-of select="$unicodesymbol"/>
+   </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
 <!-- **************************************************************** -->
 <!--                   INLINE MODE                                    -->
 <!-- **************************************************************** -->
 <!-- SET -->
 
  <xsl:template mode="inline" match="m:set">
-  <xsl:variable name="uri">
-   <xsl:value-of select="concat(string($absPath), @definitionURL)"/>
-  </xsl:variable>
+  <xsl:variable name="uri" select="@definitionURL"/>
   <xsl:choose>
    <xsl:when test="count(child::*) = 0">
-    <FONT FACE="symbol" mathcolor="blue">&#198;</FONT>
+    <xsl:call-template name="mksymbol">
+     <xsl:with-param name="symbol" select="'emptyset'"/>
+    </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
     <xsl:choose>
 
 <xsl:template mode="inline" match="m:apply[m:in|m:notin|m:intersect|m:union
   |m:subset|m:prsubset|m:setdiff]">
-  <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="symbol">
    <xsl:choose>
     <xsl:when test="m:in">
   </xsl:variable>
   <xsl:text>(</xsl:text>
   <xsl:apply-templates mode="inline" select="*[2]"/>
-  <a>
-   <xsl:attribute name="href">
-    <xsl:value-of select="concat(string($header),string($uri))"/>
-   </xsl:attribute>
-   <FONT FACE="symbol" mathcolor="blue">
-    <xsl:value-of select="$symbol"/>
-   </FONT>
-  </a>
+  <xsl:choose>
+  <xsl:when test="$uri != ''">
+   <a href="{$uri}">
+    <xsl:call-template name="mksymbol">
+     <xsl:with-param name="symbol">
+      <xsl:value-of select="local-name(*[1])"/>
+     </xsl:with-param>
+    </xsl:call-template>
+   </a>
+  </xsl:when>
+  <xsl:otherwise>
+    <xsl:call-template name="mksymbol">
+     <xsl:with-param name="symbol">
+      <xsl:value-of select="local-name(*[1])"/>
+     </xsl:with-param>
+    </xsl:call-template>
+  </xsl:otherwise>
+  </xsl:choose>
   <xsl:apply-templates mode="inline" select="*[3]"/>
   <xsl:text>)</xsl:text>
  </xsl:template>
   |m:subset|m:prsubset|m:setdiff]">
   <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>
-     <xsl:attribute name="href">
-      <xsl:value-of select="concat(string($header),string($uri))"/>
-     </xsl:attribute>
-     <FONT FACE="symbol" mathcolor="blue">
-      <xsl:value-of select="$symbol"/>
-     </FONT>
-     </a>
+     <xsl:choose>
+     <xsl:when test="$uri != ''"> 
+      <a href="{$uri}">
+       <xsl:call-template name="mksymbol">
+        <xsl:with-param name="symbol">
+         <xsl:value-of select="local-name(*[1])"/>
+        </xsl:with-param>
+       </xsl:call-template>
+      </a>
+     </xsl:when>
+     <xsl:otherwise>
+       <xsl:call-template name="mksymbol">
+        <xsl:with-param name="symbol">
+         <xsl:value-of select="local-name(*[1])"/>
+        </xsl:with-param>
+       </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:set">
   <xsl:param name="current_indent" select="0"/> 
   <xsl:param name="width" select="$framewidth"/>
-  <xsl:variable name="uri">
-   <xsl:value-of select="concat(string($absPath), @definitionURL)"/>
-  </xsl:variable>
+  <xsl:variable name="uri" select="@definitionURL"/>
   <xsl:choose>
    <xsl:when test="count(child::*) = 0">
-    <FONT FACE="symbol" mathcolor="blue">&#198;</FONT>
+    <xsl:call-template name="mksymbol">
+     <xsl:with-param name="symbol" select="'emptyset'"/>
+    </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
     <xsl:variable name="charlength">
 </xsl:template> 
 
 </xsl:stylesheet> 
-
-
-
-
-
-
-