Subject: Re: [xsl] Processing mutiple files in multiple directories individually From: Andrew Welch <andrew.j.welch@xxxxxxxxx> Date: Fri, 18 Mar 2011 08:22:56 +0000 |
On 18 March 2011 00:00, Mark <mark@xxxxxxxxxxxx> 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Processing mutiple files , Dan Vint | Thread | Re: [xsl] Processing mutiple files , Philip Fearon |
Re: [xsl] Processing mutiple files , Dan Vint | Date | [xsl] Why namespace-alias result pr, Karl Stubsjoen |
Month |