Example #1
0
        internal TemplateAction FindTemplateImports(Processor processor, XPathNavigator navigator)
        {
            TemplateAction action = null;

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

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

                    //
                    // Search in imported stylesheet
                    //

                    action = stylesheet.FindTemplate(processor, navigator);

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

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

            TemplateAction action = null;

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

            if (this.templateNameTable != null)
            {
                action = (TemplateAction)this.templateNameTable[name];
            }

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

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

                    //
                    // Search in imported stylesheet
                    //

                    action = stylesheet.FindTemplate(name);

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

            return(action);
        }