saxonica.com

Writing a URI Resolver for Output Files

Saxon also allows you to write an OutputURIResolver, which performs an analogous role for URIs specified in the href attribute of xsl:result-document. This is therefore applicable to XSLT only. The OutputURIResolver is called when writing of the output document starts, at which point it must return a JAXP Result object to act as the output destination. It is called again when writing of an output document is complete.

You can nominate an OutputURIResolver by calling ((Controller)transformer).setOutputURIResolver(new UserOutputResolver()), or by calling factory.setAttribute("http://saxon.sf.net/feature/outputURIResolver", new UserOutputResolver()).