示例#1
0
		public BaseIterator SortedSelect (XslTransformProcessor p)
		{
			if (isSorterContextDependent) {
				for (int i = 0; i < sorters.Length; i++)
					if (sorterTemplates [i].IsContextDependent)
						sorters [i] = sorterTemplates [i].ToXPathSorter (p);
			}
			BaseIterator iter = (BaseIterator) p.Select (select);
			p.PushNodeset (iter);
			p.PushForEachContext ();
			ArrayList list = new ArrayList (iter.Count);
			while (iter.MoveNext ()) {
				XPathSortElement item = new XPathSortElement ();
				item.Navigator = iter.Current.Clone ();
				item.Values = new object [sorters.Length];
				for (int i = 0; i < sorters.Length; i++)
					item.Values [i] = sorters [i].Evaluate (iter);
				list.Add (item);
			}
			p.PopForEachContext ();
			p.PopNodeset ();

			sortRunner.CopyFrom (sorters);
			return sortRunner.Sort (list, iter.NamespaceManager);
		}
示例#2
0
        public BaseIterator SortedSelect(XslTransformProcessor p)
        {
            if (isSorterContextDependent)
            {
                for (int i = 0; i < sorters.Length; i++)
                {
                    if (sorterTemplates [i].IsContextDependent)
                    {
                        sorters [i] = sorterTemplates [i].ToXPathSorter(p);
                    }
                }
            }
            BaseIterator iter = (BaseIterator)p.Select(select);

            p.PushNodeset(iter);
            p.PushForEachContext();
            ArrayList list = new ArrayList(iter.Count);

            while (iter.MoveNext())
            {
                XPathSortElement item = new XPathSortElement();
                item.Navigator = iter.Current.Clone();
                item.Values    = new object [sorters.Length];
                for (int i = 0; i < sorters.Length; i++)
                {
                    item.Values [i] = sorters [i].Evaluate(iter);
                }
                list.Add(item);
            }
            p.PopForEachContext();
            p.PopNodeset();

            sortRunner.CopyFrom(sorters);
            return(sortRunner.Sort(list, iter.NamespaceManager));
        }
        public BaseIterator SortedSelect(XslTransformProcessor p)
        {
            if (this.isSorterContextDependent)
            {
                for (int i = 0; i < this.sorters.Length; i++)
                {
                    if (this.sorterTemplates[i].IsContextDependent)
                    {
                        this.sorters[i] = this.sorterTemplates[i].ToXPathSorter(p);
                    }
                }
            }
            BaseIterator baseIterator = (BaseIterator)p.Select(this.select);

            p.PushNodeset(baseIterator);
            p.PushForEachContext();
            ArrayList arrayList = new ArrayList(baseIterator.Count);

            while (baseIterator.MoveNext())
            {
                XPathSortElement xpathSortElement = new XPathSortElement();
                xpathSortElement.Navigator = baseIterator.Current.Clone();
                xpathSortElement.Values    = new object[this.sorters.Length];
                for (int j = 0; j < this.sorters.Length; j++)
                {
                    xpathSortElement.Values[j] = this.sorters[j].Evaluate(baseIterator);
                }
                arrayList.Add(xpathSortElement);
            }
            p.PopForEachContext();
            p.PopNodeset();
            this.sortRunner.CopyFrom(this.sorters);
            return(this.sortRunner.Sort(arrayList, baseIterator.NamespaceManager));
        }