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

From: [] 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 <> wrote:
On 21/02/2008, anand <> 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

This email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
saxon-help mailing list archived at