public WritablePipe getWriter() {
if (writer != null) {
throw new XProcException(node, "Attempt to create two writers for the same input.");
}
if (documents == null) {
documents = new DocumentSequence(runtime);
}
writer = new Pipe(runtime, documents);
return writer;
}