Equals() static private method

static private Equals ( string strA, string strB ) : bool
strA string
strB string
return bool
Example #1
0
        public void CompileAttributes(Compiler compiler)
        {
            NavigatorInput input   = compiler.Input;
            string         element = input.LocalName;

            if (input.MoveToFirstAttribute())
            {
                do
                {
                    if (!Keywords.Equals(input.NamespaceURI, input.Atoms.Empty))
                    {
                        continue;
                    }

                    try {
                        if (CompileAttribute(compiler) == false)
                        {
                            throw XsltException.Create(Res.Xslt_InvalidAttribute, input.LocalName, element);
                        }
                    }catch {
                        if (!compiler.ForwardCompatibility)
                        {
                            throw;
                        }
                        else
                        {
                            // In ForwardCompatibility mode we ignoreing all unknown or incorrect attributes
                            // If it's mandatory attribute we'l notice it absents later.
                        }
                    }
                }while (input.MoveToNextAttribute());
                input.ToParent();
            }
        }
Example #2
0
        internal override bool CompileAttribute(Compiler compiler)
        {
            string name  = compiler.Input.LocalName;
            string value = compiler.Input.Value;

            if (Keywords.Equals(name, compiler.Atoms.Select))
            {
                this.selectKey = compiler.AddQuery(value);
            }
            else if (Keywords.Equals(name, compiler.Atoms.Lang))
            {
                this.langAvt = Avt.CompileAvt(compiler, value);
            }
            else if (Keywords.Equals(name, compiler.Atoms.DataType))
            {
                this.dataTypeAvt = Avt.CompileAvt(compiler, value);
            }
            else if (Keywords.Equals(name, compiler.Atoms.Order))
            {
                this.orderAvt = Avt.CompileAvt(compiler, value);
            }
            else if (Keywords.Equals(name, compiler.Atoms.CaseOrder))
            {
                this.caseOrderAvt = Avt.CompileAvt(compiler, value);
            }
            else
            {
                return(false);
            }
            return(true);
        }
Example #3
0
        protected void CompileSortElements(Compiler compiler)
        {
            NavigatorInput input = compiler.Input;

            do
            {
                switch (input.NodeType)
                {
                case XPathNodeType.Element:
                    if (Keywords.Equals(input.NamespaceURI, input.Atoms.XsltNamespace) &&
                        Keywords.Equals(input.LocalName, input.Atoms.Sort))
                    {
                        if (sortContainer == null)
                        {
                            sortContainer = new ContainerAction();
                        }
                        sortContainer.AddAction(compiler.CreateSortAction());
                        continue;
                    }
                    return;

                case XPathNodeType.Text:
                    return;

                case XPathNodeType.SignificantWhitespace:
                    this.AddEvent(compiler.CreateTextEvent());
                    continue;

                default:
                    continue;
                }
            }while (input.Advance());
        }
        protected void CompileOnceTemplate(Compiler compiler)
        {
            NavigatorInput input = compiler.Input;

            if (input.NodeType == XPathNodeType.Element)
            {
                string nspace = input.NamespaceURI;

                if (Keywords.Equals(nspace, input.Atoms.XsltNamespace))
                {
                    compiler.PushNamespaceScope();
                    CompileInstruction(compiler);
                    compiler.PopScope();
                }
                else
                {
                    compiler.PushLiteralScope();
                    compiler.InsertExtensionNamespace();
                    if (compiler.IsExtensionNamespace(nspace))
                    {
                        AddAction(compiler.CreateNewInstructionAction());
                    }
                    else
                    {
                        CompileLiteral(compiler);
                    }
                    compiler.PopScope();
                }
            }
            else
            {
                CompileLiteral(compiler);
            }
        }
