}
private boolean docAvailable(String href, XPathContext context) throws XPathException {
try {
DocumentURI documentKey = DocumentFn.computeDocumentKey(href, expressionBaseURI);
DocumentPool pool = context.getController().getDocumentPool();
if (pool.isMarkedUnavailable(documentKey)) {
return false;
}
DocumentInfo doc = pool.find(documentKey);
if (doc != null) {
return true;
}
Item item = DocumentFn.makeDoc(href, expressionBaseURI, context, getSourceLocator());
if (item != null) {
return true;
} else {
// The document does not exist; ensure that this remains the case
pool.markUnavailable(documentKey);
return false;
}
} catch (XPathException e) {
return false;
}