>From what I am seeing, you can specify the custom resolver within the header {code} .setHeader("CamelXsltResourceUri",simple("xslt:http://localhost:8080/<path>/<to>/<template>?*uriResolver=#myResolver*") {/code}
and it gets exercises at run time. When I place break points within my resolver and execute this route, it will step through the code. Claus Ibsen-2 wrote > The CamelXsltResourceUri header is *only* for the location of the xls > file. Any other options like a custom resolver must be set on the > endpoint / component level. > > On Tue, Aug 6, 2013 at 8:39 PM, ericsodt < > dean.ericson@.mit > > wrote: >> Claus, >> >> The question I am asking is not one that can be resolved by the FAQ you >> pointed to. I notice this question gets posted a lot and no one seems to >> be >> fully answering it. Here's my go at it: >> >> The Camel xslt docs mention "Dynamic Stylesheets" by saying the >> following: >> /*Available as of Camel 2.9* >> Camel provides the CamelXsltResourceUri header which you can use to >> define a >> stylesheet to use instead of what is configured on the endpoint URI. This >> allows you to provide a dynamic stylesheet at runtime./ >> >> I wish they could have supported their documentation better and provided >> an >> example. Hopefully the example below will help others. >> >> {code} >> // register myResolver bean >> SimpleRegistry sr = new SimpleRegistry(); >> sr.put("myResolver", new MyResolver()); >> >> from("direct:location") >> .setHeader("CamelXsltResourceUri", >> simple("xslt:http://localhost:8080/ > <path> > / > <to> > / > <template> > ?uriResolver=#myResolver")) >> .to("xslt:placeHolderTemplate.xsl") >> {/code} >> >> Then within the myResolver class, fetch a remote resource and pull down >> the >> xml you wish to use. >> >> NOTE: placeHolderTemplate.xsl is a real file located on the classpath >> for >> compile-time validation. Once we execute this route and Camel see's the >> "CamelXsltResourceUri" property in the headers, it will use the >> properties >> value as an argument into myResolver. >> >> MyResolver looks like the following: >> {code} >> class MyResolver extends XsltUriResolver { >> public Source resolve(String href, String base) throws >> TransformerException { >> if(href.contains("xslt:")){ >> // do logic to get resource >> } >> } >> } >> {/code} >> >> I hope that helps >> >> >> >> -- >> View this message in context: >> http://camel.465427.n5.nabble.com/Dynamic-xsl-with-custom-uri-resolver-tp5736668p5736862.html >> Sent from the Camel - Users mailing list archive at Nabble.com. > > > > -- > Claus Ibsen > ----------------- > Red Hat, Inc. > Email: > cibsen@ > Twitter: davsclaus > Blog: http://davsclaus.com > Author of Camel in Action: http://www.manning.com/ibsen -- View this message in context: http://camel.465427.n5.nabble.com/Dynamic-xsl-with-custom-uri-resolver-tp5736668p5736912.html Sent from the Camel - Users mailing list archive at Nabble.com.