FindTemplate() private method

private FindTemplate ( Processor processor, XPathNavigator navigator ) : TemplateAction
processor Processor
navigator System.Xml.XPath.XPathNavigator
return TemplateAction
Beispiel #1
0
        internal TemplateAction FindTemplateImports(Processor processor, XPathNavigator navigator)
        {
            TemplateAction action = null;

            //
            // Do we have imported stylesheets?
            //

            if (_imports != null)
            {
                for (int importIndex = _imports.Count - 1; importIndex >= 0; importIndex--)
                {
                    Debug.Assert(_imports[importIndex] is Stylesheet);
                    Stylesheet stylesheet = (Stylesheet)_imports[importIndex];
                    Debug.Assert(stylesheet != null);

                    //
                    // Search in imported stylesheet
                    //

                    action = stylesheet.FindTemplate(processor, navigator);

                    if (action != null)
                    {
                        return(action);
                    }
                }
            }

            return(action);
        }
Beispiel #2
0
        internal TemplateAction FindTemplate(XmlQualifiedName name)
        {
            //Debug.Assert(this.templateNameTable == null);

            TemplateAction action = null;

            //
            // Try to find template within this stylesheet first
            //

            if (_templateNameTable != null)
            {
                action = (TemplateAction)_templateNameTable[name];
            }

            //
            // If unsuccessful, search in imported documents from backwards
            //

            if (action == null && _imports != null)
            {
                for (int importIndex = _imports.Count - 1; importIndex >= 0; importIndex--)
                {
                    Debug.Assert(_imports[importIndex] is Stylesheet);
                    Stylesheet stylesheet = (Stylesheet)_imports[importIndex];
                    Debug.Assert(stylesheet != null);

                    //
                    // Search in imported stylesheet
                    //

                    action = stylesheet.FindTemplate(name);

                    if (action != null)
                    {
                        return(action);
                    }
                }
            }

            return(action);
        }