@Override public void process(Context context) throws TransformerException { try { processChildren(context); } catch(TransformerException x) { //check if exception was thrown by an extension function to get the original //stacktrace instead of the cut off one from the wrapping TransformerException Throwable throwable = ExtensionFunctionUtils.getExtensionFunctionError(); if(throwable == null) { throwable = x; } else { ExtensionFunctionUtils.resetExtensionFunctionError(); } StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); throwable.printStackTrace(pw); pw.close(); context.getOutputter().write(sw.toString()); } }
public static boolean render(Context saxonContext, TargetGenerator targetGenerator, String href, String part, String module, String search, Node node, RequestContextImpl requestContext, RenderContext renderContext) throws Exception { try { RenderContextSaxon1 saxonRenderContext = (RenderContextSaxon1)renderContext; if(saxonRenderContext.getOutputter() == null) { saxonRenderContext.setOutputter(saxonContext.getOutputter()); } return RenderExtension.render(targetGenerator, href, part, module, search, node, requestContext, saxonRenderContext); } catch(Exception x) { ExtensionFunctionUtils.setExtensionFunctionError(x); throw x; } }
Outputter out = context.getOutputter();