throws Exception {
List mapStack = context.getMapStack();
String resolvedSource = this.source.resolve(mapStack);
TreeProcessor processor = (TreeProcessor)processors.get(resolvedSource);
if (processor == null) {
processor = getProcessor(resolvedSource);
}
String resolvedPrefix = this.prefix.resolve(mapStack);
String oldPrefix = env.getURIPrefix();
String oldURI = env.getURI();
try {
env.changeContext(resolvedPrefix, resolvedSource);
if (context.isInternalRequest()) {
// Propagate pipelines
return processor.process(env, context.getStreamPipeline(), context.getEventPipeline());
} else {
// Processor will create its own pipelines
return processor.process(env);
}
} finally {
// Restore context
env.setContext(oldPrefix, oldURI);