public XPathNavigator GetDataSource(string uriRelative, string uriBase) {
object input;
Uri uriResolvedBase, uriResolved;
XPathNavigator nav = null;
try {
// If the data source has already been retrieved, then return the data source from the cache.
uriResolvedBase = (uriBase != null) ? this.dataSources.ResolveUri(null, uriBase) : null;
uriResolved = this.dataSources.ResolveUri(uriResolvedBase, uriRelative);
if (uriResolved != null)
nav = this.dataSourceCache[uriResolved] as XPathNavigator;
if (nav == null) {
// Get the entity from the resolver and ensure it is cached as a document
input = this.dataSources.GetEntity(uriResolved, null, null);
if (input != null) {
// Construct a document from the entity and add the document to the cache
nav = ConstructDocument(input, uriRelative, uriResolved);
this.dataSourceCache.Add(uriResolved, nav);
}
}
}
catch (XslTransformException) {
// Don't need to wrap XslTransformException
throw;
}
catch (Exception e) {
if (!XmlException.IsCatchableException(e)) {
throw;
}
throw new XslTransformException(e, Res.XmlIl_DocumentLoadError, uriRelative);
}
return nav;
}