예제 #1
0
 /// <summary>
 /// When overridden in a derived class, compares the base Uniform Resource Identifiers (URIs) of two documents based upon the
 /// order the documents were loaded by the XSLT processor (that is, the <see cref="T:System.Xml.Xsl.XslTransform"/> class).
 /// </summary>
 /// <param name="baseUri">The base URI of the first document to compare.</param>
 /// <param name="nextbaseUri">The base URI of the second document to compare.</param>
 /// <returns>
 /// An integer value describing the relative order of the two base URIs: -1 if <paramref name="baseUri"/> occurs before <paramref name="nextbaseUri"/>; 0 if the two base URIs are identical; and 1 if <paramref name="baseUri"/> occurs after <paramref name="nextbaseUri"/>.
 /// </returns>
 public override int CompareDocument(string baseUri, string nextbaseUri)
 {
     return(_baseContext.CompareDocument(baseUri, nextbaseUri));
 }
예제 #2
0
        internal override XPathNavigator advance()
        {
            XPathNavigator res1, res2;
            XmlNodeOrder   order = 0;

            if (advance1)
            {
                res1 = qy1.advance();
            }
            else
            {
                res1 = _last;
            }
            if (advance2)
            {
                res2 = qy2.advance();
            }
            else
            {
                res2 = _last;
            }

            if (res1 != null && res2 != null)
            {
                order = res1.ComparePosition(res2);
            }

            else if (res2 == null)
            {
                advance1 = true;
                advance2 = false;
                m_eNext  = res1;
                _last    = null;
                return(res1);
            }
            else
            {
                advance1 = false;
                advance2 = true;
                m_eNext  = res2;
                _last    = null;
                return(res2);
            }

            if (order == XmlNodeOrder.Same)
            {
                return(ProcessSamePosition(res1));
            }
            if (order == XmlNodeOrder.Before)
            {
                return(ProcessBeforePosition(res1, res2));
            }
            if (order == XmlNodeOrder.After)
            {
                return(ProcessAfterPosition(res1, res2));
            }
            //Now order is XmlNodeOrder.Unknown
            XPathNavigator dummyres1 = res1.Clone();

            dummyres1.MoveToRoot();

            XPathNavigator dummyres2 = res2.Clone();

            dummyres2.MoveToRoot();
            int uriOrder = context.CompareDocument(dummyres1.BaseURI, dummyres2.BaseURI);

            if (uriOrder == 0)
            {
                return(ProcessSamePosition(res1));
            }
            if (uriOrder < 0)
            {
                return(ProcessBeforePosition(res1, res2));
            }
            if (uriOrder > 0)
            {
                return(ProcessAfterPosition(res1, res2));
            }
            Debug.Assert(false, "should not be herein OrQuery.advance()");
            return(null);
        }