The statement about not reusing them sequentially is incorrect. When a
given transformation finishes it calls a reset() method on itself. This is
supposed to be highly tested, and should work OK. There were some bugs
fixed with resetting of parameters in the case in the last released
version.
-scott
"Christopher
Giblin" To: [EMAIL PROTECTED]
<[EMAIL PROTECTED] cc: [EMAIL PROTECTED],
(bcc: Scott Boag/Cambridge/IBM)
om> Subject: Reuse of transformers
03/08/2002 03:42
AM
Hi
The JAXP spec suggests to me that Transformers can be reused at will,
threading considerations aside.
Xalan trax examples even demonstrate this.
Yet the Xalan "Usage Patterns" page, under the title "Multithreading",
states:
"A Transformer ... is a lightweight object that tracks state information
during the transformation, and should only be used to perform a single
transformation. If you want to perform multiple transformations
(sequentially or concurrently) with the same stylesheet instructions, do
the following: ...
2. ..For each transformation, use the Templates object newTransformer()
method to create a Transformer, and use that Transformer's transform(Source
xmlSource, Result transformResult) method to perform the transformation."
Multithreading is not a consideration for me but performance is very much
so. I am tweeking and need to apply the same transformation possibly
hundreds of times. If I can reuse the same transformer, great. I am now
skeptical due to the above statements, however.
Is Xalan recommending a "Best Practice" by endorsing new Transform instance
for each transformation? Or did I misread the JAXP spec?
Thanks, chris