You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Robert van Loenhout <r....@greenvalley.nl> on 2004/05/28 11:50:52 UTC

URIResolver

Hi!

I am using local xsl files to transform xml documents into html.
I wanted to cache those xsl files, because they are
used often in my application and usually stay the same.
The xsl files also use xsl:import.

I looked in the API documentation and found the setURIResolver method for
TransformerFactory and Transformer classes. So I made my own URIResolver and
used them in the setURIResolver.

  URI xsl = new File(xslFile).toURI();
  Transformer transformer = tFactory.newTransformer(new StreamSource(xsl.toString()));
  CachingURIResolver resolver = new CachingURIResolver();
  tFactory.setURIResolver(resolver);
  transformer.setURIResolver(resolver);
  ...
  transformer.transform(...

Unfortunately the resolve method of my CachingURIResolver is never called!
The transformation is done normally.

I am using Xerces-j_2_6_2 and Xalan-j_2_6_0.

How can I get this to work correctly? Or is there an easier way to accomplish my goals?

Thanks for any help.
Robert.