System.Xml.Xsl.XsltOld.ContainerAction.CompileStylesheetAttributes C# (CSharp) Method

CompileStylesheetAttributes() private method

private CompileStylesheetAttributes ( Compiler compiler ) : void
compiler Compiler
return void
        internal void CompileStylesheetAttributes(Compiler compiler) {
            NavigatorInput input        = compiler.Input;
            string         element      = input.LocalName;
            string         badAttribute = null;
            string         version      = 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.Version)) {
                        version = input.Value;
                        if (1 <= XmlConvert.ToXPathDouble(version)) {
                            compiler.ForwardCompatibility = (version != Keywords.s_Version10);
                        }
                        else {
                            // XmlConvert.ToXPathDouble(version) an be NaN!
                            if (! compiler.ForwardCompatibility) {
                                throw XsltException.Create(Res.Xslt_InvalidAttrValue, Keywords.s_Version, version);
                            }
                        }
                    }
                    else if (Keywords.Equals(name, input.Atoms.ExtensionElementPrefixes)) {
                        compiler.InsertExtensionNamespace(input.Value);
                    }
                    else if (Keywords.Equals(name, input.Atoms.ExcludeResultPrefixes)) {
                        compiler.InsertExcludedNamespace(input.Value);
                    }
                    else if (Keywords.Equals(name, input.Atoms.Id)) {
                        // Do nothing here.
                    }
                    else {
                        // We can have version atribute later. For now remember this attribute and continue
                        badAttribute = name;
                    }
                }
                while( input.MoveToNextAttribute());
                input.ToParent();
            }

            if (version == null) {
                throw XsltException.Create(Res.Xslt_MissingAttribute, Keywords.s_Version);
            }

            if (badAttribute != null && ! compiler.ForwardCompatibility) {
                throw XsltException.Create(Res.Xslt_InvalidAttribute, badAttribute, element);
            }
        }