Hi,
Maybe some of you already do this, but I am finding anonymous
URIResolvers incredibly useful. You can use private method variables,
instance variables, instance methods, etc from the same class that you
call the transform. In the past I usually passed objects to the
URIResolver constructor, but this seems much better (example below).
Anybody see any problems with this approach?
Transformer transformer = xslTemplates.newTransformer();
transformer.setURIResolver(new URIResolver() {
public Source resolve(String href, String base) {
if ("page-data".equals(href)) {
return new StreamSource(
new StringReader(
resolvePageData(handler)));
} else if ("message-keys".equals(href)) {
return new StreamSource(
new StringReader(
resolveMessageKeys(handler)));
} else {
return new StreamSource(
new StringReader(
resolveNotHandled(href)));
}
}
});
best,
-Rob
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--