Пример #1
0
 public object Evaluate(XslTransformProcessor p)
 {
     if (this.select != null)
     {
         object obj = p.Evaluate(this.select);
         if (obj is XPathNodeIterator)
         {
             ArrayList         arrayList         = new ArrayList();
             XPathNodeIterator xpathNodeIterator = (XPathNodeIterator)obj;
             while (xpathNodeIterator.MoveNext())
             {
                 XPathNavigator xpathNavigator = xpathNodeIterator.Current;
                 arrayList.Add(xpathNavigator.Clone());
             }
             obj = new ListIterator(arrayList, p.XPathContext);
         }
         return(obj);
     }
     if (this.content != null)
     {
         DTMXPathDocumentWriter2 dtmxpathDocumentWriter = new DTMXPathDocumentWriter2(p.Root.NameTable, 200);
         Outputter newOutput = new GenericOutputter(dtmxpathDocumentWriter, p.Outputs, null, true);
         p.PushOutput(newOutput);
         if (p.CurrentNodeset.CurrentPosition == 0)
         {
             p.NodesetMoveNext();
         }
         this.content.Evaluate(p);
         p.PopOutput();
         return(dtmxpathDocumentWriter.CreateDocument().CreateNavigator());
     }
     return(string.Empty);
 }
Пример #2
0
		public virtual string EvaluateAsString (XslTransformProcessor p)
		{
			StringWriter sw = new StringWriter ();
			Outputter outputter = new TextOutputter (sw, true);
			p.PushOutput (outputter);
			Evaluate (p);
			p.PopOutput ();
			outputter.Done ();
			return sw.ToString ();
		}
        public virtual string EvaluateAsString(XslTransformProcessor p)
        {
            StringWriter sw        = new StringWriter();
            Outputter    outputter = new TextOutputter(sw, true);

            p.PushOutput(outputter);
            Evaluate(p);
            p.PopOutput();
            outputter.Done();
            return(sw.ToString());
        }
Пример #4
0
        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)
            {
//				XmlNodeWriter w = new XmlNodeWriter (false);
//				DTMXPathDocumentWriter w = new DTMXPathDocumentWriter (p.CurrentNode.NameTable, 200);
                DTMXPathDocumentWriter2 w = new DTMXPathDocumentWriter2(p.CurrentNode.NameTable, 200);
                Outputter outputter       = new GenericOutputter(w, p.Outputs, null, true);
                p.PushOutput(outputter);
                content.Evaluate(p);
                p.PopOutput();
//				return w.Document.CreateNavigator ().SelectChildren (XPathNodeType.All);
//				return w.CreateDocument ().CreateNavigator ().SelectChildren (XPathNodeType.All);
//				return w.Document.CreateNavigator ();
                return(w.CreateDocument().CreateNavigator());
            }
            else
            {
                return("");
            }
        }
Пример #5
0
		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 "";
			}
		}