]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/lambda-delta/xml/ld-html-library.xsl
we improved the stylesheets and we generated the static HTML pages
[helm.git] / helm / software / lambda-delta / xml / ld-html-library.xsl
index 9e09b447bf3c9994af2b7807b2a306275ac7650e..b640b0b0df1715bd28ccaefde0a9eb31218e19a2 100644 (file)
@@ -1,13 +1,33 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
+<!--
+    ||M||  This file is part of HELM, an Hypertextual, Electronic        
+    ||A||  Library of Mathematics, developed at the Computer Science     
+    ||T||  Department, University of Bologna, Italy.                     
+    ||I||                                                                
+    ||T||  HELM is free software; you can redistribute it and/or         
+    ||A||  modify it under the terms of the GNU General Public License   
+    \   /  version 2 or (at your option) any later version.              
+     \ /   This software is distributed as is, NO WARRANTY.              
+      V_______________________________________________________________ -->
+
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
+<xsl:variable name="sort">color: rgb(128, 0, 255);</xsl:variable>
+<xsl:variable name="cast">color: rgb(255, 0, 0);</xsl:variable>
+<xsl:variable name="binder">color: rgb(0, 160, 0);</xsl:variable>
+<xsl:variable name="global">color: rgb(0, 0, 255);</xsl:variable>
+
 <xsl:template name="sp">
    <xsl:text> </xsl:text>
 </xsl:template>
 
+<xsl:template name="sl">
+   <xsl:text>/</xsl:text>
+</xsl:template>
+
 <xsl:template name="fs">
-   <xsl:text>.</xsl:text>
+   <xsl:text>.&#x200B;</xsl:text>
 </xsl:template>
 
 <xsl:template name="op">
 </xsl:template>
 
 <xsl:template name="oa">
-   <xsl:text>&lt;</xsl:text>
+   <span style="{$cast}">
+      <xsl:text>&lt;</xsl:text>
+   </span>
 </xsl:template>
 
 <xsl:template name="ca">
-   <xsl:text>&gt;</xsl:text>
+   <span style="{$cast}">
+      <xsl:text>&gt;</xsl:text>
+   </span>
 </xsl:template>
 
 <xsl:template name="cn">
-   <xsl:text>:</xsl:text>
+   <span style="{$binder}">
+      <xsl:text>:</xsl:text>
+   </span>
 </xsl:template>
 
 <xsl:template name="eq">
-   <xsl:text>=</xsl:text>
+   <span style="{$binder}">
+      <xsl:text>=</xsl:text>
+   </span>
 </xsl:template>
 
 <xsl:template name="lambda">
-   <xsl:text disable-output-escaping="yes">&amp;lambda;</xsl:text>
+   <span style="{$binder}">
+      <xsl:text disable-output-escaping="yes">&amp;lambda;</xsl:text>
+   </span>
 </xsl:template>
 
 <xsl:template name="delta">
-   <xsl:text disable-output-escaping="yes">&amp;delta;</xsl:text>
+   <span style="{$binder}">
+      <xsl:text disable-output-escaping="yes">&amp;delta;</xsl:text>
+   </span>
 </xsl:template>
 
 <xsl:template name="chi">
-   <xsl:text disable-output-escaping="yes">&amp;chi;</xsl:text>
+   <span style="{$binder}">
+      <xsl:text disable-output-escaping="yes">&amp;chi;</xsl:text>
+   </span>
 </xsl:template>
 
 <xsl:template name="position">
       <xsl:value-of select="substring-after(@uri,'ld:')"/>
       <xsl:text>.html</xsl:text>
    </xsl:variable>
-   <a href="{$url}"><xsl:value-of select="@name"/></a>
+   <a href="{$url}" title="{@uri}"><xsl:value-of select="@name"/></a>
 </xsl:template>
 
 <xsl:template name="binder">
    <xsl:value-of select="@name"/>
 </xsl:template>
 
+<xsl:template name="global">
+   <span style="{$global}">
+      <xsl:value-of select="@name"/>
+   </span>   
+</xsl:template>
+
+<xsl:template name="mk_segment">
+   <xsl:param name="path"/>
+   <xsl:param name="name"/>
+   <xsl:variable name="url">
+      <xsl:value-of select="$baseurl"/>
+      <xsl:value-of select="substring-after($path,'ld:')"/>
+   </xsl:variable>
+   <a href="{$url}"><xsl:value-of select="$name"/></a>
+   <xsl:call-template name="sl"/>
+</xsl:template>
+
+<xsl:template name="mk_path">
+   <xsl:param name="rpath" select="@uri"/>
+   <xsl:variable name="newrpath" select="substring-after($rpath, '/')"/>
+   <xsl:choose>
+      <xsl:when test="$newrpath">
+         <xsl:variable name="segment" select="substring-before($rpath,$newrpath)"/>   
+         <xsl:call-template name="mk_segment">
+            <xsl:with-param name="path" select="substring-before(@uri,$newrpath)"/>
+            <xsl:with-param name="name" select="substring-before($segment,'/')"/>
+         </xsl:call-template>
+        <xsl:call-template name="mk_path">
+           <xsl:with-param name="rpath" select="substring-after($rpath,'/')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+         <xsl:variable name="path" select="substring-before(@uri,$rpath)"/>
+        <xsl:value-of select="substring-after(@uri,$path)"/>
+      </xsl:otherwise>
+   </xsl:choose>
+</xsl:template>
+
 <xsl:template name="entry">
    <xsl:call-template name="sp"/>
-   <xsl:call-template name="uri"/>
+   <xsl:call-template name="global"/>
    <xsl:call-template name="sp"/>
    <xsl:call-template name="op"/>
-   <xsl:value-of select="@uri"/>
+   <xsl:call-template name="mk_path"/>
    <xsl:call-template name="cp"/>
 </xsl:template>