+ _factory = TransformerFactory.newInstance();
+ }
+
+ /**
+ * Resolves an XSLT based on URI.
+ * @param aXslt XSLT to resolve,
+ * @return Source for the XSLT
+ * @throws TransformerException In case the XSLT cannot be found.
+ */
+ public Source resolve(String aXslt) throws TransformerException {
+ URIResolver resolver = _factory.getURIResolver();
+ if (resolver == null) {
+ if (new File(aXslt).canRead()) {
+ try {
+ return new StreamSource(new FileResource(new File(aXslt))
+ .getInputStream());
+ } catch (IOException e) {
+ throw new TransformerException(e.getMessage(), e);
+ }
+ }
+ }
+ return resolver.resolve(aXslt, "");