Example #1
0
        private XPathNodeIterator GetDocument(XsltCompiledContext xsltContext, string arg0, string baseUri)
        {
            XPathNodeIterator result;

            try
            {
                Uri            uri = this.Resolve(arg0, (baseUri == null) ? this.doc.BaseURI : baseUri, xsltContext.Processor);
                XPathNavigator xpathNavigator;
                if (uri != null && uri.ToString() == string.Empty)
                {
                    xpathNavigator = this.doc.Clone();
                    xpathNavigator.MoveToRoot();
                }
                else
                {
                    xpathNavigator = xsltContext.Processor.GetDocument(uri);
                }
                result = new SelfIterator(xpathNavigator, xsltContext);
            }
            catch (Exception)
            {
                result = new ListIterator(new ArrayList(), xsltContext);
            }
            return(result);
        }
Example #2
0
		private SelfIterator (SelfIterator other, bool cloneFlag) 
			: base (other, true)
		{
		}
Example #3
0
		public override XPathSequence Evaluate (XPathSequence iter)
		{
			XQueryContext ctx = iter.Context;

			if (iter.Position == 0) {
				iter = iter.Clone ();
				if (!iter.MoveNext ())
					return new XPathEmptySequence (iter.Context);
			}

			XPathNavigator nav = iter.Current as XPathNavigator;
			if (nav == null)
				throw new XmlQueryException ("Node set is expected.");

			NodeIterator argIter = null;

			switch (Axis.AxisType) {
			case XPathAxisType.Child:
				argIter = new ChildIterator (nav, ctx); break;
			case XPathAxisType.Descendant:
				argIter = new DescendantIterator (nav, ctx); break;
			case XPathAxisType.Attribute:
				argIter = new AttributeIterator (nav, ctx); break;
			case XPathAxisType.Self:
				argIter = new SelfIterator (nav, ctx); break;
			case XPathAxisType.DescendantOrSelf:
				argIter = new DescendantOrSelfIterator (nav, ctx); break;
			case XPathAxisType.FollowingSibling:
				argIter = new FollowingSiblingIterator (nav, ctx); break;
			case XPathAxisType.Following:
				argIter = new FollowingIterator (nav, ctx); break;
			case XPathAxisType.Parent:
				argIter = new ParentIterator (nav, ctx); break;
			case XPathAxisType.Ancestor:
				argIter = new AncestorIterator (nav, ctx); break;
			case XPathAxisType.PrecedingSibling:
				argIter = new PrecedingSiblingIterator (nav, ctx); break;
			case XPathAxisType.Preceding:
				argIter = new PrecedingIterator (nav, ctx); break;
			case XPathAxisType.AncestorOrSelf:
				argIter = new AncestorOrSelfIterator (nav, ctx); break;
			case XPathAxisType.Namespace: // only applicable under XPath 2.0: not XQuery 1.0
				argIter = new NamespaceIterator (nav, ctx); break;
			}
			return new AxisIterator (argIter, this);
		}