xsl-list
[Top] [All Lists]

Re: [xsl] Processing mutiple files in multiple directories individually

2011-03-18 03:23:08
On 18 March 2011 00:00, Mark <mark(_at_)knihtisk(_dot_)org> wrote:
I am using XSLT 2.0.

I have several hundred XML data files stored in a number of directories each
with subdirectories of their own that descend to various levels. From them,
I need to locate 137 specific files and make editing changes to each. I
believe I can write the template that can determine if a specific XML file
requires editing or not, and if so to then apply the editing change.

What I do not know how to do is:

(1) search through all the directories and subdirectories and open each XML
file one at a time,

(2) if the file does not require editing, drop it and move on to the next
file; or

(3) if the file requires editing, make the editing change and write the file
out to its original location.

As Danny has said, have a look at Kernow's 'directory transform',
which will apply a stylesheet to all files in a directory structure
(for a given extension) and then recreate that structure at the output
path.

For #2 above, for each file that doesn't require editing, you will
need to just copy the entire input to the output (identity transform).

For #3, with xslt you can't modify a file in place, you will need to
transform the files to a new location, then copy them over to the old
location when you are happy (either manually or some other process).
This is a good thing for tasks like this, as you dont want to blow
away your input until you're completely happy with the output.

http://kernowforsaxon.sf.net/


-- 
Andrew Welch
http://andrewjwelch.com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--