75 lines
2.0 KiB
HTML
75 lines
2.0 KiB
HTML
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||
|
<xsl:template match="/">
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta charset="UTF-8"/>
|
||
|
<link rel="stylesheet" type="text/css" href="/static/autoindex.css"/>
|
||
|
<script src="/static/autoindex.js" defer="defer"></script>
|
||
|
<title>Index of <xsl:value-of select="$path"/></title>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="wrapper">
|
||
|
<div class="inner">
|
||
|
<h1 id="dirname">Index of <xsl:value-of select="$path"/></h1>
|
||
|
<table>
|
||
|
<tr>
|
||
|
<th>Name</th>
|
||
|
<th>Size</th>
|
||
|
<th>Time</th>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td><a href="..">..</a></td>
|
||
|
<td></td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
<xsl:for-each select="list/file | list/directory">
|
||
|
<tr>
|
||
|
<td>
|
||
|
<a href="">
|
||
|
<xsl:attribute name="href">
|
||
|
<xsl:value-of select="."/>
|
||
|
</xsl:attribute>
|
||
|
<xsl:choose>
|
||
|
<xsl:when test="@size">
|
||
|
<xsl:value-of select="."/>
|
||
|
</xsl:when>
|
||
|
<xsl:otherwise>
|
||
|
<xsl:value-of select="."/>/
|
||
|
</xsl:otherwise>
|
||
|
</xsl:choose>
|
||
|
</a>
|
||
|
</td>
|
||
|
<td>
|
||
|
<xsl:choose>
|
||
|
<xsl:when test="@size > 1099511627776">
|
||
|
<xsl:value-of select="round(@size * 10 div 1099511627776) div 10"/> TiB
|
||
|
</xsl:when>
|
||
|
<xsl:when test="@size > 1073741824">
|
||
|
<xsl:value-of select="round(@size * 10 div 1073741824) div 10"/> GiB
|
||
|
</xsl:when>
|
||
|
<xsl:when test="@size > 1048576">
|
||
|
<xsl:value-of select="round(@size * 10 div 1048576) div 10"/> MiB
|
||
|
</xsl:when>
|
||
|
<xsl:when test="@size > 1024">
|
||
|
<xsl:value-of select="round(@size * 10 div 1024) div 10"/> KiB
|
||
|
</xsl:when>
|
||
|
<xsl:when test="@size">
|
||
|
<xsl:value-of select="@size"/> B
|
||
|
</xsl:when>
|
||
|
<xsl:otherwise>
|
||
|
-
|
||
|
</xsl:otherwise>
|
||
|
</xsl:choose>
|
||
|
</td>
|
||
|
<td class="timestamp">
|
||
|
<xsl:value-of select="@mtime"/>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</xsl:for-each>
|
||
|
</table>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html></xsl:template>
|
||
|
</xsl:stylesheet>
|