return null;
}
}
public TailCall processLeavingTail(XPathContext context) throws XPathException {
Controller controller = context.getController();
SequenceReceiver out = context.getReceiver();
Item item = context.getContextItem();
if (!(item instanceof NodeInfo)) {
out.append(item, locationId, NodeInfo.ALL_NAMESPACES);
return null;
}
NodeInfo source = (NodeInfo)item;
//out.getPipelineConfiguration().setBaseURI(source.getBaseURI());
// Processing depends on the node kind.
switch(source.getNodeKind()) {
case Type.ELEMENT:
// use the generic code for creating new elements
return super.processLeavingTail(context);
case Type.ATTRIBUTE:
try {
CopyOf.copyAttribute(source, getSchemaType(), validation, this, context, false);
} catch (NoOpenStartTagException err) {
err.setXPathContext(context);
throw dynamicError(this, err, context);
}
break;
case Type.TEXT:
out.characters(source.getStringValueCS(), locationId, 0);
break;
case Type.PROCESSING_INSTRUCTION:
out.processingInstruction(source.getDisplayName(), source.getStringValueCS(), locationId, 0);
break;
case Type.COMMENT:
out.comment(source.getStringValueCS(), locationId, 0);
break;
case Type.NAMESPACE:
try {
source.copy(out, NodeInfo.NO_NAMESPACES, false, locationId);
} catch (NoOpenStartTagException err) {
XPathException e = new XPathException(err.getMessage());
e.setXPathContext(context);
e.setErrorCodeQName(err.getErrorCodeQName());
throw dynamicError(this, e, context);
}
break;
case Type.DOCUMENT:
XPathContext c2 = context;
if (!preservingTypes) {
Receiver val = controller.getConfiguration().
getDocumentValidator(out, source.getBaseURI(),
validation, Whitespace.NONE, getSchemaType(), -1);
if (val != out) {
SequenceReceiver sr = new TreeReceiver(val);
sr.setPipelineConfiguration(out.getPipelineConfiguration());