internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: if (processor.BeginEvent(XPathNodeType.Comment, string.Empty, string.Empty, string.Empty, false) == false) { // Come back later break; } processor.PushActionFrame(frame); frame.State = ProcessingChildren; break; // Allow children to run case ProcessingChildren: if (processor.EndEvent(XPathNodeType.Comment) == false) { Debug.WriteLine("Cannot end event, breaking, will restart"); break; } frame.Finished(); break; default: Debug.Fail("Invalid IfAction execution state"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: if (this.type == ConditionType.ConditionIf || this.type == ConditionType.ConditionWhen) { Debug.Assert(this.testKey != Compiler.InvalidQueryKey); bool value = processor.EvaluateBoolean(frame, this.testKey); if (value == false) { frame.Finished(); break; } } processor.PushActionFrame(frame); frame.State = ProcessingChildren; break; // Allow children to run case ProcessingChildren: if (this.type == ConditionType.ConditionWhen ||this.type == ConditionType.ConditionOtherwise) { Debug.Assert(frame.Container != null); frame.Exit(); } frame.Finished(); break; default: Debug.Fail("Invalid IfAction execution state"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { switch (frame.State) { case Initialized: frame.Counter = 0; frame.State = ProcessingSets; goto case ProcessingSets; case ProcessingSets: if (frame.Counter < this.useAttributeSets.Length) { AttributeSetAction action = processor.RootAction.GetAttributeSet(this.useAttributeSets[frame.Counter]); frame.IncrementCounter(); processor.PushActionFrame(action, frame.NodeSet); } else { frame.Finished(); } break; default: Debug.Fail("Invalid Container action execution state"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); object ParamValue; switch(frame.State) { case Initialized: if (this.selectKey != Compiler.InvalidQueryKey) { ParamValue = processor.RunQuery(frame, this.selectKey); processor.SetParameter(this.name, ParamValue); frame.Finished(); } else { if (this.containedActions == null) { processor.SetParameter(this.name, String.Empty); frame.Finished(); break; } NavigatorOutput output = new NavigatorOutput(); processor.PushOutput(output); processor.PushActionFrame(frame); frame.State = ProcessingChildren; } break; case ProcessingChildren: RecordOutput recOutput = processor.PopOutput(); Debug.Assert(recOutput is NavigatorOutput); processor.SetParameter(this.name,((NavigatorOutput)recOutput).Navigator); frame.Finished(); break; default: Debug.Fail("Invalid execution state inside VariableAction.Execute"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: if (!fallback) { throw XsltException.UnexpectedKeyword(this.name, this.parent); } if (this.containedActions != null && this.containedActions.Count > 0) { processor.PushActionFrame(frame); frame.State = ProcessingChildren; break; } else { goto case ProcessingChildren; } case ProcessingChildren: frame.Finished(); break; default: Debug.Fail("Invalid Container action execution state"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: TextOnlyOutput output = new TextOnlyOutput(processor, new StringWriter()); processor.PushOutput(output); processor.PushActionFrame(frame); frame.State = ProcessingChildren; break; case ProcessingChildren: TextOnlyOutput recOutput = processor.PopOutput() as TextOnlyOutput; Debug.Assert(recOutput != null); Console.WriteLine(recOutput.Writer.ToString()); if (_Terminate) { throw new XsltException(Res.Xslt_Terminate, recOutput.Writer.ToString()); } frame.Finished(); break; default: Debug.Fail("Invalid MessageAction execution state"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: if (this.containedActions != null && this.containedActions.Count > 0) { processor.PushActionFrame(frame); frame.State = ProcessingChildren; } else { frame.Finished(); } break; // Allow children to run case ProcessingChildren: frame.Finished(); break; default: Debug.Fail("Invalid Container action execution state"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: Debug.Assert(frame.NodeSet != null); Debug.Assert(this.selectKey != Compiler.InvalidQueryKey); XPathExpression expr = processor.GetValueQuery(this.selectKey); object result = frame.Node.Evaluate(expr); XPathNodeIterator nodeSet = result as XPathNodeIterator; if (nodeSet != null) { processor.PushActionFrame(CopyNodeSetAction.GetAction(), nodeSet); frame.State = NodeSetCopied; break; } XPathNavigator nav = result as XPathNavigator; if (nav != null) { processor.PushActionFrame(CopyNodeSetAction.GetAction(), new XPathSingletonIterator(nav)); frame.State = NodeSetCopied; break; } string value = XmlConvert.ToXPathString(result); if (processor.TextEvent(value)) { frame.Finished(); } else { frame.StoredOutput = value; frame.State = ResultStored; } break; case ResultStored: Debug.Assert(frame.StoredOutput != null); processor.TextEvent(frame.StoredOutput); frame.Finished(); break; case NodeSetCopied: Debug.Assert(frame.State == NodeSetCopied); frame.Finished(); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: if (this.qname != null) { frame.CalulatedName = this.qname; } else { frame.CalulatedName = CreateElementQName( this.nameAvt == null ? this.name : this.nameAvt.Evaluate(processor, frame), this.nsAvt == null ? this.nsUri : this.nsAvt.Evaluate(processor, frame), this.manager ); } goto case NameDone; case NameDone: { PrefixQName qname = frame.CalulatedName; if (processor.BeginEvent(XPathNodeType.Element, qname.Prefix, qname.Name, qname.Namespace, this.empty) == false) { // Come back later frame.State = NameDone; break; } if (!this.empty) { processor.PushActionFrame(frame); frame.State = ProcessingChildren; break; // Allow children to run } else { goto case ProcessingChildren; } } case ProcessingChildren: if (processor.EndEvent(XPathNodeType.Element) == false) { Debug.WriteLine("Cannot end event, breaking, will restart"); frame.State = ProcessingChildren; break; } frame.Finished(); break; default: Debug.Fail("Invalid ElementAction execution state"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: if (this.nameAvt == null) { frame.StoredOutput = this.name; if (this.name == null) { // name was static but was bad; frame.Finished(); break; } } else { frame.StoredOutput = this.nameAvt.Evaluate(processor, frame); if (!IsProcessingInstructionName(frame.StoredOutput)) { Debug.WriteLine("Invalid Processing instruction naame: \"" + name + "\""); frame.Finished(); break; } } goto case NameReady; case NameReady: Debug.Assert(frame.StoredOutput != null); if (processor.BeginEvent(XPathNodeType.ProcessingInstruction, string.Empty, frame.StoredOutput, string.Empty, false) == false) { // Come back later frame.State = NameReady; break; } processor.PushActionFrame(frame); frame.State = ProcessingChildren; break; // Allow children to run case ProcessingChildren: if (processor.EndEvent(XPathNodeType.ProcessingInstruction) == false) { Debug.WriteLine("Cannot end event, breaking, will restart"); frame.State = ProcessingChildren; break; } frame.Finished(); break; default: Debug.Fail("Invalid ElementAction execution state"); frame.Finished(); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: object value = processor.GetGlobalParameter(this.name); if (value != null) { frame.SetVariable(this.varKey, value); frame.Finished(); break; } if (this.varType == VariableType.LocalParameter) { if ((value = processor.GetParameter(this.name)) != null) { frame.SetVariable(this.varKey, value); frame.Finished(); break; } } if (this.selectKey != Compiler.InvalidQueryKey) { value = processor.RunQuery(frame, this.selectKey); frame.SetVariable(this.varKey, value); frame.Finished(); } else { if (this.containedActions == null) { frame.SetVariable(this.varKey, ""); frame.Finished(); break; } NavigatorOutput output = new NavigatorOutput(); processor.PushOutput(output); processor.PushActionFrame(frame); frame.State = ProcessingChildren; } break; case ProcessingChildren: RecordOutput recOutput = processor.PopOutput(); Debug.Assert(recOutput is NavigatorOutput); frame.SetVariable(this.varKey, ((NavigatorOutput)recOutput).Navigator); frame.Finished(); break; default: Debug.Fail("Invalid execution state inside VariableAction.Execute"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: if (sort) { processor.InitSortArray(); processor.PushActionFrame(sortContainer, frame.NodeSet); frame.State = ProcessedSort; break; } goto case ProcessedSort; case ProcessedSort: if (this.selectKey == Compiler.InvalidQueryKey) { throw new XsltException(Res.Xslt_InvalidXPath, new string[] { select }); } if (sort) { frame.InitNewNodeSet(processor.StartQuery(frame.Node, this.selectKey, processor.SortArray)); } else { frame.InitNewNodeSet(processor.StartQuery(frame.Node, this.selectKey)); } frame.State = ProcessNextNode; goto case ProcessNextNode; case ProcessNextNode: Debug.Assert(frame.State == ProcessNextNode); Debug.Assert(frame.NewNodeSet != null); Debug.WriteLine("Processing next Node"); if (frame.NewNextNode(processor)) { Debug.WriteLine("Node found"); frame.State = PositionAdvanced; goto case PositionAdvanced; } else { Debug.WriteLine("Node not found, finished "); frame.Finished(); break; } case PositionAdvanced: processor.PushActionFrame(frame, frame.NewNodeSet); frame.State = ContentsProcessed; break; case ContentsProcessed: frame.State = ProcessNextNode; goto case ProcessNextNode; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: processor.ResetParams(); if (this.containedActions != null && this.containedActions.Count > 0) { processor.PushActionFrame(frame); frame.State = ProcessedChildren; break; } goto case ProcessedChildren; case ProcessedChildren: TemplateAction action = processor.Stylesheet.FindTemplate(this.name); if (action != null) { frame.State = ProcessedTemplate; processor.PushActionFrame(action, frame.NodeSet); break; } else { throw new XsltException(Res.Xslt_InvalidCallTemplate, this.name.ToString()); } case ProcessedTemplate: frame.Finished(); break; default: Debug.Fail("Invalid CallTemplateAction execution state"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: frame.AllocateVariables(variableCount); frame.InitNodeSet(processor.StartQuery(processor.Document, Compiler.RootQueryKey)); if (this.containedActions != null && this.containedActions.Count > 0) { processor.PushActionFrame(frame); } frame.State = QueryInitialized; break; case QueryInitialized: Debug.Assert(frame.State == QueryInitialized); frame.NextNode(processor); Debug.Assert(Processor.IsRoot(frame.Node)); if (processor.Debugger != null) { // this is like apply-templates, but we don't have it on stack. // Pop the stack, otherwise last instruction will be on it. processor.PopDebuggerStack(); } processor.PushTemplateLookup(frame.NodeSet, /*mode:*/ null, /*importsOf:*/ null); frame.State = RootProcessed; break; case RootProcessed: Debug.Assert(frame.State == RootProcessed); frame.Finished(); break; default: Debug.Fail("Invalid RootAction execution state"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); object ParamValue; switch (frame.State) { case Initialized: if (this.selectKey != Compiler.InvalidQueryKey) { ParamValue = processor.RunQuery(frame, this.selectKey); processor.SetParameter(this.name, ParamValue); frame.Finished(); } else { if (this.containedActions == null) { processor.SetParameter(this.name, String.Empty); frame.Finished(); break; } NavigatorOutput output = new NavigatorOutput(); processor.PushOutput(output); processor.PushActionFrame(frame); frame.State = ProcessingChildren; } break; case ProcessingChildren: RecordOutput recOutput = processor.PopOutput(); Debug.Assert(recOutput is NavigatorOutput); processor.SetParameter(this.name, ((NavigatorOutput)recOutput).Navigator); frame.Finished(); break; default: Debug.Fail("Invalid execution state inside VariableAction.Execute"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { switch(frame.State) { case Initialized: frame.Counter = 0; frame.State = ProcessingSets; goto case ProcessingSets; case ProcessingSets: if (frame.Counter < this.useAttributeSets.Length) { AttributeSetAction action = processor.RootAction.GetAttributeSet(this.useAttributeSets[frame.Counter]); frame.IncrementCounter(); processor.PushActionFrame(action, frame.NodeSet); } else { frame.Finished(); } break; default: Debug.Fail("Invalid Container action execution state"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: if (!fallback) { throw XsltException.UnexpectedKeyword(this.name, this.parent); } if (this.containedActions != null && this.containedActions.Count > 0) { processor.PushActionFrame(frame); frame.State = ProcessingChildren; break; } else goto case ProcessingChildren; case ProcessingChildren: frame.Finished(); break; default: Debug.Fail("Invalid Container action execution state"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: if (this.type == ConditionType.ConditionIf || this.type == ConditionType.ConditionWhen) { Debug.Assert(this.testKey != Compiler.InvalidQueryKey); bool value = processor.EvaluateBoolean(frame, this.testKey); if (value == false) { frame.Finished(); break; } } processor.PushActionFrame(frame); frame.State = ProcessingChildren; break; // Allow children to run case ProcessingChildren: if (this.type == ConditionType.ConditionWhen || this.type == ConditionType.ConditionOtherwise) { Debug.Assert(frame.Container != null); frame.Exit(); } frame.Finished(); break; default: Debug.Fail("Invalid IfAction execution state"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); while (processor.CanContinue) { switch (frame.State) { case Initialized: if (frame.NextNode(processor)) { Debug.WriteLine("Next node to copy found"); Debug.WriteLine(frame.Node.Name); frame.State = BeginEvent; goto case BeginEvent; } else { frame.Finished(); break; } case BeginEvent: Debug.Assert(frame.State == BeginEvent); if (SendBeginEvent(processor, frame.Node) == false) { // This one wasn't output break; } frame.State = Contents; continue; case Contents: Debug.Assert(frame.State == Contents); XPathNodeType nodeType = frame.Node.NodeType; if (nodeType == XPathNodeType.Element || nodeType == XPathNodeType.Root) { processor.PushActionFrame(CopyAttributesAction.GetAction(), frame.NodeSet); frame.State = Attributes; break; } if (SendTextEvent(processor, frame.Node) == false) { // This one wasn't output break; } frame.State = EndEvent; continue; case Attributes: processor.PushActionFrame(CopyNamespacesAction.GetAction(), frame.NodeSet); frame.State = Namespaces; break; case Namespaces: if (frame.Node.HasChildren) { processor.PushActionFrame(GetAction(), frame.Node.SelectChildren(XPathNodeType.All)); frame.State = Subtree; break; } frame.State = EndEvent; goto case EndEvent; case Subtree: //frame.Node.MoveToParent(); frame.State = EndEvent; continue; case EndEvent: Debug.Assert(frame.State == EndEvent); if (SendEndEvent(processor, frame.Node) == false) { // This one wasn't output break; } frame.State = Initialized; continue; } break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: frame.AllocateVariables(variableCount); frame.InitNodeSet(processor.StartQuery(processor.Document, Compiler.RootQueryKey)); if (this.containedActions != null && this.containedActions.Count > 0) { processor.PushActionFrame(frame); } frame.State = QueryInitialized; break; case QueryInitialized: Debug.Assert(frame.State == QueryInitialized); frame.NextNode(processor); Debug.Assert(Processor.IsRoot(frame.Node)); if (processor.Debugger != null) { // this is like apply-templates, but we don't have it on stack. // Pop the stack, otherwise last instruction will be on it. processor.PopDebuggerStack(); } processor.PushTemplateLookup(frame.NodeSet, /*mode:*/null, /*importsOf:*/null); frame.State = RootProcessed; break; case RootProcessed: Debug.Assert(frame.State == RootProcessed); frame.Finished(); break; default: Debug.Fail("Invalid RootAction execution state"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: if(this.nameAvt == null) { frame.StoredOutput = this.name; if(this.name == null) { // name was static but was bad; frame.Finished(); break; } } else { frame.StoredOutput = this.nameAvt.Evaluate(processor, frame); if (! IsProcessingInstructionName(frame.StoredOutput)) { Debug.WriteLine("Invalid Processing instruction naame: \"" + name + "\""); frame.Finished(); break; } } goto case NameReady; case NameReady: Debug.Assert(frame.StoredOutput != null); if (processor.BeginEvent(XPathNodeType.ProcessingInstruction, string.Empty, frame.StoredOutput, string.Empty, false) == false) { // Come back later frame.State = NameReady; break; } processor.PushActionFrame(frame); frame.State = ProcessingChildren; break; // Allow children to run case ProcessingChildren: if (processor.EndEvent(XPathNodeType.ProcessingInstruction) == false) { Debug.WriteLine("Cannot end event, breaking, will restart"); frame.State = ProcessingChildren; break; } frame.Finished(); break; default: Debug.Fail("Invalid ElementAction execution state"); frame.Finished(); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); while (processor.CanContinue) { switch (frame.State) { case Initialized: if (Processor.IsRoot(frame.Node)) { processor.PushActionFrame(frame); frame.State = ChildrenOnly; break; } if (processor.CopyBeginEvent(frame.Node, this.empty) == false) { // This event wasn't processed break; } frame.State = NamespaceCopy; continue; case NamespaceCopy: frame.State = ContentsCopy; if ( frame.Node.NodeType == XPathNodeType.Element ) { processor.PushActionFrame(CopyNamespacesAction.GetAction(), frame.NodeSet); break; } continue; case ContentsCopy: if (frame.Node.NodeType == XPathNodeType.Element && !this.empty) { //Debug.Assert(frame.Node.HasValue == false); processor.PushActionFrame(frame); frame.State = ProcessChildren; break; } else { if (processor.CopyTextEvent(frame.Node)) { frame.State = ProcessChildren; continue; } else { // This event wasn't processed break; } } case ProcessChildren: if (processor.CopyEndEvent(frame.Node)) { frame.Finished(); } break; case ChildrenOnly: frame.Finished(); break; default: Debug.Fail("Invalid CopyAction execution state"); break; } break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); while (processor.CanContinue) { switch (frame.State) { case Initialized: if (Processor.IsRoot(frame.Node)) { processor.PushActionFrame(frame); frame.State = ChildrenOnly; break; } if (processor.CopyBeginEvent(frame.Node, this.empty) == false) { // This event wasn't processed break; } frame.State = NamespaceCopy; continue; case NamespaceCopy: frame.State = ContentsCopy; if (frame.Node.NodeType == XPathNodeType.Element) { processor.PushActionFrame(CopyNamespacesAction.GetAction(), frame.NodeSet); break; } continue; case ContentsCopy: if (frame.Node.NodeType == XPathNodeType.Element && !this.empty) { //Debug.Assert(frame.Node.HasValue == false); processor.PushActionFrame(frame); frame.State = ProcessChildren; break; } else { if (processor.CopyTextEvent(frame.Node)) { frame.State = ProcessChildren; continue; } else { // This event wasn't processed break; } } case ProcessChildren: if (processor.CopyEndEvent(frame.Node)) { frame.Finished(); } break; case ChildrenOnly: frame.Finished(); break; default: Debug.Fail("Invalid CopyAction execution state"); break; } break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: processor.ResetParams(); processor.InitSortArray(); if (this.containedActions != null && this.containedActions.Count > 0) { processor.PushActionFrame(frame); frame.State = ProcessedChildren; break; } goto case ProcessedChildren; case ProcessedChildren: if (this.selectKey == Compiler.InvalidQueryKey) { Debug.Assert(this.select == null); if (!frame.Node.HasChildren) { frame.Finished(); break; } frame.InitNewNodeSet(frame.Node.SelectChildren(XPathNodeType.All)); } else { frame.InitNewNodeSet(processor.StartQuery(frame.Node, this.selectKey)); } if (processor.SortArray.Count != 0) { frame.SortNewNodeSet(processor, processor.SortArray); } frame.State = ProcessNextNode; goto case ProcessNextNode; case ProcessNextNode: Debug.Assert(frame.State == ProcessNextNode); Debug.Assert(frame.NewNodeSet != null); if (frame.NewNextNode(processor)) { frame.State = PositionAdvanced; goto case PositionAdvanced; } else { frame.Finished(); break; } case PositionAdvanced: Debug.Assert(frame.State == PositionAdvanced); processor.PushTemplateLookup(frame.NewNodeSet, this.mode, /*importsOf:*/ null); frame.State = TemplateProcessed; break; case TemplateProcessed: frame.State = ProcessNextNode; goto case ProcessNextNode; default: Debug.Fail("Invalid ApplyTemplatesAction execution state"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: processor.ResetParams(); processor.InitSortArray(); if (this.containedActions != null && this.containedActions.Count > 0) { processor.PushActionFrame(frame); frame.State = ProcessedChildren; break; } goto case ProcessedChildren; case ProcessedChildren: if (this.selectKey == Compiler.InvalidQueryKey) { Debug.Assert(this.select == null); if (frame.Node.HasChildren) { frame.InitNewNodeSet(frame.Node.SelectChildren(XPathNodeType.All)); } else { frame.Finished(); break; } } else { if (this.sort) { frame.InitNewNodeSet(processor.StartQuery(frame.Node, this.selectKey, processor.SortArray)); } else { frame.InitNewNodeSet(processor.StartQuery(frame.Node, this.selectKey)); } } frame.State = ProcessNextNode; goto case ProcessNextNode; case ProcessNextNode: Debug.Assert(frame.State == ProcessNextNode); Debug.Assert(frame.NewNodeSet != null); if (frame.NewNextNode(processor)) { frame.State = PositionAdvanced; goto case PositionAdvanced; } else { frame.Finished(); break; } case PositionAdvanced: Debug.Assert(frame.State == PositionAdvanced); processor.PushTemplateLookup(frame.NewNodeSet, this.mode, /*importsOf:*/null); frame.State = TemplateProcessed; break; case TemplateProcessed: frame.State = ProcessNextNode; goto case ProcessNextNode; default: Debug.Fail("Invalid ApplyTemplatesAction execution state"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch(frame.State) { case Initialized : processor.ResetParams(); if (this.containedActions != null && this.containedActions.Count > 0) { processor.PushActionFrame(frame); frame.State = ProcessedChildren; break; } goto case ProcessedChildren; case ProcessedChildren: TemplateAction action = processor.Stylesheet.FindTemplate(this.name); if (action != null) { frame.State = ProcessedTemplate; processor.PushActionFrame(action, frame.NodeSet); break; } else { throw new XsltException(Res.Xslt_InvalidCallTemplate, this.name.ToString()); } case ProcessedTemplate: frame.Finished(); break; default: Debug.Fail("Invalid CallTemplateAction execution state"); break; } }
// // Execution // internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: if (this.variableCount > 0) { frame.AllocateVariables(this.variableCount); } if (this.containedActions != null && this.containedActions.Count > 0) { processor.PushActionFrame(frame); frame.State = ProcessingChildren; } else { frame.Finished(); } break; // Allow children to run case ProcessingChildren: frame.Finished(); break; default: Debug.Fail("Invalid Container action execution state"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch(frame.State) { case Initialized: object value = processor.GetGlobalParameter(this.name); if (value != null) { frame.SetVariable(this.varKey, value); frame.Finished(); break; } if (this.varType == VariableType.LocalParameter) if ((value = processor.GetParameter(this.name)) != null) { frame.SetVariable(this.varKey, value); frame.Finished(); break; } if (this.selectKey != Compiler.InvalidQueryKey) { value = processor.RunQuery(frame, this.selectKey); frame.SetVariable(this.varKey, value); frame.Finished(); } else { if (this.containedActions == null){ frame.SetVariable(this.varKey, ""); frame.Finished(); break; } NavigatorOutput output = new NavigatorOutput(); processor.PushOutput(output); processor.PushActionFrame(frame); frame.State = ProcessingChildren; } break; case ProcessingChildren: RecordOutput recOutput = processor.PopOutput(); Debug.Assert(recOutput is NavigatorOutput); frame.SetVariable(this.varKey, ((NavigatorOutput)recOutput).Navigator); frame.Finished(); break; default: Debug.Fail("Invalid execution state inside VariableAction.Execute"); break; } }
internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: if(this.qname != null) { frame.CalulatedName = this.qname; } else { frame.CalulatedName = CreateElementQName( this.nameAvt == null ? this.name : this.nameAvt.Evaluate(processor, frame), this.nsAvt == null ? this.nsUri : this.nsAvt .Evaluate(processor, frame), this.manager ); } goto case NameDone; case NameDone: { PrefixQName qname = frame.CalulatedName; if (processor.BeginEvent(XPathNodeType.Element, qname.Prefix, qname.Name, qname.Namespace, this.empty) == false) { // Come back later frame.State = NameDone; break; } if (! this.empty) { processor.PushActionFrame(frame); frame.State = ProcessingChildren; break; // Allow children to run } else { goto case ProcessingChildren; } } case ProcessingChildren: if (processor.EndEvent(XPathNodeType.Element) == false) { Debug.WriteLine("Cannot end event, breaking, will restart"); frame.State = ProcessingChildren; break; } frame.Finished(); break; default: Debug.Fail("Invalid ElementAction execution state"); break; } }