public NodeInfo setSource(Source source) throws net.sf.saxon.trans.XPathException {
if (source instanceof DOMSource) {
Node node = ((DOMSource)source).getNode();
String baseURI = source.getSystemId();
DocumentWrapper documentWrapper = new DocumentWrapper(node.getOwnerDocument(), baseURI, config);
NodeWrapper nodeWrapper = documentWrapper.wrap(node);
if (stripSpace) {
SpaceStrippedDocument sdoc = new SpaceStrippedDocument(documentWrapper, AllElementStripper.getInstance());
return sdoc.wrap(nodeWrapper);
} else {
return nodeWrapper;