Example #5
0
        internal bool FindPrefix(string nspace, out string prefix)
        {
            Debug.Assert(nspace != null);
            for (int i = this.elementScopesStack.Length - 1; 0 <= i; i--)
            {
                Debug.Assert(this.elementScopesStack[i] is OutputScope);

                OutputScope elementScope = (OutputScope)this.elementScopesStack[i];
                string      pfx          = null;
                if (elementScope.FindPrefix(nspace, out pfx))
                {
                    string testNspace = ResolveNamespace(pfx);
                    if (testNspace != null && Keywords.Equals(testNspace, nspace))
                    {
                        prefix = pfx;
                        return(true);
                    }
                    else
                    {
                        break;
                    }
                }
            }
            prefix = null;
            return(false);
        }
        internal override void Compile(Compiler compiler)
        {
            Debug.Assert(Keywords.Equals(compiler.Input.LocalName, compiler.Atoms.UseAttributeSets));
            this.useString = compiler.Input.Value;

            Debug.Assert(this.useAttributeSets == null);

            if (this.useString.Length == 0)
            {
                // Split creates empty node is spliting empty string
                this.useAttributeSets = new XmlQualifiedName[0];
                return;
            }

            string[] qnames = XmlConvert.SplitString(this.useString);

            try {
                this.useAttributeSets = new XmlQualifiedName[qnames.Length]; {
                    for (int i = 0; i < qnames.Length; i++)
                    {
                        this.useAttributeSets[i] = compiler.CreateXPathQName(qnames[i]);
                    }
                }
            }
            catch (XsltException) {
                if (!compiler.ForwardCompatibility)
                {
                    // Rethrow the exception if we're not in forwards-compatible mode
                    throw;
                }
                // Ignore the whole list in forwards-compatible mode
                this.useAttributeSets = new XmlQualifiedName[0];
            }
        }
Example #7
0
        internal override bool CompileAttribute(Compiler compiler)
        {
            string name  = compiler.Input.LocalName;
            string value = compiler.Input.Value;

            if (Keywords.Equals(name, compiler.Atoms.Select))
            {
                this.selectKey = compiler.AddQuery(value);
            }
            else if (Keywords.Equals(name, compiler.Atoms.Mode))
            {
                Debug.Assert(this.mode == null);
                if (compiler.AllowBuiltInMode && value == "*")
                {
                    this.mode = Compiler.BuiltInMode;
                }
                else
                {
                    this.mode = compiler.CreateXPathQName(value);
                }
            }
            else
            {
                return(false);
            }

            return(true);
        }
        protected void CompileParameters(Compiler compiler)
        {
            NavigatorInput input = compiler.Input;

            do
            {
                switch (input.NodeType)
                {
                case XPathNodeType.Element:
                    if (Keywords.Equals(input.NamespaceURI, input.Atoms.XsltNamespace) &&
                        Keywords.Equals(input.LocalName, input.Atoms.Param))
                    {
                        compiler.PushNamespaceScope();
                        AddAction(compiler.CreateVariableAction(VariableType.LocalParameter));
                        compiler.PopScope();
                        continue;
                    }
                    else
                    {
                        return;
                    }

                case XPathNodeType.Text:
                    return;

                case XPathNodeType.SignificantWhitespace:
                    this.AddEvent(compiler.CreateTextEvent());
                    continue;

                default:
                    continue;
                }
            }while (input.Advance());
        }
