basenode = Expr.toNode(args.get(1));
else
basenode = Expr.toNode(args.get(0));
Path stylesheetPath = env.getStylesheetEnv().getPath();
URIResolver resolver = _transformer.getURIResolver();
Path path;
if (name == null || name.equals(""))
name = stylesheetPath.getTail();
String systemId = null;
DocumentType dtd = null;
Document owner = null;
if (basenode == null) {
}
else if (basenode.getOwnerDocument() != null) {
owner = basenode.getOwnerDocument();
dtd = owner.getDoctype();
}
else if (basenode instanceof Document) {
owner = (Document) basenode;
dtd = owner.getDoctype();
}
if (basenode instanceof CauchoNode)
systemId = ((CauchoNode) basenode).getBaseURI();
Path pwd = stylesheetPath.getParent();
if (systemId == null && owner instanceof QDocument)
systemId = ((QDocument) owner).getSystemId();
if (systemId == null && dtd != null)
systemId = dtd.getSystemId();
if (systemId == null)
systemId = stylesheetPath.getURL();
Node doc = null;
Source source = null;
if (resolver != null) {
try {
source = resolver.resolve(name, systemId);
} catch (TransformerException e) {
throw new XPathException(e);
}
}