Generally I think there is very little point reusing the Transformer instance unless you want to retain the document cache across transformations (instead, create a new Transformer from the Templates instance - reusing the Templates object is important). However you can reuse the Transformer if you want, and clear the document cache using a method called (something like) clearDocumentPool().
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of anand
Sent: 21 February 2008 12:10
To: Mailing list for the SAXON XSLT and XQuery processor
Subject: Re: [saxon] Pull data in template transformation

Thanks a lot Andrew, I was reusing the transformer instance.

-- Anand Nalya

On 21/02/2008, Andrew Welch <andrew.j.welch@gmail.com> wrote:
On 21/02/2008, anand <anand.nalya@gmail.com> wrote:
> I'm using XSLT templates with saxon for conversion from xml to xhtml. Apart
> from the main xml document, the stylesheet access some data though xpath
> function 'document()'. The data returned by these uri is generated
> dynamically.
>
> The problem is that for the first transformation the data is right, but the
> transformation performed afterwards also uses the data returned earlier. Can
> I force saxon to pull data every time a transformation takes place using the
> compiled stylesheet?


The document() function is designed to return the same document for
the same URI during the same transform - so if you've based your
process on it behaving differently then your overall process might
need reviewing.

If, however, you are just doing two seperate transforms but reusing
the same Transformer then you just need to recreate the Transformer
for each transform (I think that will be enough, anyway).


--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help