Example #9
0
        //
        // Utility implementation methods
        //

        private int FindAttribute(string name, string nspace, ref string prefix)
        {
            Debug.Assert(this.attributeCount <= this.attributeList.Count);

            for (int attrib = 0; attrib < this.attributeCount; attrib++)
            {
                Debug.Assert(this.attributeList[attrib] != null && this.attributeList[attrib] is BuilderInfo);

                BuilderInfo attribute = (BuilderInfo)this.attributeList[attrib];

                if (Keywords.Equals(attribute.LocalName, name))
                {
                    if (Keywords.Equals(attribute.NamespaceURI, nspace))
                    {
                        return(attrib);
                    }
                    if (Keywords.Equals(attribute.Prefix, prefix))
                    {
                        // prefix conflict. Should be renamed.
                        prefix = string.Empty;
                    }
                }
            }

            return(-1);
        }
        internal override bool CompileAttribute(Compiler compiler)
        {
            string name  = compiler.Input.LocalName;
            string value = compiler.Input.Value;

            if (Keywords.Equals(name, compiler.Atoms.Level))
            {
                if (value != "any" && value != "multiple" && value != "single")
                {
                    throw XsltException.Create(Res.Xslt_InvalidAttrValue, Keywords.s_Level, value);
                }
                this.level = value;
            }
            else if (Keywords.Equals(name, compiler.Atoms.Count))
            {
                this.countPattern = value;
                this.countKey     = compiler.AddQuery(value, /*allowVars:*/ true, /*allowKey:*/ true, /*pattern*/ true);
            }
            else if (Keywords.Equals(name, compiler.Atoms.From))
            {
                this.from    = value;
                this.fromKey = compiler.AddQuery(value, /*allowVars:*/ true, /*allowKey:*/ true, /*pattern*/ true);
            }
            else if (Keywords.Equals(name, compiler.Atoms.Value))
            {
                this.value    = value;
                this.valueKey = compiler.AddQuery(value);
            }
            else if (Keywords.Equals(name, compiler.Atoms.Format))
            {
                this.formatAvt = Avt.CompileAvt(compiler, value);
            }
            else if (Keywords.Equals(name, compiler.Atoms.Lang))
            {
                this.langAvt = Avt.CompileAvt(compiler, value);
            }
            else if (Keywords.Equals(name, compiler.Atoms.LetterValue))
            {
                this.letterAvt = Avt.CompileAvt(compiler, value);
            }
            else if (Keywords.Equals(name, compiler.Atoms.GroupingSeparator))
            {
                this.groupingSepAvt = Avt.CompileAvt(compiler, value);
            }
            else if (Keywords.Equals(name, compiler.Atoms.GroupingSize))
            {
                this.groupingSizeAvt = Avt.CompileAvt(compiler, value);
            }
            else
            {
                return(false);
            }
            return(true);
        }
