]> matita.cs.unibo.it Git - helm.git/blob - helm/on-line/xslt/ls2theory.xsl
New HELM interface almost stable.
[helm.git] / helm / on-line / xslt / ls2theory.xsl
1 <?xml version="1.0"?>
2
3 <xsl:stylesheet version="1.0"
4   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5   xmlns:helm="http://www.cs.unibo.it/helm"
6   xmlns="http://www.w3.org/1999/xhtml"
7 >
8
9   <xsl:output method="html" encoding="iso-8859-1"/>
10
11   <xsl:param name="CICURI" select="''" />
12   <xsl:param name="interfaceURL" select="''" />
13
14   <xsl:template match="ls">
15     <html>
16       <head>
17         <style>
18           li.theory {
19             list-style-image:
20               url(<xsl:value-of select="$interfaceURL"/>/icons/theory.png)
21           }
22           li.folder {
23             list-style-image:
24               url(<xsl:value-of select="$interfaceURL"/>/icons/folder.png)
25           }
26           li.object {
27             list-style-image:
28               url(<xsl:value-of select="$interfaceURL"/>/icons/object.png)
29           }
30           a.theory { text-decoration: none; }
31           a.folder { text-decoration: none; }
32           a.object { text-decoration: none; }
33         </style>
34       </head>
35       <body>
36         <ul>
37           <!-- sorting: folders interleaved with theories, then objects-->
38           <xsl:apply-templates
39             select="section|object[substring-after(@name,'.')='theory']">
40             <xsl:sort select="concat(@name,string(.))" />
41           </xsl:apply-templates>
42           <xsl:apply-templates
43             select="object[not(substring-after(@name,'.')='theory')]" />
44           <!-- sorting: folders, theories, objects -->
45 <!--
46           <xsl:apply-templates select="section" />
47           <xsl:apply-templates select="object" />
48 -->
49         </ul>
50       </body>
51     </html>
52   </xsl:template>
53
54   <xsl:template match="section">
55     <li class="folder">
56       <a class="folder" href="{concat($CICURI, text(), '/')}"
57         helm:helm_link="href">
58         <xsl:value-of select="text()" />
59       </a>
60       <xsl:text>/</xsl:text>
61     </li>
62   </xsl:template>
63
64   <xsl:template match="object">
65     <xsl:choose>
66       <xsl:when test="substring-after(@name, '.')='theory'">
67         <li class="theory">
68           <a class="theory" href="{concat($CICURI, @name)}"
69             helm:helm_link="href">
70             <xsl:value-of select="@name" />
71           </a>
72         </li>
73       </xsl:when>
74       <xsl:otherwise>
75         <li class="object">
76           <a class="object"
77             href="{concat('cic:', substring-after($CICURI, ':'), @name)}"
78             helm:helm_link="href">
79             <xsl:value-of select="@name" />
80           </a>
81         </li>
82       </xsl:otherwise>
83     </xsl:choose>
84   </xsl:template>
85
86 </xsl:stylesheet>