System.Xml.Xsl.Xslt.XsltLoader.LoadRealStylesheet C# (CSharp) Method

LoadRealStylesheet() private method

private LoadRealStylesheet ( ) : void
return void
        private void LoadRealStylesheet()
        {
            Debug.Assert(_input.IsXsltNamespace() && (_input.IsKeyword(_atoms.Stylesheet) || _input.IsKeyword(_atoms.Transform)));
            ContextInfo ctxInfo = _input.GetAttributes(_stylesheetAttributes);

            ParseValidationAttribute(2, /*defVal:*/true);
            ParseInputTypeAnnotationsAttribute(3);

            QName parentName = _input.ElementName;
            if (_input.MoveToFirstChild())
            {
                bool atTop = true;
                do
                {
                    bool isImport = false;
                    switch (_input.NodeType)
                    {
                        case XmlNodeType.Element:
                            if (_input.IsXsltNamespace())
                            {
                                if (_input.IsKeyword(_atoms.Import))
                                {
                                    if (!atTop)
                                    {
                                        ReportError(/*[XT0200]*/SR.Xslt_NotAtTop, _input.QualifiedName, parentName);
                                        _input.SkipNode();
                                    }
                                    else
                                    {
                                        isImport = true;
                                        LoadImport();
                                    }
                                }
                                else if (_input.IsKeyword(_atoms.Include))
                                {
                                    LoadInclude();
                                }
                                else if (_input.IsKeyword(_atoms.StripSpace))
                                {
                                    LoadStripSpace(ctxInfo.nsList);
                                }
                                else if (_input.IsKeyword(_atoms.PreserveSpace))
                                {
                                    LoadPreserveSpace(ctxInfo.nsList);
                                }
                                else if (_input.IsKeyword(_atoms.Output))
                                {
                                    LoadOutput();
                                }
                                else if (_input.IsKeyword(_atoms.Key))
                                {
                                    LoadKey(ctxInfo.nsList);
                                }
                                else if (_input.IsKeyword(_atoms.DecimalFormat))
                                {
                                    LoadDecimalFormat(ctxInfo.nsList);
                                }
                                else if (_input.IsKeyword(_atoms.NamespaceAlias))
                                {
                                    LoadNamespaceAlias(ctxInfo.nsList);
                                }
                                else if (_input.IsKeyword(_atoms.AttributeSet))
                                {
                                    LoadAttributeSet(ctxInfo.nsList);
                                }
                                else if (_input.IsKeyword(_atoms.Variable))
                                {
                                    LoadGlobalVariableOrParameter(ctxInfo.nsList, XslNodeType.Variable);
                                }
                                else if (_input.IsKeyword(_atoms.Param))
                                {
                                    LoadGlobalVariableOrParameter(ctxInfo.nsList, XslNodeType.Param);
                                }
                                else if (_input.IsKeyword(_atoms.Template))
                                {
                                    LoadTemplate(ctxInfo.nsList);
#if XSLT2
                            } else if (V2 && input.IsKeyword(atoms.CharacterMap)) {
                                LoadCharacterMap(ctxInfo.nsList);
                            } else if (V2 && input.IsKeyword(atoms.Function)) {
                                LoadFunction(ctxInfo.nsList);
                            } else if (V2 && input.IsKeyword(atoms.ImportSchema)) {
                                LoadImportSchema();
#endif
                                }
                                else
                                {
                                    _input.GetVersionAttribute();
                                    if (!_input.ForwardCompatibility)
                                    {
                                        ReportError(/*[XT_003]*/SR.Xslt_UnexpectedElement, _input.QualifiedName, parentName);
                                    }
                                    _input.SkipNode();
                                }
                            }
                            else if (_input.IsNs(_atoms.UrnMsxsl) && _input.IsKeyword(_atoms.Script))
                            {
                                LoadMsScript(ctxInfo.nsList);
                            }
                            else
                            {
                                if (_input.IsNullNamespace())
                                {
                                    ReportError(/*[XT0130]*/SR.Xslt_NullNsAtTopLevel, _input.LocalName);
                                }
                                // Ignoring non-recognized namespace per XSLT spec 2.2
                                _input.SkipNode();
                            }
                            atTop = isImport;
                            break;

                        case XmlNodeType.Whitespace:
                        case XmlNodeType.SignificantWhitespace:
                            break;
                        default:
                            Debug.Assert(_input.NodeType == XmlNodeType.Text);
                            ReportError(/*[XT0120]*/SR.Xslt_TextNodesNotAllowed, parentName);
                            break;
                    }
                } while (_input.MoveToNextSibling());
            }
        }