xsl-list
[Top] [All Lists]

RE: Multiple file XSL conversion

2005-06-28 13:00:51
If the transformations are independent of each other, then it's best to
invoke the stylesheet once for each document, rather than doing it all in a
single transformation, because the XSLT processor is otherwise likely to try
and hold all the documents in memory.

So you need some kind of application program to invoke the transformation.
You haven't explained what environment you're using: in Java, you would use
the JAXP API to compile the stylesheet once into a Templates object, and
then go into a loop:

for (int i=0; i<files.length; i++) {
  transformer = templates.newTransformer();
  transformer.transform(new StreamSource(files[i]), new StreamResult(....));
}

If it's a one-off job you could do it from shellscript, but that would be
much less efficient.

I've just remembered that on Saturday in Prague I heard Petr Pajas
describing his XML Editing Shell XSH, which looks like a good tool for this
kind of job - I haven't tried it though. See http://xsh.sf.net/ It's fairly
heavily Perl-based so you'll probably like it most if you're already a Perl
user.

Michael Kay
http://www.saxonica.com/


-----Original Message-----
From: Andrew Borsz [mailto:andrew(_at_)vitalsource(_dot_)com] 
Sent: 28 June 2005 20:53
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Multiple file XSL conversion

Hello,
I'm trying to figure out a good way to convert multiple XML files at 
the same time. Does anyone know the best way to take hundreds XML 
documents and transform them all with the same XSL stylesheet 
in one or 
two steps?

Any advice would be appreciated.

Thanks,

Andrew Borsz


--~------------------------------------------------------------------
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>
--~--





--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>