public object Evaluate (XslTransformProcessor p) { if (select != null) { object o = p.Evaluate (select); // To resolve variable references correctly, we // have to collect all the target nodes here. // (otherwise, variables might be resolved with // different level of variable stack in // XslTransformProcessor). if (o is XPathNodeIterator) { ArrayList al = new ArrayList (); XPathNodeIterator iter = (XPathNodeIterator) o; while (iter.MoveNext ()) al.Add (iter.Current.Clone ()); o = new ListIterator (al, p.XPathContext); } return o; } else if (content != null) { DTMXPathDocumentWriter2 w = new DTMXPathDocumentWriter2 (p.Root.NameTable, 200); Outputter outputter = new GenericOutputter(w, p.Outputs, null, true); p.PushOutput (outputter); if (p.CurrentNodeset.CurrentPosition == 0) p.NodesetMoveNext (); content.Evaluate (p); p.PopOutput (); return w.CreateDocument ().CreateNavigator (); } else { return ""; } }
// Invoked from XsltKey (XPathFunction) public BaseIterator Evaluate (BaseIterator iter, Expression valueExpr) { XPathNodeIterator i = iter; if (iter.CurrentPosition == 0) { i = iter.Clone (); i.MoveNext (); } XPathNavigator nav = i.Current; object o = valueExpr.Evaluate (iter); XPathNodeIterator it = o as XPathNodeIterator; XsltContext ctx = iter.NamespaceManager as XsltContext; BaseIterator result = null; if (it != null) { while (it.MoveNext()) { ArrayList nodes = GetNodesByValue ( nav, it.Current.Value, ctx); if (nodes == null) continue; ListIterator tmp = new ListIterator (nodes, ctx); if (result == null) result = tmp; else result = new UnionIterator ( iter, result, tmp); } } else if (nav != null) { ArrayList nodes = GetNodesByValue ( nav, XPathFunctions.ToString (o), ctx); if (nodes != null) result = new ListIterator (nodes, ctx); } return result != null ? result : new NullIterator (iter); }
private ListIterator (ListIterator other) : base (other) { _list = other._list; }
private ListIterator(ListIterator other) : base(other) { this._list = other._list; }