protected void CompileOnceTemplate(Compiler compiler) { NavigatorInput input = compiler.Input; if (input.NodeType == XPathNodeType.Element) { string nspace = input.NamespaceURI; if (Ref.Equal(nspace, input.Atoms.UriXsl)) { 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); } }
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 (nspace.Length != 0) continue; if (Ref.Equal(name, input.Atoms.Version)) { version = input.Value; if (1 <= XmlConvert.ToXPathDouble(version)) { compiler.ForwardCompatibility = (version != "1.0"); } else { // XmlConvert.ToXPathDouble(version) an be NaN! if (! compiler.ForwardCompatibility) { throw XsltException.Create(Res.Xslt_InvalidAttrValue, "version", version); } } } else if (Ref.Equal(name, input.Atoms.ExtensionElementPrefixes)) { compiler.InsertExtensionNamespace(input.Value); } else if (Ref.Equal(name, input.Atoms.ExcludeResultPrefixes)) { compiler.InsertExcludedNamespace(input.Value); } else if (Ref.Equal(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, "version"); } if (badAttribute != null && ! compiler.ForwardCompatibility) { throw XsltException.Create(Res.Xslt_InvalidAttribute, badAttribute, element); } }
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 (nspace.Length != 0) { continue; } if (Ref.Equal(name, input.Atoms.Version)) { version = input.Value; if (1 <= XmlConvert.ToXPathDouble(version)) { compiler.ForwardCompatibility = (version != "1.0"); } else { // XmlConvert.ToXPathDouble(version) an be NaN! if (!compiler.ForwardCompatibility) { throw XsltException.Create(SR.Xslt_InvalidAttrValue, "version", version); } } } else if (Ref.Equal(name, input.Atoms.ExtensionElementPrefixes)) { compiler.InsertExtensionNamespace(input.Value); } else if (Ref.Equal(name, input.Atoms.ExcludeResultPrefixes)) { compiler.InsertExcludedNamespace(input.Value); } else if (Ref.Equal(name, input.Atoms.Id)) { // Do nothing here. } else { // We can have version attribute later. For now remember this attribute and continue badAttribute = name; } }while (input.MoveToNextAttribute()); input.ToParent(); } if (version == null) { throw XsltException.Create(SR.Xslt_MissingAttribute, "version"); } if (badAttribute != null && !compiler.ForwardCompatibility) { throw XsltException.Create(SR.Xslt_InvalidAttribute, badAttribute, element); } }