Project

Profile

Help

Transform directory with arbitrary XML files

Added by Anonymous over 16 years ago

Legacy ID: #4497174 Legacy Poster: Dominik Schadow (xml-security)

Hi there, I'm using Ant to generate about 50 HTML from XML files (with the same XSL) - Saxon-B 8.9 for Java. At the moment I'm using this for every XML file: <java fork="true" classname="net.sf.saxon.Transform"> <classpath refid="saxon8.classpath"/> <arg value="-o"/> <arg value="${helpBasics}\sample.html"/> <arg value="${xmlBasics}\sample.xml"/> <arg value="${helpXsl}"/> </java> The name of the XML file determines the name of the HTML file (they should be the same). Is there a possibility to simplify these calls? My idea is to provide the source directory and the target directory and Saxon takes all available XML files and creates the HTML files. Is there any build in function to do that (does Transform accept directories) or do I have to write my own? Thanks for the info Regards, dos


Replies (1)

RE: Transform directory with arbitrary XML fi - Added by Anonymous over 16 years ago

Legacy ID: #4497246 Legacy Poster: Michael Kay (mhkay)

Doing this via 50 invocations from the command line looks very inefficient - with a fork, I think you're loading a new Java VM each time which will dwarf the cost of the transformation. I don't know enough about the Ant xslt task to know whether that will be better, but I would guess so. Saxon does have a command line option to process a whole directory but it's not especially flexible; you could also consider processing all the input in a single transformation by reading the input files using the collection() function.

    (1-1/1)

    Please register to reply