[Home] [By Thread] [By Date] [Recent Entries]
Liam, Dan, Andrew, and Philip,
I will look at both avenues. Thanks for the leads - I was unaware of these technologies. Mark -----Original Message----- From: Philip Fearon Sent: Friday, March 18, 2011 1:54 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: Processing mutiple files in multiple directories individually You're right that this is a common use case, XSLT itself can't do an in-place update, but there are XSLT tools with this capability built in. CoherentWeb[1] addresses both the problem of ignoring certain XML files (and all non-XML files) and performing the equivalent of a 'replace' operation on a directory structure, but in a safe way. In CoherentWeb, there would be 3 main steps: 1. Write an XSLT identity transform that will both: a: raise an error when the file is identified by an XPath rule as one that does not need processing and b: modify the parts of a targeted file as required 2. Drag and drop the input directory and XSLT files onto the CoherentWeb Input and XSLT lists respectively. 3. From the Control Panel, check the 'Auto-Export' option and then press 'Run' The XSLT processor will perform, as a multi-threaded batch job, a transform on all XML files (ignoring non-XML files automatically) found in the input directory and sub-directories. It then creates a deep-copy of your input directory, with the only difference being the original files that were transformed without error are replaced with the new modified versions. As Andrew and Liam describe, replacing files in-place has one main disadvantage, its not reversible. CoherentWeb overcomes this because the 'replace' operation only works on a copy of the original directory, you can repeat this operation therefore as often as needed. Also, any ZIP files encountered can (as an option) be treated by CoherentWeb as ordinary directories, allowing you to modify XML within ZIP-archives (though the included EXPath ZIP Module[2] implementation provides much greater flexibility in this respect). An XML report summarises all the files in the directory that were modified, but you can see this at a glance from file icons in the CoherentWeb file-list that provides a flattened view of all the files in the input directory.
Phil Fearon http://qutoric.com On Fri, Mar 18, 2011 at 12:00 AM, Mark <mark@xxxxxxxxxxxx> wrote: I am using XSLT 2.0.
|

Cart



