int getDoc(XPathContext xctxt, int context, String uri, String base)
throws javax.xml.transform.TransformerException
{
// System.out.println("base: "+base+", uri: "+uri);
SourceTreeManager treeMgr = xctxt.getSourceTreeManager();
Source source;
int newDoc;
try
{
source = treeMgr.resolveURI(base, uri, xctxt.getSAXLocator());
newDoc = treeMgr.getNode(source);
}
catch (IOException ioe)
{
throw new TransformerException(ioe.getMessage(),
(SourceLocator)xctxt.getSAXLocator(), ioe);
}
catch(TransformerException te)
{
throw new TransformerException(te);
}
if (DTM.NULL != newDoc)
return newDoc;
// If the uri length is zero, get the uri of the stylesheet.
if (uri.length() == 0)
{
// Hmmm... this seems pretty bogus to me... -sb
uri = xctxt.getNamespaceContext().getBaseIdentifier();
try
{
source = treeMgr.resolveURI(base, uri, xctxt.getSAXLocator());
}
catch (IOException ioe)
{
throw new TransformerException(ioe.getMessage(),
(SourceLocator)xctxt.getSAXLocator(), ioe);
}
}
String diagnosticsString = null;
try
{
if ((null != uri) && (uri.toString().length() > 0))
{
newDoc = treeMgr.getSourceTree(source, xctxt.getSAXLocator(), xctxt);
// System.out.println("newDoc: "+((Document)newDoc).getDocumentElement().getNodeName());
}
else
warn(xctxt, XSLTErrorResources.WG_CANNOT_MAKE_URL_FROM,