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

XRulesContext Class

Implements XRules-specific XPath functions such as: config(), context(), target(), property(), iif()... etc.

For a list of all members of this type, see XRulesContext Members.

System.Object
   System.Xml.XmlNamespaceManager
      System.Xml.Xsl.XsltContext
         XRules.XRulesContext

[Visual Basic]
Public Class XRulesContext
    Inherits XsltContext
[C#]
public class XRulesContext : XsltContext
[C++]
public __gc class XRulesContext : public XsltContext
[JScript]
public class XRulesContext extends XsltContext

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

You can derive from this class to create your own custom context classes to add extention 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().

Example

The following example shows how to override XRulesContext to implement custom XPath functions.

internal class CustomContext : XRules.XRulesContext
{
    protected internal CustomContext(XRulesDocument xrules) : base(xrules)
    {}

    public override IXsltContextFunction ResolveFunction(string prefix, 
                                string name, XPathResultType[] argTypes)
    {
        switch (name)
        {
            case "AddNumbers":
                // CustomFunction implements the IXsltContextFunction interface.
                CustomFunction xrulesFunction = new CustomFunction(name);
                return xrulesFunction;
        }
        
        // Call the base function to resolve XRules functions.
        return base.ResolveFunction(prefix, name, argTypes);
    }
}    

Requirements

Namespace: XRules

Assembly: XRules.DynamicDom (in XRules.DynamicDom.dll)

See Also

XRulesContext Members | XRules Namespace