]> matita.cs.unibo.it Git - helm.git/blob - helm/on-line/xslt/ls2html.xsl
Control panel added to CIC window
[helm.git] / helm / on-line / xslt / ls2html.xsl
1 <?xml version="1.0"?>
2
3
4 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5
6 <xsl:output method="html" encoding="iso-8859-1"/>
7
8 <!-- uri must end with '/' -->
9 <xsl:param name="uri" select="''"/>
10 <xsl:param name="keys" select="''"/>
11 <xsl:param name="getterURL" select="''"/>
12 <xsl:param name="interfaceURL" select="''"/>
13 <xsl:param name="target" select="''"/>
14
15 <xsl:template name="chop">
16  <xsl:param name="uri" select="''"/>
17  <xsl:param name="prefix" select="''"/>
18  <xsl:variable name="newprefix" select="substring-before($uri,'/')"/>
19  <xsl:choose>
20   <xsl:when test="$newprefix = ''"><xsl:value-of select="$prefix"/></xsl:when>
21   <xsl:otherwise>
22    <xsl:call-template name="chop">
23     <xsl:with-param name="uri" select="substring-after($uri,'/')"/>
24     <xsl:with-param name="prefix" select="concat($prefix,$newprefix,'/')"/>
25    </xsl:call-template>
26   </xsl:otherwise>
27  </xsl:choose>
28 </xsl:template>
29
30 <xsl:variable name="uridotdot">
31  <xsl:call-template name="chop">
32   <xsl:with-param name="uri" select="substring($uri,1,string-length($uri)-1)"/>
33  </xsl:call-template>
34 </xsl:variable>
35
36 <xsl:template name="makeDir">
37  <xsl:param name="uri" select="''"/>
38  <xsl:param name="basename" select="''"/>
39  <xsl:param name="icon" select="''"/>
40  <xsl:param name="alt" select="''"/>
41  <tr>
42   <td>
43    <img border="0" src="{concat($interfaceURL,'/icons/',$icon)}" alt="[{$alt}]"/>
44   </td>
45   <td>
46     <a
47       onClick=
48        "top.{$target}uri='{$uri}';
49         refresh{$target}Header('{$interfaceURL}/html/library/header.html');
50         this.search='?keys={$keys}' +
51          '&amp;xmluri=' + escape('{$getterURL}ls?format=xml'+'&amp;baseuri={$uri}')+
52          '&amp;param.uri={$uri}' +
53          '&amp;param.keys={$keys}' +
54          '&amp;param.getterURL={$getterURL}' +
55          '&amp;param.target={$target}' +
56          '&amp;param.interfaceURL={$interfaceURL}';"
57       onMouseOver="window.status='{$uri}'; return true"
58       href="apply"
59    ><xsl:value-of select="$basename"/></a>
60   </td>
61  </tr>
62 </xsl:template>
63
64 <xsl:template match="/">
65  <html>
66   <head>
67    <title>Index of <xsl:value-of select="$uri"/></title>
68    <xsl:copy-of select="document(concat($interfaceURL,'/javascript/control.js_xml'))" />
69    <xsl:copy-of select="document(concat($interfaceURL,'/javascript/utils.js_xml'))" />
70   </head>
71   <body bgcolor="#ffffff" text="#000000">
72    <table>
73     <xsl:if test="$uridotdot != ''">
74      <xsl:call-template name="makeDir">
75       <xsl:with-param name="uri" select="$uridotdot"/>
76       <xsl:with-param name="basename" select="'Parent Directory'"/>
77       <xsl:with-param name="icon" select="'back.gif'"/>
78       <xsl:with-param name="alt" select="'Parent Directory'"/>
79      </xsl:call-template>
80     </xsl:if>
81     <xsl:apply-templates select="*"/>
82    </table>
83    <hr noshade="yes" align="left" width="80%"/>
84   </body>
85  </html>
86 </xsl:template>
87
88 <xsl:template match="section">
89  <xsl:variable name="diruri">
90   <xsl:value-of select="."/>
91  </xsl:variable>
92  <xsl:call-template name="makeDir">
93   <xsl:with-param name="uri" select="concat($uri,$diruri,'/')"/>
94   <xsl:with-param name="basename" select="$diruri"/>
95   <xsl:with-param name="icon" select="'folder.gif'"/>
96   <xsl:with-param name="alt" select="$uri"/>
97  </xsl:call-template>
98 </xsl:template>
99
100 <xsl:template match="object">
101  <xsl:variable name="name" select="@name"/>
102  <xsl:variable name="ann" select="ann/@value"/>
103  <xsl:variable name="types" select="types/@value"/>
104  <xsl:variable name="icon">
105   <xsl:choose>
106    <xsl:when test="$ann = 'YES'">text.gif</xsl:when>
107    <xsl:otherwise>generic.red.gif</xsl:otherwise>
108   </xsl:choose>
109  </xsl:variable>
110  <tr>
111   <td>
112    <img border="0" src="{concat($interfaceURL,'/icons/',$icon)}" alt="[{@name}]"/>
113   </td>
114   <td>
115    <a href="" target="{$target}"
116       onClick="this.href=makeURL('{$target}','{concat($uri,$name)}','{$ann}','{$types}')"
117       onMouseOver="window.status='{concat($uri,$name)}'; return true"
118    ><xsl:value-of select="$name"/></a>
119   </td>
120  </tr>
121 </xsl:template>
122
123 </xsl:stylesheet>