]> matita.cs.unibo.it Git - helm.git/blob - helm/on-line/xslt/ls2html.xsl
This commit was manufactured by cvs2svn to create branch 'start'.
[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   </head>
70   <body bgcolor="#ffffff" text="#000000">
71    <table>
72     <xsl:if test="$uridotdot != ''">
73      <xsl:call-template name="makeDir">
74       <xsl:with-param name="uri" select="$uridotdot"/>
75       <xsl:with-param name="basename" select="'Parent Directory'"/>
76       <xsl:with-param name="icon" select="'back.gif'"/>
77       <xsl:with-param name="alt" select="'Parent Directory'"/>
78      </xsl:call-template>
79     </xsl:if>
80     <xsl:apply-templates select="*"/>
81    </table>
82    <hr noshade="yes" align="left" width="80%"/>
83   </body>
84  </html>
85 </xsl:template>
86
87 <xsl:template match="section">
88  <xsl:variable name="diruri">
89   <xsl:value-of select="."/>
90  </xsl:variable>
91  <xsl:call-template name="makeDir">
92   <xsl:with-param name="uri" select="concat($uri,$diruri,'/')"/>
93   <xsl:with-param name="basename" select="$diruri"/>
94   <xsl:with-param name="icon" select="'folder.gif'"/>
95   <xsl:with-param name="alt" select="$uri"/>
96  </xsl:call-template>
97 </xsl:template>
98
99 <xsl:template match="object">
100  <xsl:variable name="name" select="@name"/>
101  <xsl:variable name="ann" select="ann/@value"/>
102  <xsl:variable name="types" select="types/@value"/>
103  <tr>
104   <td>
105    <img border="0" src="{concat($interfaceURL,'/icons/generic.red.gif')}" alt="[{@name}]"/>
106   </td>
107   <td>
108    <a href="" target="{$target}"
109       onClick="this.href=makeURL('{$target}','{concat($uri,$name)}','{$ann}','{$types}')"
110       onMouseOver="window.status='{concat($uri,$name)}'; return true"
111    ><xsl:value-of select="$name"/></a>
112   </td>
113  </tr>
114 </xsl:template>
115
116 </xsl:stylesheet>