Example #11
0
        private void CompileContent(Compiler compiler)
        {
            NavigatorInput input = compiler.Input;

            if (compiler.Recurse())
            {
                do
                {
                    switch (input.NodeType)
                    {
                    case XPathNodeType.Element:
                        compiler.PushNamespaceScope();
                        string nspace = input.NamespaceURI;
                        string name   = input.LocalName;

                        if (Keywords.Equals(nspace, input.Atoms.XsltNamespace))
                        {
                            if (Keywords.Equals(name, input.Atoms.Sort))
                            {
                                AddAction(compiler.CreateSortAction());
                            }
                            else if (Keywords.Equals(name, input.Atoms.WithParam))
                            {
                                WithParamAction par = compiler.CreateWithParamAction();
                                CheckDuplicateParams(par.Name);
                                AddAction(par);
                            }
                            else
                            {
                                throw compiler.UnexpectedKeyword();
                            }
                        }
                        else
                        {
                            throw compiler.UnexpectedKeyword();
                        }
                        compiler.PopScope();
                        break;

                    case XPathNodeType.Comment:
                    case XPathNodeType.ProcessingInstruction:
                    case XPathNodeType.Whitespace:
                    case XPathNodeType.SignificantWhitespace:
                        break;

                    default:
                        throw XsltException.Create(Res.Xslt_InvalidContents, Keywords.s_ApplyTemplates);
                    }
                }while (compiler.Advance());

                compiler.ToParent();
            }
        }
        void CompileLiteralAttributesAndNamespaces(Compiler compiler)
        {
            NavigatorInput input = compiler.Input;

            if (input.Navigator.MoveToAttribute(Keywords.s_UseAttributeSets, input.Atoms.XsltNamespace))
            {
                AddAction(compiler.CreateUseAttributeSetsAction());
                input.Navigator.MoveToParent();
            }
            compiler.InsertExcludedNamespace();

            if (input.MoveToFirstNamespace())
            {
                do
                {
                    string uri = input.Value;

                    if (Keywords.Compare(uri, input.Atoms.XsltNamespace))
                    {
                        continue;
                    }
                    if (
                        compiler.IsExcludedNamespace(uri) ||
                        compiler.IsExtensionNamespace(uri) ||
                        compiler.IsNamespaceAlias(uri)
                        )
                    {
                        continue;
                    }
                    this.AddEvent(new NamespaceEvent(input));
                }while (input.MoveToNextNamespace());
                input.ToParent();
            }

            if (input.MoveToFirstAttribute())
            {
                do
                {
                    // Skip everything from Xslt namespace
                    if (Keywords.Equals(input.NamespaceURI, input.Atoms.XsltNamespace))
                    {
                        continue;
                    }

                    // Add attribute events
                    this.AddEvent(compiler.CreateBeginEvent());
                    this.AddEvents(compiler.CompileAvt(input.Value));
                    this.AddEvent(new EndEvent(XPathNodeType.Attribute));
                }while (input.MoveToNextAttribute());
                input.ToParent();
            }
        }
        internal void CompileKey(Compiler compiler)
        {
            NavigatorInput input    = compiler.Input;
            string         element  = input.LocalName;
            int            MatchKey = Compiler.InvalidQueryKey;
            int            UseKey   = Compiler.InvalidQueryKey;

            XmlQualifiedName Name = null;

            if (input.MoveToFirstAttribute())
            {
                do
                {
                    string nspace = input.NamespaceURI;
                    string name   = input.LocalName;
                    string value  = input.Value;

                    if (!Keywords.Equals(nspace, input.Atoms.Empty))
                    {
                        continue;
                    }

                    if (Keywords.Equals(name, input.Atoms.Name))
                    {
                        Name = compiler.CreateXPathQName(value);
                    }
                    else if (Keywords.Equals(name, input.Atoms.Match))
                    {
                        MatchKey = compiler.AddQuery(value, /*allowVars:*/ false, /*allowKey*/ false, /*pattern*/ true);
                    }
                    else if (Keywords.Equals(name, input.Atoms.Use))
                    {
                        UseKey = compiler.AddQuery(value, /*allowVars:*/ false, /*allowKey*/ false, /*pattern*/ false);
                    }
                    else
                    {
                        if (!compiler.ForwardCompatibility)
                        {
                            throw XsltException.Create(Res.Xslt_InvalidAttribute, name, element);
                        }
                    }
                }while(input.MoveToNextAttribute());
                input.ToParent();
            }

            CheckRequiredAttribute(compiler, MatchKey != Compiler.InvalidQueryKey, Keywords.s_Match);
            CheckRequiredAttribute(compiler, UseKey != Compiler.InvalidQueryKey, Keywords.s_Use);
            CheckRequiredAttribute(compiler, Name != null, Keywords.s_Name);

            compiler.InsertKey(Name, MatchKey, UseKey);
        }
        internal string ResolveAtom(string prefix)
        {
            Debug.Assert(prefix != null && prefix.Length > 0);

            for (NamespaceDecl scope = this.scopes; scope != null; scope = scope.Next)
            {
                if (Keywords.Equals(scope.Prefix, prefix))
                {
                    Debug.Assert(scope.Uri != null);
                    return(scope.Uri);
                }
            }

            return(null);
        }
Example #15
0
        private void FixupElement()
        {
            Debug.Assert(this.mainNode.NodeType == XmlNodeType.Element);

            if (Keywords.Equals(this.mainNode.NamespaceURI, this.atoms.Empty))
            {
                this.mainNode.Prefix = this.atoms.Empty;
            }

            if (Keywords.Equals(this.mainNode.Prefix, this.atoms.Empty))
            {
                if (Keywords.Equals(this.mainNode.NamespaceURI, this.scopeManager.DefaultNamespace))
                {
                    // Main Node is OK
                }
                else
                {
                    DeclareNamespace(this.mainNode.NamespaceURI, this.mainNode.Prefix);
                }
            }
            else
            {
                bool   thisScope = false;
                string nspace    = this.scopeManager.ResolveNamespace(this.mainNode.Prefix, out thisScope);
                if (nspace != null)
                {
                    if (!Keywords.Equals(this.mainNode.NamespaceURI, nspace))
                    {
                        if (thisScope)      // Prefix conflict
                        {
                            this.mainNode.Prefix = GetPrefixForNamespace(this.mainNode.NamespaceURI);
                        }
                        else
                        {
                            DeclareNamespace(this.mainNode.NamespaceURI, this.mainNode.Prefix);
                        }
                    }
                }
                else
                {
                    DeclareNamespace(this.mainNode.NamespaceURI, this.mainNode.Prefix);
                }
            }

            OutputScope elementScope = this.scopeManager.CurrentElementScope;

            elementScope.Prefix = this.mainNode.Prefix;
        }
