- From: Sean Owen <srowen@google.com>
- Date: Tue, 5 Jun 2007 12:37:53 -0400
- To: "Miguel Garcia" <miguel.garcia@fundacionctic.org>
- Cc: public-mobileok-checker@w3.org
Wow, much better! I didn't know about this. If it works, feel free to commit. On 6/5/07, Miguel Garcia <miguel.garcia@fundacionctic.org> wrote: > Hi, > > We have found out that TransformerFactory class has an URIResolver > handler. This handler returns a Source object to a resource specified by > a href and a base. > > With this handler and Java ClassLoader we could import xsl from jar > files. > We prefer to attach the source code before commit such changes to allow > some discussion about this solution. > > Also I highlight some of the code to give and idea: > > final TransformerFactory factory =TransformerFactory.newInstance(); > factory.setURIResolver( new XSLTURIResolver() ); > > final Transformer transformer=factory.newTransformer(new > StreamSource(xslStream)); > > transformer.transform(new DOMSource(results.getMokiDocument()), > domResult); > return runTest(domResult.getNode()); > > and our URIResolver implementation: > > private static class XSLTURIResolver implements URIResolver { > > public Source resolve(String href, String base) { > //if (href.contains("xsl")) { > return new > StreamSource((InputStream)this.getClass().getClassLoader().getResourceAs > Stream("org/w3c/mwi/mobileok/basic/xslt/"+href)); > //} > } > } > > > Regards > >
Received on Tuesday, 5 June 2007 16:38:01 UTC