Re: [xsl] how do java xsl processors handle xsl:import?

Subject: Re: [xsl] how do java xsl processors handle xsl:import?
From: Frédéric Laurent <fl@xxxxxxxxxxxxx>
Date: Mon, 1 Dec 2003 16:08:18 +0100

Robert Koberg wrote:

> Hi,
> How do xsl processors handle xsl:import with regard to (don't really 
> know how to say this) storing xsl:templates in a 
> javax.xml.transform.Templates object?
> For sake of example, say I want to xsl:import files that contain 100 
> xsl:templates. The *importing* file overrides all 100 xsl:templates with 
> new ones. [I want to cache the javax.xml.transform.Templates object in 
> memory for a webapp]. Will the Templates object contain 200 
> xsl:templates or does it discard the overriden ones?

Take a look at the setURIResolver[1] method on the TransformerFactory 
These method is called by the XSLT processor when an xsl:import
function in your XSLT is found.
Then, If you write your own URIResolver [2], you can load your xsl file in 
cache and give it to the XSLT Processor...

TransformerFactory factory = TransformerFactory.newInstance();
factory.setURIResolver(new MyResolver(...));

class MyResolver implements URIResolver {
  public Source resolve(String href,String base) {
	// manage your cache and return a Source to the Processor




XPath free testing software :
Frédéric Laurent           

 XSL-List info and archive:

Current Thread