Code example for Templates

Methods: newTransformer

0
 
			Source source = null;
			String uri = pkg.getBaseURI() + path;
			Document doc = pkg.getDom(path);
			source = new DOMSource(doc);
			Transformer transformer = templates.newTransformer();
			transformer.setURIResolver(pkg.getURIResolver());
 
			transformer.setParameter("sourceURL", uri);
			transformer.setParameter("sourceBaseURL", pkg.getBaseURI() + "/");
 
			uri = result.getSystemId();
			if (uri != null) {
				transformer.setParameter("targetURL", uri);
				int i = uri.lastIndexOf('/');
				if (i > 0) {
					uri = uri.substring(0, i + 1);
					transformer.setParameter("targetBaseURL", uri);
				} 
			}