Scott:

This is good news. So with latest version of Xalan, I could reuse the
"transformer" object as opposed to underlying "templates". Need to test this
out.

Also, do we need to update the
http://xml.apache.org/xalan-j/usagepatterns.html#multithreading ??

--Naren




-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, March 08, 2002 5:43 AM
To: Christopher Giblin
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Reuse of transformers



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








Reply via email to