]> matita.cs.unibo.it Git - helm.git/blob - helm/on-line/xslt/ls2theory.xsl
commented Record type constructor
[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             <xsl:sort select="translate(concat(@name,string(.)),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />
47           </xsl:apply-templates>
48         </ul>
49       </body>
50     </html>
51   </xsl:template>
52
53   <xsl:template match="section">
54     <li class="folder">
55       <a class="folder" href="{concat($CICURI, text(), '/')}"
56         helm:helm_link="href">
57         <xsl:value-of select="text()" />
58       </a>
59       <xsl:text>/</xsl:text>
60     </li>
61   </xsl:template>
62
63   <xsl:template match="object">
64     <xsl:choose>
65       <xsl:when test="substring-after(@name, '.')='theory'">
66         <li class="theory">
67           <a class="theory" href="{concat($CICURI, @name)}"
68             helm:helm_link="href">
69             <xsl:value-of select="@name" />
70           </a>
71         </li>
72       </xsl:when>
73       <xsl:otherwise>
74         <li class="object">
75           <a class="object"
76             href="{concat('cic:', substring-after($CICURI, ':'), @name)}"
77             helm:helm_link="href">
78             <xsl:value-of select="@name" />
79           </a>
80         </li>
81       </xsl:otherwise>
82     </xsl:choose>
83   </xsl:template>
84
85 </xsl:stylesheet>