private void CompileLiteralAttributesAndNamespaces(Compiler compiler) { NavigatorInput input = compiler.Input; if (input.Navigator.MoveToAttribute("use-attribute-sets", input.Atoms.UriXsl)) { AddAction(compiler.CreateUseAttributeSetsAction()); input.Navigator.MoveToParent(); } compiler.InsertExcludedNamespace(); if (input.MoveToFirstNamespace()) { do { string uri = input.Value; if (uri == XmlReservedNs.NsXslt) { 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 (Ref.Equal(input.NamespaceURI, input.Atoms.UriXsl)) { 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 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); } }
void CompileLiteralAttributesAndNamespaces(Compiler compiler) { NavigatorInput input = compiler.Input; if (input.Navigator.MoveToAttribute("use-attribute-sets", input.Atoms.UriXsl)) { AddAction(compiler.CreateUseAttributeSetsAction()); input.Navigator.MoveToParent(); } compiler.InsertExcludedNamespace(); if (input.MoveToFirstNamespace()) { do { string uri = input.Value; if (uri == XmlReservedNs.NsXslt) { 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 (Ref.Equal(input.NamespaceURI, input.Atoms.UriXsl)) { 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(); } }