コード例 #1
0
ファイル: XslVariable.cs プロジェクト: nobled/mono
		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 "";
			}
		}
コード例 #2
0
		// 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);
		}
コード例 #3
0
ファイル: Iterator.cs プロジェクト: cyplo/mono
		private ListIterator (ListIterator other) : base (other)
		{
			_list = other._list;
		}
コード例 #4
0
 private ListIterator(ListIterator other) : base(other)
 {
     this._list = other._list;
 }