p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   XSLT (http://p2p.wrox.com/forumdisplay.php?f=86)
-   -   process all xml files in folder (http://p2p.wrox.com/showthread.php?t=63615)

lsantos2000 November 8th, 2007 09:59 AM

process all xml files in folder
 
Hi...

Most XSL processors out there take a file as input, is there any processor that would take a folder name and would apply the XSLT and process all files in that folder and also recursively navigate the nested subfolder structure?... or is this something that can be done writing a stylesheet?... if so, a sample would be appreciated, thanks.

Leo



samjudson November 8th, 2007 12:15 PM

XPath 2.0 has a function called 'collection()' but its implementation depends greatly on the particular XSLT processor you are using. Some implementations will return you a collection of files in a directory, but not subdirectories as well.

Depending on which XSLT processor you are using you are probably best to write the code to get the list of XML files in that and call the stylesheet recursively (e.g. if your using a java xslt processor then write some java to get the list of filenames).

/- Sam Judson : Wrox Technical Editor -/

mhkay November 8th, 2007 12:43 PM

Saxon's implementation of collection() does pretty well exactly what you want. See:

http://www.saxonica.com/documentatio...llections.html

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

samjudson November 8th, 2007 01:02 PM

OK, I stand corrected :)

/- Sam Judson : Wrox Technical Editor -/

lsantos2000 November 8th, 2007 01:41 PM

Thanks both for the help, I am using 2.0 and Saxon so I read the notes in the URL above and also found some more info and samples here http://xmlplease.com/collection. Leo



All times are GMT -4. The time now is 06:51 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.