public override object Evaluate(XPathNodeIterator nodeIterator)
        {
            object obj2;

            if (base.xsltContext == null)
            {
                throw XPathException.Create("Xp_NoContext");
            }
            object[] args = new object[this.args.Count];
            for (int i = 0; i < this.args.Count; i++)
            {
                args[i] = this.args[i].Evaluate(nodeIterator);
                if (args[i] is XPathNodeIterator)
                {
                    args[i] = new XPathSelectionIterator(nodeIterator.Current, this.args[i]);
                }
            }
            try
            {
                obj2 = base.ProcessResult(this.function.Invoke(base.xsltContext, args, nodeIterator.Current));
            }
            catch (Exception exception)
            {
                throw XPathException.Create("Xp_FunctionFailed", base.QName, exception);
            }
            return(obj2);
        }
Пример #2
0
        public override object Evaluate(XPathNodeIterator nodeIterator)
        {
            if (xsltContext == null)
            {
                throw XPathException.Create(SR.Xp_NoContext);
            }

            // calculate arguments:
            object[] argVals = new object[_args.Count];
            for (int i = 0; i < _args.Count; i++)
            {
                argVals[i] = _args[i].Evaluate(nodeIterator);
                if (argVals[i] is XPathNodeIterator)
                {// ForBack Compat. To protect our queries from users.
                    argVals[i] = new XPathSelectionIterator(nodeIterator.Current, _args[i]);
                }
            }
            try
            {
                return(ProcessResult(_function.Invoke(xsltContext, argVals, nodeIterator.Current)));
            }
            catch (Exception ex)
            {
                throw XPathException.Create(SR.Xp_FunctionFailed, QName, ex);
            }
        }
Пример #3
0
        public override object Evaluate(XPathNodeIterator nodeIterator)
        {
            if (xsltContext == null)
            {
                throw XPathException.Create(SR.Xp_NoContext);
            }

            // calculate arguments:
            object[] argVals = new object[_args.Count];
            for (int i = 0; i < _args.Count; i++)
            {
                argVals[i] = _args[i].Evaluate(nodeIterator);
                if (argVals[i] is XPathNodeIterator)
                {// ForBack Compat. To protect our queries from users.
                    Debug.Assert(nodeIterator.Current != null);
                    argVals[i] = new XPathSelectionIterator(nodeIterator.Current, _args[i]);
                }
            }
            try
            {
                Debug.Assert(_function != null);
                object?retVal = ProcessResult(_function.Invoke(xsltContext, argVals, nodeIterator.Current !));

                // ProcessResult may return null when the input value is XmlNode and here doesn't seem to be the case.
                Debug.Assert(retVal != null);
                return(retVal);
            }
            catch (Exception ex)
            {
                throw XPathException.Create(SR.Xp_FunctionFailed, QName, ex);
            }
        }
Пример #4
0
        public override object Evaluate(XPathNodeIterator nodeIterator)
        {
            if (xsltContext == null)
            {
                throw XPathException.Create(Res.Xp_NoContext);
            }

            // calculate arguments:
            object[] argVals = new object[args.Count];
            for (int i = 0; i < args.Count; i++)
            {
                argVals[i] = args[i].Evaluate(nodeIterator);
                if (argVals[i] is XPathNodeIterator)
                {
                    argVals[i] = new XPathSelectionIterator(nodeIterator.Current, args[i]);
                }
            }
            try {
                return(ProcessResult(function.Invoke(xsltContext, argVals, nodeIterator.Current)));
            } catch (Exception ex) {
                throw XPathException.Create(Res.Xp_FunctionFailed, QName, ex);
            }
        }
Пример #5
0
 private XPathSelectionIterator(XPathSelectionIterator it)
 {
     _nav      = it._nav.Clone();
     _query    = (Query)it._query.Clone();
     _position = it._position;
 }
Пример #6
0
 protected XPathSelectionIterator(XPathSelectionIterator it)
 {
     this.nav      = it.nav.Clone();
     this.query    = (Query)it.query.Clone();
     this.position = it.position;
 }