Example #16
0
        internal override bool CompileAttribute(Compiler compiler)
        {
            string name  = compiler.Input.LocalName;
            string value = compiler.Input.Value;

            if (Keywords.Equals(name, compiler.Atoms.UseAttributeSets))
            {
                this.useAttributeSets = value;
                AddAction(compiler.CreateUseAttributeSetsAction());
            }
            else
            {
                return(false);
            }
            return(true);
        }
Example #17
0
        internal override bool CompileAttribute(Compiler compiler)
        {
            string name  = compiler.Input.LocalName;
            string value = compiler.Input.Value;

            if (Keywords.Equals(name, compiler.Atoms.DisableOutputEscaping))
            {
                this.disableOutputEscaping = compiler.GetYesNo(value);
            }
            else
            {
                return(false);
            }

            return(true);
        }
        internal override bool CompileAttribute(Compiler compiler)
        {
            string name  = compiler.Input.LocalName;
            string value = compiler.Input.Value;

            if (Keywords.Equals(name, compiler.Atoms.Select))
            {
                this.selectKey = compiler.AddQuery(value);
            }
            else
            {
                return(false);
            }

            return(true);
        }
        internal override bool CompileAttribute(Compiler compiler)
        {
            string name  = compiler.Input.LocalName;
            string value = compiler.Input.Value;

            if (Keywords.Equals(name, compiler.Atoms.Name))
            {
                this.nameAvt = Avt.CompileAvt(compiler, value);
            }
            else
            {
                return(false);
            }

            return(true);
        }
Example #20
0
        internal override bool CompileAttribute(Compiler compiler)
        {
            string name  = compiler.Input.LocalName;
            string value = compiler.Input.Value;

            if (Keywords.Equals(name, compiler.Atoms.Terminate))
            {
                _Terminate = compiler.GetYesNo(value);
            }
            else
            {
                return(false);
            }

            return(true);
        }
        internal void CompileNamespaceAlias(Compiler compiler)
        {
            NavigatorInput input = compiler.Input;
            string         element = input.LocalName;
            string         namespace1 = null, namespace2 = null;
            string         prefix1 = null, prefix2 = null;

            if (input.MoveToFirstAttribute())
            {
                do
                {
                    string nspace = input.NamespaceURI;
                    string name   = input.LocalName;

                    if (!Keywords.Equals(nspace, input.Atoms.Empty))
                    {
                        continue;
                    }

                    if (Keywords.Equals(name, input.Atoms.StylesheetPrefix))
                    {
                        prefix1    = input.Value;
                        namespace1 = compiler.GetNsAlias(ref prefix1);
                    }
                    else if (Keywords.Equals(name, input.Atoms.ResultPrefix))
                    {
                        prefix2    = input.Value;
                        namespace2 = compiler.GetNsAlias(ref prefix2);
                    }
                    else
                    {
                        if (!compiler.ForwardCompatibility)
                        {
                            throw XsltException.Create(Res.Xslt_InvalidAttribute, name, element);
                        }
                    }
                }while(input.MoveToNextAttribute());
                input.ToParent();
            }

            CheckRequiredAttribute(compiler, namespace1, Keywords.s_StylesheetPrefix);
            CheckRequiredAttribute(compiler, namespace2, Keywords.s_ResultPrefix);
            CheckEmpty(compiler);

            //String[] resultarray = { prefix2, namespace2 };
            compiler.AddNamespaceAlias(namespace1, new NamespaceInfo(prefix2, namespace2, compiler.Stylesheetid));
        }
