Most people want an XSLT processor like Saxon to use multiple input files. It's often a problem to convert an XML file from one directory to HTML. You can use Saxon for each of these files, but what if you finally want to generate a file that contains all the HTML files ' indexes?
What you need is an XML version of the catalog list. This enables you to use the XML file as the unique input file for XSLT and to process each file with XSLT. It would be perfect if XSLT was able to do directory processing directly. Unfortunately, although XSLT is powerful, especially XSLT 2.0, there is no directory operation for this language.
Hxdlg to help!
While surfing the web, I found an obscure little Java program from SourceForge, Html/xml Directory List Generator (see Resources). One of the features of Hxdlg is to create an HTML or XML representation of a directory listing. I downloaded the tool and ran the statement shown in Listing 1 from the command line.
Listing 1. To create the code for an XML catalog using Hxdlg
java -jar hdlg.jar XML
/Users/jherr/Projects/ibm_xml_tips/filelist/testfiles/
/Users/jherr/Projects/ibm_xml_tips/filelist/files.xml
This program has three parameters. The first parameter is the output type, XML or HTML. The second is the directory path, and the third is the path to the output XML file. The results are shown in Listing 2.
Listing 2. XML-Formatted Directory
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hdlg:filesystem SYSTEM
"http://www.hdlg.info/XML/filesystem.dtd">
xmlns:hdlg="http://www.hdlg.info/XML/filesystem">
url="file:/Users/jherr/Projects/ibm_xml_tips/filelist/testfiles/">
type="unknown"
url="file:/ibm_xml_tips/filelist/testfiles/test1.xml">
type="unknown"
url="file:/ibm_xml_tips/filelist/testfiles/test2.xml">
type="unknown"
url="file:/ibm_xml_tips/filelist/testfiles/test3.xml">