You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by everett stauffer <ev...@chem.ucsd.edu> on 2000/08/05 09:27:03 UTC

How best to process same xml against multiple stylesheets?

Hello-

USING:  JDK 1.3, Xalan 1.1

Situation is that I have an xml file that I want to process
with several stylesheets.  The xml file size can vary from 20kb
to 500kb.  On small documents, performance is quite acceptable;
on the larger documents, painfully slow.  So I'm looking to
optimize as much as I can. 

I'll be using the same stylesheets over and over, so I've got
a collection of StylesheetRoot objects.

I need to set stylesheet parameters, so I'm using a single
XSLTProcessor instance.

I thought I'd try using a Document.  This way I could use:
StylesheetRoot.process(XSLTProcessor,Node,XSLTResultTarget)
and only read in the File once.

However, the docs seem to imply that I'm not necessarily doing
myself a favor because the process involves 'copying' the Node
over into a DTM.  Instead I should just use the 
XSLTInputSource(Reader) to eventually get to the DTM in the
most lightweight way.  The problem I have with both approaches
is that I seem to be forced into doing this _each_ time I want
to process(), whether I'm using the same XSLTInputSource or not.

Is there some reason why the internal representation of
the xmlSource can't be reused for multiple processes?

Seems that what I'd really like to do is something like:
  processor.setInputSource(XSLTInputSource);
  processor.prepareInputSource();
  processor.setOutputTarget(XSLTResultTarget);

  for(EachStylesheet) {
    processor.setStylesheet(StylesheetRoot);
    processor.setStylesheetParam(String, XObject);
    processor.process();
  }

Am I out of luck, or is there a way to accomplish this?


Thanks for any and all help,

Everett Stauffer
Admin Programmer
UCSD Chemistry & Biochemistry