Example #22
0
        internal override bool CompileAttribute(Compiler compiler)
        {
            string name  = compiler.Input.LocalName;
            string value = compiler.Input.Value;

            if (Keywords.Equals(name, compiler.Atoms.Name))
            {
                Debug.Assert(this.name == null);
                this.name = compiler.CreateXPathQName(value);
            }
            else
            {
                return(false);
            }

            return(true);
        }
        internal void CompileSelectiveTemplate(Compiler compiler)
        {
            NavigatorInput input = compiler.Input;

            do
            {
                if (Keywords.Equals(input.NamespaceURI, input.Atoms.XsltNamespace) &&
                    Keywords.Equals(input.LocalName, input.Atoms.Fallback))
                {
                    fallback = true;
                    if (compiler.Recurse())
                    {
                        CompileTemplate(compiler);
                        compiler.ToParent();
                    }
                }
            }while (compiler.Advance());
        }
Example #24
0
        internal bool FindPrefix(string urn, out string prefix)
        {
            Debug.Assert(urn != null);

            for (NamespaceDecl scope = this.scopes; scope != null; scope = scope.Next)
            {
                if (Keywords.Equals(scope.Uri, urn) &&
                    scope.Prefix != null &&
                    scope.Prefix.Length > 0)
                {
                    prefix = scope.Prefix;
                    return(true);
                }
            }

            prefix = string.Empty;
            return(false);
        }
Example #25
0
        private void FixupAttributes(int attributeCount)
        {
            for (int attr = 0; attr < attributeCount; attr++)
            {
                Debug.Assert(this.attributeList[attr] is BuilderInfo);
                BuilderInfo info = (BuilderInfo)this.attributeList[attr];


                if (Keywords.Equals(info.NamespaceURI, this.atoms.Empty))
                {
                    info.Prefix = this.atoms.Empty;
                }
                else
                {
                    if (Keywords.Equals(info.Prefix, this.atoms.Empty))
                    {
                        info.Prefix = GetPrefixForNamespace(info.NamespaceURI);
                    }
                    else
                    {
                        bool   thisScope = false;
                        string nspace    = this.scopeManager.ResolveNamespace(info.Prefix, out thisScope);
                        if (nspace != null)
                        {
                            if (!Keywords.Equals(info.NamespaceURI, nspace))
                            {
                                if (thisScope)  // prefix conflict
                                {
                                    info.Prefix = GetPrefixForNamespace(info.NamespaceURI);
                                }
                                else
                                {
                                    DeclareNamespace(info.NamespaceURI, info.Prefix);
                                }
                            }
                        }
                        else
                        {
                            DeclareNamespace(info.NamespaceURI, info.Prefix);
                        }
                    }
                }
            }
        }
        internal override bool CompileAttribute(Compiler compiler)
        {
            string name  = compiler.Input.LocalName;
            string value = compiler.Input.Value;

            if (Keywords.Equals(name, compiler.Atoms.Match))
            {
                Debug.Assert(this.matchKey == Compiler.InvalidQueryKey);
                this.matchKey = compiler.AddQuery(value, /*allowVars:*/ false, /*allowKey:*/ true, /*pattern*/ true);
            }
            else if (Keywords.Equals(name, compiler.Atoms.Name))
            {
                Debug.Assert(this.name == null);
                this.name = compiler.CreateXPathQName(value);
            }
            else if (Keywords.Equals(name, compiler.Atoms.Priority))
            {
                Debug.Assert(Double.IsNaN(this.priority));
                this.priority = XmlConvert.ToXPathDouble(value);
                if (double.IsNaN(this.priority) && !compiler.ForwardCompatibility)
                {
                    throw XsltException.Create(Res.Xslt_InvalidAttrValue, Keywords.s_Priority, value);
                }
            }
            else if (Keywords.Equals(name, compiler.Atoms.Mode))
            {
                Debug.Assert(this.mode == null);
                if (compiler.AllowBuiltInMode && value == "*")
                {
                    this.mode = Compiler.BuiltInMode;
                }
                else
                {
                    this.mode = compiler.CreateXPathQName(value);
                }
            }
            else
            {
                return(false);
            }

            return(true);
        }
        private void CompileContent(Compiler compiler)
        {
            NavigatorInput input = compiler.Input;

            if (compiler.Recurse())
            {
                do
                {
                    switch (input.NodeType)
                    {
                    case XPathNodeType.Element:
                        compiler.PushNamespaceScope();

                        string nspace = input.NamespaceURI;
                        string name   = input.LocalName;

                        if (Keywords.Equals(nspace, input.Atoms.XsltNamespace) && Keywords.Equals(name, input.Atoms.Attribute))
                        {
                            // found attribute so add it
                            AddAction(compiler.CreateAttributeAction());
                        }
                        else
                        {
                            throw compiler.UnexpectedKeyword();
                        }
                        compiler.PopScope();
                        break;

                    case XPathNodeType.Comment:
                    case XPathNodeType.ProcessingInstruction:
                    case XPathNodeType.Whitespace:
                    case XPathNodeType.SignificantWhitespace:
                        break;

                    default:
                        throw XsltException.Create(Res.Xslt_InvalidContents, Keywords.s_AttributeSet);
                    }
                }while(compiler.Advance());

                compiler.ToParent();
            }
        }
