Apache2-AutoIndex-XSLT
view release on metacpan or search on metacpan
examples/apache/htdocs/index.xslt view on Meta::CPAN
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output encoding="iso-8859-1" method="html" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>
<xsl:variable name="mycomputer_root" select="'true'"/>
<xsl:variable name="sortorder_href">
<xsl:choose>
<xsl:when test="/index/options/option[@name='O']/@value = 'D'"><xsl:text>A</xsl:text></xsl:when>
<xsl:otherwise><xsl:text>D</xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="sortorder">
<xsl:choose>
<xsl:when test="/index/options/option[@name='O']/@value = 'D'"><xsl:text>descending</xsl:text></xsl:when>
<xsl:otherwise><xsl:text>ascending</xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="sortnode">
<xsl:choose>
<xsl:when test="/index/options/option[@name='C']/@value = 'S'"><xsl:text>size</xsl:text></xsl:when>
<xsl:when test="/index/options/option[@name='C']/@value = 'D'"><xsl:text>desc</xsl:text></xsl:when>
<xsl:when test="/index/options/option[@name='C']/@value = 'M'"><xsl:text>mtime</xsl:text></xsl:when>
<xsl:otherwise><xsl:text>title</xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:template match="/">
<html xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" xsl:version="2.0">
<head>
<title>
<xsl:choose>
<xsl:when test="/index/@path='/'">My Computer</xsl:when>
<xsl:when test="/index/@path='/Logitech Webcam/'">My Computer: [Logitech Webcam]</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring(/index/@path,2)"/>
</xsl:otherwise>
</xsl:choose>
</title>
<meta name="robots" content="noarchive,nosnippet"/>
<meta name="googlebot" content="noarchive,nosnippet"/>
<meta name="author" content="Nicola Worthington, nicolaw@cpan.org"/>
<link rel="icon" href="/favicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
<base>
<xsl:attribute name="href"><xsl:value-of select="/index/@href"/></xsl:attribute>
</base>
<script type="text/javascript">
// <![CDATA[
function toggle(element) {
if (element.style.display == 'none') {
element.style.display = 'block';
} else {
element.style.display = 'none';
}
}
// ]]></script>
<style type="text/css">
// <![CDATA[
body {
background-color: #ffffff;
margin: 0px 0px 0px 0px;
}
table.dhIndex {
font-family: Tahoma, sans-serif;
font-size: 8pt;
white-space: nowrap;
height: 100%;
}
table.dhIndex th {
white-space: nowrap;
}
table.dhIndex td {
white-space: nowrap;
background: #ffffff;
padding-left: 4px;
padding-right: 4px;
padding-bottom: 1px;
}
table.dhIndex td, table.dhIndex div.inUp, table.dhIndex div.inDown {
font-weight: normal;
font-family: Tahoma, sans-serif;
font-size: 8pt;
text-align: left;
}
table.dhIndex td.filecol {
background: #F7F7F7;
}
table.dhIndex th.sizecol, table.dhIndex td.sizecol {
text-align: right;
}
table.dhIndex img {
margin-right: 2px;
vertical-align: bottom;
border: 0px;
width: 16px;
height: 16px;
}
table.dhIndex a {
position: relative;
}
table.dhIndex tbody a span, table.dhIndex tbody a div {
display: none;
}
table.dhIndex a, table.dhIndex a:visited {
color: #000000;
text-decoration: none;
white-space: nowrap;
}
table.dhIndex td a:hover {
text-decoration: underline;
}
table.dhIndex tbody td a:hover span {
background: #ffffe1;
border: 1px #000000 solid;
padding: 7px 7px 7px 7px;
position: absolute;
top: 7px;
left: 30px;
width: 210px;
filter:alpha(opacity=50);
display: block;
z-index: 1;
-moz-opacity:0.5;
opacity: 0.5;
}
table.dhIndex tbody td a:hover div {
background: #ffffe1;
border: 1px #000000 solid;
padding: 7px 7px 7px 7px;
position: absolute;
top: 7px;
left: 30px;
display: block;
z-index: 1;
}
table.dhIndex img.denied {
filter:alpha(opacity=50);
-moz-opacity:0.5;
opacity: 0.5;
}
table.dhIndex div.outDown {
height: 15px;
border: 1px #848284 solid;
}
table.dhIndex div.inDown {
height: 13px;
padding-left: 4px;
padding-right: 4px;
color: #000000;
background: #D6D3CE;
border: 1px #D6D3CE solid;
}
table.dhIndex div.outUp {
height: 15px;
border-bottom: 1px #424142 solid;
border-right: 1px #424142 solid;
border-left: 1px #ffffff solid;
border-top: 1px #ffffff solid;
}
table.dhIndex div.inUp {
height: 13px;
padding-left: 4px;
padding-right: 4px;
color: #000000;
background: #D6D3CE;
border-bottom: 1px #848284 solid;
border-right: 1px #848284 solid;
border-left: 1px #D6D3CE solid;
border-top: 1px #D6D3CE solid;
}
// ]]></style>
</head>
<body style="margin: 0px 0px 0px 0px;">
<table cellspacing="0" cellpadding="0" border="0" width="100%" height="100%" class="dhIndex" id="unique_id" summary="Directory listing">
<thead>
<tr>
<xsl:choose>
<xsl:when test="$mycomputer_root = 'true' and /index/@path = '/'">
<th scope="col" width="180" abbr="Name">
<a href="?C=N;O=A">
<div class="outUp">
<div class="inUp">Name</div>
</div>
</a>
</th>
<th scope="col" width="150" abbr="Type">
<a href="?C=D;O=A">
<div class="outUp">
<div class="inUp">Type</div>
</div>
</a>
</th>
<th scope="col" width="100" abbr="Free Space">
<a href="?C=S;O=A">
<div class="outUp">
<div class="inUp" style="text-align: right;">Free Space</div>
</div>
</a>
</th>
<th scope="col" width="100" abbr="Total Size">
<a href="?C=S;O=A">
<div class="outUp">
<div class="inUp" style="text-align: right;">Total Size</div>
</div>
</a>
</th>
<th scope="col" width="120" abbr="Comments">
<a href="?C=C;O=A">
<div class="outUp">
<div class="inUp">Comments</div>
</div>
</a>
</th>
<th scope="col">
<div class="outUp">
<div class="inUp"/>
</div>
</th>
</xsl:when>
<xsl:otherwise>
<th scope="col" width="200" abbr="Name">
<a href="?C=N;O=A">
<div class="outUp">
<div class="inUp">Name</div>
</div>
( run in 1.798 second using v1.01-cache-2.11-cpan-d8267643d1d )