System.Xml.Xsl.XsltOld.XsltCompileContext.FuncDocument.Invoke C# (CSharp) Method

Invoke() public method

public Invoke ( XsltContext xsltContext, object args, XPathNavigator docContext ) : object
xsltContext XsltContext
args object
docContext System.Xml.XPath.XPathNavigator
return object
            public override object Invoke(XsltContext xsltContext, object[] args, XPathNavigator docContext) {
                string baseUri = null;
                if (args.Length == 2) {
                    XPathNodeIterator it = ToIterator(args[1]);
                    if (it.MoveNext()){
                        baseUri = it.Current.BaseURI;
                    } else {
                        // http://www.w3.org/1999/11/REC-xslt-19991116-errata (E14):
                        // It is an error if the second argument node-set is empty and the URI reference is relative; the XSLT processor may signal the error;
                        // if it does not signal an error, it must recover by returning an empty node-set.
                        baseUri = string.Empty; // call to Document will fail if args[0] is reletive.
                    }
                }
                try {
                    return ((XsltCompileContext)xsltContext).Document(args[0], baseUri);
                }
                catch (Exception e) {
                    if (!XmlException.IsCatchableException(e)) {
                        throw;
                    }
                    return XPathEmptyIterator.Instance;
                }
            }
        }
XsltCompileContext.FuncDocument