Allows you to set a custom context derived from XRulesContext to implement extension XPath functions.
[Visual Basic] Public Sub SetContext( _ ByVal xrulesContext As XRulesContext _ ) [C#] public void SetContext( XRulesContext xrulesContext ); [C++] public: void SetContext( XRulesContext* xrulesContext ); [JScript] public function SetContext( XRulesContext xrulesContext );
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;
default:
// Call the base XRulesContext class to resolve XRules XPath functions.
return base.ResolveFunction(prefix, name, argTypes);
}
}
XRulesDocument Class | XRules Namespace