|
Helping ordinary people create extraordinary websites! |
Tip: Batch Processing XML with XSLT 2.0By Jack Herrington2005-05-04
Use Directory Listings in XML to Drive XSLT 2.0 Processing A common problem with XSLT is that it takes only a single XML file as input. You can use a cross-platform Java™ tool to create an XML directory listing, then use XSLT to process every file in the directory from that listing. This tip covers installation and use of such a tool, as well as the corresponding XSL that processes multiple files from the directory listing. Don't you wish that XSLT processors like Saxon could use more than one file as input? Often, you're faced with a directory of XML files that require conversion into HTML. You could run Saxon on each of them, but what if you want another file at the end that has an index to all the HTML files you've created? What you need is an XML version of the directory listing. Then, you could use that XML file as the single input file to XSLT and process each file using XSLT. It would be wonderful if you could do the directory processing in XSLT directly. Unfortunately, with all the power of XSLT -- and particularly XSLT 2.0 -- the language still doesn't have directory operations. Tutorial Pages: » Use Directory Listings in XML to Drive XSLT 2.0 Processing » HXDLG to the Rescue! » Test It Out » Summary » Resources First published by IBM DeveloperWorks |
|