Example #28
0
 public string GetNsAlias(ref string prefix)
 {
     Debug.Assert(
         Keywords.Equals(this.input.LocalName, this.input.Atoms.StylesheetPrefix) ||
         Keywords.Equals(this.input.LocalName, this.input.Atoms.ResultPrefix)
         );
     if (Keywords.Compare(this.input.Atoms.HashDefault, prefix))
     {
         prefix = string.Empty;
         return(this.DefaultNamespace);
     }
     else
     {
         if (!PrefixQName.ValidatePrefix(prefix))
         {
             throw XsltException.Create(Res.Xslt_InvalidAttrValue, this.input.LocalName, prefix);
         }
         return(this.ResolveXPathNamespace(prefix));
     }
 }
        internal override bool CompileAttribute(Compiler compiler)
        {
            string name  = compiler.Input.LocalName;
            string value = compiler.Input.Value;

            if (Keywords.Equals(name, compiler.Atoms.Test))
            {
                if (this.type == ConditionType.ConditionOtherwise)
                {
                    return(false);
                }
                this.testKey = compiler.AddBooleanQuery(value);
            }
            else
            {
                return(false);
            }

            return(true);
        }
        /*
         * CompileTopLevelElements
         */
        protected void CompileDocument(Compiler compiler, bool inInclude)
        {
            NavigatorInput input = compiler.Input;

            // SkipToElement :
            while (input.NodeType != XPathNodeType.Element)
            {
                if (!compiler.Advance())
                {
                    throw XsltException.Create(Res.Xslt_WrongStylesheetElement);
                }
            }

            Debug.Assert(compiler.Input.NodeType == XPathNodeType.Element);
            if (Keywords.Equals(input.NamespaceURI, input.Atoms.XsltNamespace))
            {
                if (
                    !Keywords.Equals(input.LocalName, input.Atoms.Stylesheet) &&
                    !Keywords.Equals(input.LocalName, input.Atoms.Transform)
                    )
                {
                    throw XsltException.Create(Res.Xslt_WrongStylesheetElement);
                }
                compiler.PushNamespaceScope();
                CompileStylesheetAttributes(compiler);
                CompileTopLevelElements(compiler);
                if (!inInclude)
                {
                    CompileImports(compiler);
                }
            }
            else
            {
                // single template
                compiler.PushLiteralScope();
                CompileSingleTemplate(compiler);
            }

            compiler.PopScope();
        }