]> matita.cs.unibo.it Git - helm.git/blob - helm/on-line/xslt/ls2theory.xsl
Ordering is now done in no-case style.
[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           <xsl:apply-templates select="object[@name='index.theory']"/>
38           <!-- sorting: folders interleaved with theories, then objects-->
39           <xsl:apply-templates
40             select="section|object[substring-after(@name,'.')='theory' and
41                     not(@name='index.theory')]">
42             <xsl:sort select="translate(concat(@name,string(.)),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />
43           </xsl:apply-templates>
44           <xsl:apply-templates
45             select="object[not(substring-after(@name,'.')='theory')]" />
46           <!-- sorting: folders, theories, objects -->
47 <!--
48           <xsl:apply-templates select="section" />
49           <xsl:apply-templates select="object" />
50 -->
51         </ul>
52       </body>
53     </html>
54   </xsl:template>
55
56   <xsl:template match="section">
57     <li class="folder">
58       <a class="folder" href="{concat($CICURI, text(), '/')}"
59         helm:helm_link="href">
60         <xsl:value-of select="text()" />
61       </a>
62       <xsl:text>/</xsl:text>
63     </li>
64   </xsl:template>
65
66   <xsl:template match="object">
67     <xsl:choose>
68       <xsl:when test="substring-after(@name, '.')='theory'">
69         <li class="theory">
70           <a class="theory" href="{concat($CICURI, @name)}"
71             helm:helm_link="href">
72             <xsl:value-of select="@name" />
73           </a>
74         </li>
75       </xsl:when>
76       <xsl:otherwise>
77         <li class="object">
78           <a class="object"
79             href="{concat('cic:', substring-after($CICURI, ':'), @name)}"
80             helm:helm_link="href">
81             <xsl:value-of select="@name" />
82           </a>
83         </li>
84       </xsl:otherwise>
85     </xsl:choose>
86   </xsl:template>
87
88 </xsl:stylesheet>