summaryrefslogtreecommitdiffhomepage
path: root/nginx/layout/simple.xslt
diff options
context:
space:
mode:
Diffstat (limited to 'nginx/layout/simple.xslt')
-rw-r--r--nginx/layout/simple.xslt51
1 files changed, 51 insertions, 0 deletions
diff --git a/nginx/layout/simple.xslt b/nginx/layout/simple.xslt
new file mode 100644
index 0000000..9cc5ad6
--- /dev/null
+++ b/nginx/layout/simple.xslt
@@ -0,0 +1,51 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3 <xsl:template match="/">
4 <html>
5 <body style="margin: 0 auto; max-width: 900px; width: fit-content;">
6
7 <h3><xsl:value-of select="name(//directory)"/></h3>
8
9 <table border="0">
10 <tr bgcolor="#7DAFFF">
11 <th>Name</th>
12 <th style="padding-inline: 2em;">Size</th>
13 <th>Date</th>
14 </tr>
15 <xsl:for-each select="list/*">
16 <xsl:sort select="mtime" />
17
18 <xsl:variable name="name">
19 <xsl:value-of select="."/>
20 </xsl:variable>
21
22 <xsl:variable name="size">
23 <xsl:if test="string-length(@size) &gt; 0">
24 <xsl:if test="number(@size) &gt; 0">
25 <xsl:choose>
26 <xsl:when test="round(@size div 1024) &lt; 1"><xsl:value-of select="@size" /></xsl:when>
27 <xsl:when test="round(@size div 1048576) &lt; 1"><xsl:value-of select="format-number((@size div 1024), '0.0')" />K</xsl:when>
28 <xsl:otherwise><xsl:value-of select="format-number((@size div 1048576), '0.00')" /> MB</xsl:otherwise>
29 </xsl:choose>
30 </xsl:if>
31 </xsl:if>
32 </xsl:variable>
33
34 <xsl:variable name="date">
35 <xsl:value-of select="substring(@mtime,6,2)"/>/<xsl:value-of select="substring(@mtime,9,2)"/><xsl:text> </xsl:text>
36 <xsl:value-of select="substring(@mtime,12,2)"/>:<xsl:value-of select="substring(@mtime,15,2)"/>:<xsl:value-of select="substring(@mtime,18,2)"/><xsl:text> </xsl:text>
37 <xsl:value-of select="substring(@mtime,1,4)"/>
38 </xsl:variable>
39
40 <tr>
41 <td><a href="{$name}"><xsl:value-of select="."/></a></td>
42 <td align="right" style="padding-right: 2em;"><xsl:value-of select="$size"/></td>
43 <td><xsl:value-of select="$date"/></td>
44 </tr>
45
46 </xsl:for-each>
47 </table>
48 </body>
49 </html>
50 </xsl:template>
51</xsl:stylesheet>