Apache2-AutoIndex-XSLT
view release on metacpan or search on metacpan
examples/apache/htdocs/index.xslt view on Meta::CPAN
<td class="sizecol"/>
<td>File Folder</td>
<td/>
<td/>
</tr>
</xsl:for-each>
</xsl:if>
<xsl:apply-templates select="/index/dir">
<xsl:sort select="./attribute::*[name()=$sortnode]" order="{$sortorder}"/>
</xsl:apply-templates>
<xsl:if test="$mycomputer_root != 'true' or /index/@path != '/'">
<xsl:apply-templates select="/index/file">
<xsl:sort select="./attribute::*[name()=$sortnode]" order="{$sortorder}"/>
</xsl:apply-templates>
</xsl:if>
<!--
<tr>
<td height="100%" style="100%;" class="filecol"></td>
<td class="sizecol"></td>
<td></td>
<td></td>
<td></td>
</tr>
-->
</tbody>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="dir">
<xsl:choose>
<xsl:when test="$mycomputer_root = 'true' and /index/@path = '/'">
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="@title = 'A:'">
<xsl:text>3½ Floppy (A:)</xsl:text>
</xsl:when>
<xsl:when test="@title = 'C:'">
<xsl:text>IBM_PRELOAD (C:)</xsl:text>
</xsl:when>
<xsl:when test="@title = 'D:'">
<xsl:text>Data (D:)</xsl:text>
</xsl:when>
<xsl:when test="@title = 'E:'">
<xsl:text>MSOFFICE11 (E:)</xsl:text>
</xsl:when>
<xsl:when test="@title = 'H:'">
<xsl:text>nworthin on 'Anatar' (H:)</xsl:text>
</xsl:when>
<xsl:when test="@title = 'J:'">
<xsl:text>XXX on 'Anatar' (J:)</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@title"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="icon">
<xsl:choose>
<xsl:when test="@title = 'A:' or @title = 'B:'">
<xsl:text>/icons/__floppy_disk_drive.png</xsl:text>
</xsl:when>
<xsl:when test="@title = 'C:' or @title = 'D:'">
<xsl:text>/icons/__hard_disk_drive.png</xsl:text>
</xsl:when>
<xsl:when test="@title = 'E:'">
<xsl:text>/icons/__dvd_drive.png</xsl:text>
</xsl:when>
<xsl:when test="string-length(@title) = 2 and substring(@title,2,1) = ':'">
<xsl:text>/icons/__network_drive.png</xsl:text>
</xsl:when>
<xsl:when test="@title = 'Logitech Webcam'">
<xsl:text>/icons/__webcam.png</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@icon"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="desc">
<xsl:choose>
<xsl:when test="@title = 'A:' or @title = 'B:'">
<xsl:text>3 1/2-Inch Floppy Disk</xsl:text>
</xsl:when>
<xsl:when test="@title = 'C:' or @title = 'D:'">
<xsl:text>Local Disk</xsl:text>
</xsl:when>
<xsl:when test="@title = 'E:'">
<xsl:text>DVD-RW Drive</xsl:text>
</xsl:when>
<xsl:when test="@title = 'Logitech Webcam'">
<xsl:text>Camera</xsl:text>
</xsl:when>
<xsl:when test="string-length(@title) = 2 and substring(@title,2,1) = ':'">
<xsl:text>Network Drive</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@desc"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="nicesize">
<xsl:choose>
<xsl:when test="@title = 'C:'">
<xsl:text>39.2 GB</xsl:text>
</xsl:when>
<xsl:when test="@title = 'D:'">
<xsl:text>142 GB</xsl:text>
</xsl:when>
<xsl:when test="@title = 'E:'">
<xsl:text>401 MB</xsl:text>
</xsl:when>
<xsl:when test="@title = 'H:'">
<xsl:text>1.36 TB</xsl:text>
</xsl:when>
<xsl:when test="@title = 'J:'">
<xsl:text>1.36 TB</xsl:text>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="nicefree">
<xsl:choose>
<xsl:when test="@title = 'C:'">
<xsl:text>8.65 GB</xsl:text>
</xsl:when>
<xsl:when test="@title = 'D:'">
<xsl:text>38.2 GB</xsl:text>
</xsl:when>
<xsl:when test="@title = 'E:'">
<xsl:text>0 B</xsl:text>
</xsl:when>
<xsl:when test="@title = 'H:'">
examples/apache/htdocs/index.xslt view on Meta::CPAN
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<tr>
<td class="filecol">
<a>
<xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute>
<img width="16" height="16">
<xsl:attribute name="src"><xsl:value-of select="$icon"/></xsl:attribute>
<xsl:attribute name="alt">[<xsl:value-of select="@ext"/>]</xsl:attribute>
</img>
</a>
<a onmouseout="window.status='';return true">
<xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute>
<xsl:attribute name="onmouseover">window.status='Free Space: <xsl:value-of select="$nicefree"/> Total Size: <xsl:value-of select="$nicesize"/>'; return true</xsl:attribute>
<xsl:value-of select="$title"/>
<span>Free Space: <xsl:value-of select="$nicefree"/>
<br/>Total Size: <xsl:value-of select="$nicesize"/>
</span>
</a>
</td>
<td>
<xsl:value-of select="$desc"/>
</td>
<td class="sizecol">
<xsl:value-of select="$nicefree"/>
</td>
<td class="sizecol">
<xsl:value-of select="$nicesize"/>
</td>
<td/>
<td/>
</tr>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="@title = 'recyclebin' or @title = 'RecycleBin'">
<xsl:text>Recycle Bin</xsl:text>
</xsl:when>
<xsl:when test="@title = 'documents' or @title = 'Documents' or @title = 'MyDocuments'">
<xsl:text>My Documents</xsl:text>
</xsl:when>
<xsl:when test="@title = 'pictures' or @title = 'Pictures' or @title = 'MyPictures'">
<xsl:text>My Pictures</xsl:text>
</xsl:when>
<xsl:when test="@title = 'videos' or @title = 'Videos' or @title = 'MyVideos'">
<xsl:text>My Videos</xsl:text>
</xsl:when>
<xsl:when test="@title = 'music' or @title = 'Music' or @title = 'MyMusic'">
<xsl:text>My Music</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@title"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="icon">
<xsl:choose>
<xsl:when test="$title = 'Recycle Bin'">
<xsl:text>/icons/__recycle_bin.png</xsl:text>
</xsl:when>
<xsl:when test="$title = 'My Documents'">
<xsl:text>/icons/__my_documents.png</xsl:text>
</xsl:when>
<xsl:when test="$title = 'My Pictures'">
<xsl:text>/icons/__my_pictures.png</xsl:text>
</xsl:when>
<xsl:when test="$title = 'My Videos'">
<xsl:text>/icons/__my_videos.png</xsl:text>
</xsl:when>
<xsl:when test="$title = 'My Music'">
<xsl:text>/icons/__my_music.png</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@icon"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<tr>
<td class="filecol">
<a>
<xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute>
<img width="16" height="16">
<xsl:attribute name="src"><xsl:value-of select="$icon"/></xsl:attribute>
<xsl:attribute name="alt">[<xsl:value-of select="@ext"/>]</xsl:attribute>
</img>
</a>
<a onmouseout="window.status='';return true">
<xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute>
<xsl:attribute name="onmouseover">window.status='Type: <xsl:value-of select="@desc"/> Date Modified: <xsl:value-of select="@nicemtime"/> Size: <xsl:value-of select="@nicesize"/>'; return true</xsl:attribute>
<xsl:value-of select="$title"/>
<span>Type: <xsl:value-of select="@desc"/>
<br/>Date Modified: <xsl:value-of select="@nicemtime"/>
<br/>Size: <xsl:value-of select="@nicesize"/>
</span>
</a>
</td>
<td class="sizecol"></td>
<td>
<xsl:value-of select="@desc"/>
</td>
<td>
<xsl:value-of select="@nicemtime"/>
</td>
<td/>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="file">
<tr>
<td class="filecol">
<a>
<xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute>
<img width="16" height="16">
<xsl:attribute name="src"><xsl:value-of select="@icon"/></xsl:attribute>
<xsl:attribute name="alt">[<xsl:value-of select="@ext"/>]</xsl:attribute>
</img>
</a>
<a onmouseout="window.status='';return true">
<xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute>
<xsl:attribute name="onmouseover">window.status='Type: <xsl:value-of select="@desc"/> Size: <xsl:value-of select="@nicesize"/>'; return true</xsl:attribute>
<xsl:value-of select="@title"/>
<div>Type: <xsl:value-of select="@desc"/>
<br/>Size: <xsl:value-of select="@nicesize"/>
</div>
</a>
</td>
<td class="sizecol">
<xsl:value-of select="@nicesize"/>
</td>
<td>
( run in 0.699 second using v1.01-cache-2.11-cpan-df04353d9ac )