DynamicDOM v0.43.2. Implementation based on XRules v0.43

XRulesDocument.SetContext Method 

Allows you to set a custom context derived from XRulesContext to implement extension XPath functions.

[Visual Basic]
Public Sub SetContext( _ 
   ByVal xrulesContext As XRulesContext _ 
public void SetContext(
   XRulesContext xrulesContext
public: void SetContext(
   XRulesContext* xrulesContext
public function SetContext(
   XRulesContext xrulesContext


The custom context class that resolves your extension XPath functions and variables.


Important: In your custom context class, if you're overriding the ResolveFunction() or ResolveVariabe() functions, remember to call the corresponding function in the base class; otherwise, the XRules processor won't be able to resolve XRules functions such as config() and property(). For example, your ResolveFunction() method could look like this:

public override IXsltContextFunction ResolveFunction(string prefix, 
            string name, XPathResultType[] argTypes)
    switch (name)
        case "MyFunction":
            MyXPathFunction func = new MyXPathFunction();
            return func;
            // Call the base XRulesContext class to resolve XRules XPath functions.
            return base.ResolveFunction(prefix, name, argTypes);

See Also

XRulesDocument Class | XRules Namespace