}
if (emitter.getWriter()==null) {
emitter.setWriter(new OutputStreamWriter(System.err));
}
TreeReceiver rec = new TreeReceiver(emitter);
XPathContext c2 = context.newMinorContext();
c2.setOrigin(this);
Properties props = new Properties();
props.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
emitter.setOutputProperties(props);
c2.changeOutputDestination(props, rec, false, Validation.PRESERVE, null);
if (select != null) {
SequenceIterator iter = select.iterate(c2);
while (true) {
Item item = iter.next();
if (item == null) {
break;
}
rec.append(item, locationId);
}
}
processChildren(c2);
rec.close();
//c2.resetOutputDestination(old);
if (terminate != null) {
String term = terminate.evaluateAsString(context);
if (term.equals("no")) {