]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/on-line/xslt/ls2theory.xsl
ocaml 3.09 transition
[helm.git] / helm / on-line / xslt / ls2theory.xsl
index ed9c217e010c931056d7dbdc4468c21488d611d6..86eb208495c6ab7732e7202780a24f62c621edde 100644 (file)
@@ -9,25 +9,51 @@
   <xsl:output method="html" encoding="iso-8859-1"/>
 
   <xsl:param name="CICURI" select="''" />
+  <xsl:param name="interfaceURL" select="''" />
 
   <xsl:template match="ls">
     <html>
       <head>
        <style>
+         li.theory {
+           list-style-image:
+             url(<xsl:value-of select="$interfaceURL"/>/icons/theory.png)
+         }
+         li.folder {
+           list-style-image:
+             url(<xsl:value-of select="$interfaceURL"/>/icons/folder.png)
+         }
+         li.object {
+           list-style-image:
+             url(<xsl:value-of select="$interfaceURL"/>/icons/object.png)
+         }
+         a.theory { text-decoration: none; }
+         a.folder { text-decoration: none; }
+         a.object { text-decoration: none; }
        </style>
       </head>
       <body>
        <ul>
-         <xsl:apply-templates select="section" />
-         <xsl:apply-templates select="object" />
+          <xsl:apply-templates select="object[@name='index.theory']"/>
+         <!-- sorting: folders interleaved with theories, then objects-->
+         <xsl:apply-templates
+           select="section|object[substring-after(@name,'.')='theory' and
+                    not(@name='index.theory')]">
+           <xsl:sort select="translate(concat(@name,string(.)),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />
+         </xsl:apply-templates>
+         <xsl:apply-templates
+           select="object[not(substring-after(@name,'.')='theory')]" >
+           <xsl:sort select="translate(concat(@name,string(.)),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />
+          </xsl:apply-templates>
        </ul>
       </body>
     </html>
   </xsl:template>
 
   <xsl:template match="section">
-    <li>
-      <a class="section" href="{concat($CICURI, text(), '/')}" helm:helm_link="href">
+    <li class="folder">
+      <a class="folder" href="{concat($CICURI, text(), '/')}"
+       helm:helm_link="href">
        <xsl:value-of select="text()" />
       </a>
       <xsl:text>/</xsl:text>
   </xsl:template>
 
   <xsl:template match="object">
-    <li>
-      <a class="object" href="{concat($CICURI, @name)}" helm:helm_link="href">
-       <xsl:value-of select="@name" />
-      </a>
-    </li>
+    <xsl:choose>
+      <xsl:when test="substring-after(@name, '.')='theory'">
+       <li class="theory">
+         <a class="theory" href="{concat($CICURI, @name)}"
+           helm:helm_link="href">
+           <xsl:value-of select="@name" />
+         </a>
+       </li>
+      </xsl:when>
+      <xsl:otherwise>
+       <li class="object">
+         <a class="object"
+           href="{concat('cic:', substring-after($CICURI, ':'), @name)}"
+           helm:helm_link="href">
+           <xsl:value-of select="@name" />
+         </a>
+       </li>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:template>
 
 </xsl:stylesheet>