internal TemplateAction FindTemplate(Processor processor, XPathNavigator navigator, XmlQualifiedName mode) {
Debug.Assert(processor != null && navigator != null);
Debug.Assert(mode != null);
TemplateAction action = null;
//
// Try to find template within this stylesheet first
//
if (this.modeManagers != null) {
TemplateManager manager = (TemplateManager) this.modeManagers[mode];
if (manager != null) {
Debug.Assert(manager.Mode.Equals(mode));
action = manager.FindTemplate(processor, navigator);
}
}
//
// If unsuccessful, search in imported documents from backwards
//
if (action == null) {
action = FindTemplateImports(processor, navigator, mode);
}
return action;
}