Apache2::AutoIndex::XSLT - XSLT Based Directory Listings
PerlLoadModule Apache2::AutoIndex::XSLT <Location /> SetHandler perl-script PerlResponseHandler Apache2::AutoIndex::XSLT Options +Indexes IndexStyleSheet /index.xslt DefaultIcon /icons/__unknown.png IndexIgnore .* IndexIgnore index.xslt IndexIgnore robots.txt IndexIgnore sitemap.gz </Location>
This module is designed as a drop in mod_perl2 replacement for the mod_dir and mod_index modules. It uses user configurable XSLT stylesheets to generate the directory listings.
THIS CODE IS INCOMPLETE -- THIS IS A DEVELOPMENT RELEASE!
This module attempts to emulate as much as the functionality from the Apache mod_dir and mod_index modules as possible. Some of this is performed directly by the Apache::AutoIndex::XSLT module itself, and some through a combination of the options elements presented in the output XML and the XSLT stylesheet. As a result, some of these configuration directives will do little or nothing at all if the XSLT stylesheet used does not use them.
SetEnvIf Remote_Addr . RenderXSLT=On BrowserMatch "Firefox/(2.0|1.5|1.0.)" !RenderXSLT BrowserMatch "MSIE .0" !RenderXSLT BrowserMatch "Netscape/8" !RenderXSLT BrowserMatch "Opera/9" !RenderXSLT RenderXSLTEnvVar RenderXSLT
AddAlt "PDF file" *.pdf AddAlt Compressed *.gz *.zip *.Z
AddAlt provides the alternate text to display for a file, instead of an icon. File is a file extension, partial filename, wild-card expression or full filename for files to describe. If String contains any whitespace, you have to enclose it in quotes (" or '). This alternate text is displayed if the client is image-incapable, has image loading disabled, or fails to retrieve the icon.
AddAltByEncoding gzip x-gzip
AddAltByEncoding provides the alternate text to display for a file, instead of an icon. MIME-encoding is a valid content-encoding, such as x-compress. If String contains any whitespace, you have to enclose it in quotes (" or '). This alternate text is displayed if the client is image-incapable, has image loading disabled, or fails to retrieve the icon.
AddAltByType 'plain text' text/plain
AddAltByType sets the alternate text to display for a file, instead of an icon. MIME-type is a valid content-type, such as text/html. If String contains any whitespace, you have to enclose it in quotes (" or '). This alternate text is displayed if the client is image-incapable, has image loading disabled, or fails to retrieve the icon.
AddDescription "The planet Mars" /web/pics/mars.png
This sets the description to display for a file. File is a file extension, partial filename, wild-card expression or full filename for files to describe. String is enclosed in double quotes (").
AddIcon (IMG,/icons/image.xbm) .gif .jpg .xbm AddIcon /icons/dir.xbm ^^DIRECTORY^^ AddIcon /icons/backup.xbm *~
This sets the icon to display next to a file ending in name. Icon is either a (%-escaped) relative URL to the icon, or of the format (alttext,url) where alttext is the text tag given for an icon for non-graphical browsers.
Name is either ^^DIRECTORY^^ for directories, ^^BLANKICON^^ for blank lines (to format the list correctly), a file extension, a wildcard expression, a partial filename or a complete filename.
AddIconByType should be used in preference to AddIcon, when possible.
AddIconByEncoding /icons/compress.xbm x-compress
This sets the icon to display next to files. Icon is either a (%-escaped) relative URL to the icon, or of the format (alttext,url) where alttext is the text tag given for an icon for non-graphical browsers.
MIME-encoding is a wildcard expression matching required the content-encoding.
AddIconByType (IMG,/icons/image.xbm) image/*
This sets the icon to display next to files of type MIME-type. Icon is either a (%-escaped) relative URL to the icon, or of the format (alttext,url) where alttext is the text tag given for an icon for non-graphical browsers.
MIME-type is a wildcard expression matching required the mime types.
The DefaultIcon directive sets the icon to display for files when no specific icon is known. Url-path is a (%-escaped) relative URL to the icon.
IndexIgnore README .htindex *.bak *~
The IndexIgnore directive adds to the list of files to hide when listing a directory. File is a shell-style wildcard expression or full filename. Multiple IndexIgnore directives add to the list, rather than the replacing the list of ignored files. By default, the list contains . (the current directory).
IndexOptions +DescriptionWidth=* +FancyIndexing +FoldersFirst +HTMLTable IndexOptions +IconsAreLinks +IconHeight=16 +IconWidth=16 +IgnoreCase IndexOptions +IgnoreClient +NameWidth=* +ScanHTMLTitles +ShowForbidden IndexOptions +SuppressColumnSorting +SuppressDescription IndexOptions +SuppressHTMLPreamble +SuppressIcon +SuppressLastModified IndexOptions +SuppressRules +SuppressSize +TrackModified +VersionSort IndexOptions +XHTML
The IndexOptions directive specifies the behavior of the directory indexing.
IndexOrderDefault Ascending Name
The IndexOrderDefault directive is used in combination with the FancyIndexing index option. By default, fancyindexed directory listings are displayed in ascending order by filename; the IndexOrderDefault allows you to change this initial display order.
IndexOrderDefault takes two arguments. The first must be either Ascending or Descending, indicating the direction of the sort. The second argument must be one of the keywords Name, Date, Size, or Description, and identifies the primary key. The secondary key is always the ascending filename.
You can force a directory listing to only be displayed in a particular order by combining this directive with the SuppressColumnSorting index option; this will prevent the client from requesting the directory listing in a different order.
The IndexStyleSheet directive sets the name of the file that will be used as the CSS for the index listing.
The ReadmeName directive sets the name of the file that will be appended to the end of the index listing. Filename is the name of the file to include, and is taken to be relative to the location being indexed. If Filename begins with a slash, it will be taken to be relative to the DocumentRoot.
DirectoryIndex index.html index.shtml
The DirectoryIndex directive sets the list of resources to look for, when the client requests an index of the directory by specifying a / at the end of the directory name. Local-url is the (%-encoded) URL of a document on the server relative to the requested directory; it is usually the name of a file in the directory. Several URLs may be given, in which case the server will return the first one that it finds. If none of the resources exist and the Indexes option is set, the server will generate its own listing of the directory.
The DirectorySlash directive determines, whether or not to fixup URLs pointing to a directory or not. With this enabled (which is the default), if a user requests a resource without a trailing slash, which points to a directory, the user will be redirected to the same resource, but with trailing slash.
The XSLT stylesheet will default to index.xslt in the DocumentRoot of the website. This can be changed using the IndexStyleSheet directive.
An example index.xslt file is bundled with this module in the examples/ directory.
$Id: XSLT.pm 1077 2007-12-14 17:44:32Z nicolaw $
Nicola Worthington <firstname.lastname@example.org>, TFB Technology Ltd.
If you like this software, why not show your appreciation by sending the author something nice from her Amazon wishlist? ( http://www.amazon.co.uk/gp/registry/1VZXC59ESWYK0?sort=priority )
With special thanks to Jennifer Beattie for helping develop the example XSLT stylesheets, and writing the examples/RegFileTypes.cs "registered file type" data and icons extraction program for Windows.
With special thanks to the authors of http://httpd.apache.org/docs/2.2/mod/mod_autoindex.html from which some documentation taken.
Copyright 2006, 2007 Nicola Worthington.
This software is licensed under The Apache Software License, Version 2.0.