System.Xml.Xsl.XsltOld.CopyOfAction.Execute C# (CSharp) Method

Execute() private method

private Execute ( Processor processor, ActionFrame frame ) : void
processor Processor
frame ActionFrame
return void
        internal override void Execute(Processor processor, ActionFrame frame) {
            Debug.Assert(processor != null && frame != null);

            switch (frame.State) {
            case Initialized:
                Debug.Assert(frame.NodeSet != null);
                Query query = processor.GetValueQuery(this.selectKey);
                object result = query.Evaluate(frame.NodeSet);

                if (result is XPathNodeIterator) {
                    processor.PushActionFrame(CopyNodeSetAction.GetAction(), new XPathArrayIterator(query));
                    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;
            }
        }
    }