private void CompileLiteral(Compiler compiler) { NavigatorInput input = compiler.Input; switch (input.NodeType) { case XPathNodeType.Element: this.AddEvent(compiler.CreateBeginEvent()); CompileLiteralAttributesAndNamespaces(compiler); if (compiler.Recurse()) { CompileTemplate(compiler); compiler.ToParent(); } this.AddEvent(new EndEvent(XPathNodeType.Element)); break; case XPathNodeType.Text: case XPathNodeType.SignificantWhitespace: this.AddEvent(compiler.CreateTextEvent()); break; case XPathNodeType.Whitespace: case XPathNodeType.ProcessingInstruction: case XPathNodeType.Comment: break; default: Debug.Fail("Unexpected node type."); break; } }
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(); } }
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(); } }
void CompileLiteral(Compiler compiler) { NavigatorInput input = compiler.Input; switch (input.NodeType) { case XPathNodeType.Element: this.AddEvent(compiler.CreateBeginEvent()); CompileLiteralAttributesAndNamespaces(compiler); if (compiler.Recurse()) { CompileTemplate(compiler); compiler.ToParent(); } this.AddEvent(new EndEvent(XPathNodeType.Element)); break; case XPathNodeType.Text: case XPathNodeType.SignificantWhitespace: this.AddEvent(compiler.CreateTextEvent()); break; case XPathNodeType.Whitespace: case XPathNodeType.ProcessingInstruction: case XPathNodeType.Comment: break; default: Debug.Assert(false, "Unexpected node type."); break; } }