MatchNode() public method

public MatchNode ( XPathNavigator current ) : XPathNavigator
current System.Xml.XPath.XPathNavigator
return System.Xml.XPath.XPathNavigator
Esempio n. 1
0
        public override XPathNavigator MatchNode(XPathNavigator current)
        {
            XPathNavigator context = _child.MatchNode(current);

            if (context == null)
            {
                return(null);
            }
            context = input.MatchNode(context);
            if (context == null)
            {
                return(null);
            }
            Evaluate(new XPathSingletonIterator(context.Clone(), /*moved:*/ true));
            XPathNavigator result = Advance();

            while (result != null)
            {
                if (result.IsSamePosition(current))
                {
                    return(context);
                }
                result = Advance();
            }
            return(null);
        }
Esempio n. 2
0
 public override XPathNavigator MatchNode(XPathNavigator xsltContext)
 {
     if (xsltContext != null)
     {
         XPathNavigator result = qy1.MatchNode(xsltContext);
         if (result != null)
         {
             return(result);
         }
         return(qy2.MatchNode(xsltContext));
     }
     return(null);
 }
 private static void EvaluateKey(XPathNavigator node, Query matchExpr, string matchStr, Query useExpr, Hashtable keyTable) {
     try {
         if (matchExpr.MatchNode(node) == null) {
             return;
         }
     } catch(XPathException) {
         throw XsltException.Create(Res.Xslt_InvalidPattern, matchStr);
     }
     object result = useExpr.Evaluate(new XPathSingletonIterator(node, /*moved:*/true));
     XPathNodeIterator it = result as XPathNodeIterator;
     if (it != null) {
         bool checkDuplicates = false;
         while (it.MoveNext()) {
             AddKeyValue(keyTable, /*key:*/it.Current.Value, /*value:*/node, checkDuplicates);
             checkDuplicates = true;
         }
     } else {
         String key = XmlConvert.ToXPathString(result);
         AddKeyValue(keyTable, key, /*value:*/node, /*checkDuplicates:*/ false);
     }
 }