use of org.apache.xalan.trace.TraceManager in project webtools.sourceediting by eclipse.
the class XalanDebugger method addTransformer.
public void addTransformer(Transformer transformer) {
TransformerImpl transformerImpl = (TransformerImpl) transformer;
lastTransformerInChain = transformerImpl;
TraceManager trMgr = transformerImpl.getTraceManager();
try {
// XalanPrintTraceListener printer = new XalanPrintTraceListener(new PrintWriter(System.err));
// printer.m_traceElements = true;
// printer.m_traceSelection = true;
// printer.m_traceTemplates = true;
// trMgr.addTraceListener(printer);
XalanTraceListener traceListener = new XalanTraceListener(this);
trMgr.addTraceListener(traceListener);
} catch (TooManyListenersException e) {
// ignore
}
}
use of org.apache.xalan.trace.TraceManager in project mycore by MyCoRe-Org.
the class MCRTemplatesCompiler method getTransformer.
/**
* Returns a new transformer for the compiled XSL templates
*/
public static Transformer getTransformer(Templates templates) throws TransformerConfigurationException {
Transformer tf = factory.newTransformerHandler(templates).getTransformer();
// In debug mode, add a TraceListener to log stylesheet execution
if (LOGGER.isDebugEnabled()) {
try {
TraceManager tm = ((org.apache.xalan.transformer.TransformerImpl) tf).getTraceManager();
tm.addTraceListener(new MCRTraceListener());
} catch (Exception ex) {
LOGGER.warn(ex);
}
}
return tf;
}
use of org.apache.xalan.trace.TraceManager in project mycore by MyCoRe-Org.
the class MCRXSLTransformer method getTransformHandlerList.
protected LinkedList<TransformerHandler> getTransformHandlerList(MCRParameterCollector parameterCollector) throws TransformerConfigurationException, SAXException, ParserConfigurationException {
checkTemplateUptodate();
LinkedList<TransformerHandler> xslSteps = new LinkedList<>();
// every transformhandler shares the same ErrorListener instance
MCRErrorListener errorListener = MCRErrorListener.getInstance();
for (Templates template : templates) {
TransformerHandler handler = tFactory.newTransformerHandler(template);
parameterCollector.setParametersTo(handler.getTransformer());
handler.getTransformer().setErrorListener(errorListener);
if (TRACE_LISTENER_ENABLED) {
TransformerImpl transformer = (TransformerImpl) handler.getTransformer();
TraceManager traceManager = transformer.getTraceManager();
try {
traceManager.addTraceListener(TRACE_LISTENER);
} catch (TooManyListenersException e) {
LOGGER.warn("Could not add MCRTraceListener.", e);
}
}
if (!xslSteps.isEmpty()) {
Result result = new SAXResult(handler);
xslSteps.getLast().setResult(result);
}
xslSteps.add(handler);
}
return xslSteps;
}
Aggregations