String resolvedPrefix = this.prefix.resolve(context, objectModel);
if (resolvedSource.length() == 0) {
throw new ProcessingException("Source of mount statement is empty");
}
TreeProcessor processor = getProcessor(resolvedSource);
// Save context
String oldPrefix = env.getURIPrefix();
String oldURI = env.getURI();
String oldContext = env.getContext();
Object oldPassThrough = env.getAttribute(COCOON_PASS_THROUGH);
env.setAttribute(COCOON_PASS_THROUGH, this.passThrough);
boolean pipelineWasBuilt = false;
try {
env.changeContext(resolvedPrefix, resolvedSource);
if (context.isBuildingPipelineOnly()) {
// Propagate pipelines
ProcessingPipeline pp = processor.buildPipeline(env);
if (pp != null) {
context.setProcessingPipeline( pp );
pipelineWasBuilt = true;
}
} else {
// Processor will create its own pipelines
pipelineWasBuilt = processor.process(env);
}
} catch(Exception e) {
// Wrap with our location
throw ProcessingException.throwLocated("Sitemap: error when calling sub-sitemap", e, getLocation());