String wport = port + "|";
WritablePipe pipe = outputs.get(wport);
for (ReadablePipe reader : inputs.get(port)) {
while (reader.moreDocuments()) {
XdmNode doc = reader.read();
pipe.write(doc);
logger.trace(MessageFormatter.nodeMessage(step.getNode(), "Pipeline input copy from " + reader + " to " + pipe));
}
}
}
}
setupParameters();
// N.B. At this time, there are no compound steps that accept parameters or options,
// so the order in which we calculate them doesn't matter. That will change if/when
// there are such compound steps.
// Calculate all the options
inScopeOptions = parent.getInScopeOptions();
for (QName name : step.getOptions()) {
Option option = step.getOption(name);
RuntimeValue value = null;
if (optionsPassedIn != null && optionsPassedIn.containsKey(name)) {
value = optionsPassedIn.get(name);
} else {
if (option.getRequired() && option.getSelect() == null) {
throw XProcException.staticError(18, option.getNode(), "No value provided for required option \"" + option.getName() + "\"");
}
if (option.getSelect() == null) {
value = new RuntimeValue();
} else {
value = computeValue(option);
}
}
setOption(name, value);
inScopeOptions.put(name, value);
}
for (Variable var : step.getVariables()) {
RuntimeValue value = computeValue(var);
inScopeOptions.put(var.getName(), value);
}
for (XStep step : subpipeline) {
step.run();
}
for (String port : inputs.keySet()) {
if (port.startsWith("|")) {
String wport = port.substring(1);
WritablePipe pipe = outputs.get(wport);
try {
for (ReadablePipe reader : inputs.get(port)) {
// Check for the case where there are no documents, but a sequence is not allowed
if (!reader.moreDocuments() && !pipe.writeSequence()) {
throw XProcException.dynamicError(7);
}
while (reader.moreDocuments()) {
XdmNode doc = reader.read();
pipe.write(doc);
logger.trace(MessageFormatter.nodeMessage(step.getNode(), "Pipeline output copy from " + reader + " to " + pipe));
}
}
} finally {