MindlessCode.net: XSL Template for Luau
Autopackage uses Luau XML files for figuring out what package to download to satisfy a dependency. These luau XML files include release dates, release notes, download location for packages, version, interface version, etc.
I noticed that some people were linking to a directory listing of the abcm2ps Autopackage for downloads. This directory was a mess with three files (.package, .meta, and .payload) for each release. Since the XML file already includes all vital information about each release, I decided that instead of manually maintaining a download page I would just format the XML file instead. At first I played around with PHP's XML parsing functions. I never really could get the hang of them and finally decided to learn XSL. It was much simpler, and is appears to work great!
So, like where can I get it?
There are (at least) three ways to actually use this style sheet. One is to edit the XML file and add this line just below the opening <?xml> tag:
<?xml-stylesheet type="text/xsl" href="../luau.xsl"?>
Then make this file displayed when ever someone accesses the directory (I'm not sure how to do this, but either some PHP or .htaccess magic would work--please let me know if you have a solution). Now visitors with Gecko or Internet Explorer will see the formatted XML when they view the XML file. The downside of this is that people who user browsers other than something that uses Gecko or IE will just see an ugly XML file.
Another option is to use a XSLT processor, such as xsltproc. After you edit the XML file as above, run this command:
$ xsltproc abcm2ps.xml > index.html
And then put this file into the direcotory with the XML file. Quick and easy! Just remember to rerun the command every time you change the XML file.
The third option is to use PHP to generate the HTML.
/* Note, untested code! */
$processor = xslt_create();
$result = xslt_process($processor, 'abcm2ps.xml', '../luau.xsl');
if (!$result) echo xslt_error($processor);