{
final TemplatesHandler handler = factory.newTemplatesHandler();
try {
handler.startDocument();
stylesheetRoot.toSAX(context.getBroker(), handler, null);
handler.endDocument();
return handler.getTemplates();
} catch (final SAXException e) {
throw new XPathException(this,
"A SAX exception occurred while compiling the stylesheet: " + e.getMessage(), e);
}