Xpath current() in Yang

2019-07-17 08:54发布

问题:

I have a leaf defined in Yang as:

leaf test-must {
    type int32;
    description "Test must";
    must "current() > 0" {
        error-message "test-must value should be > 0";
    }
}

Looks like the underlying library, libxml2, I use does not recognize current() when this is evaluated and returns error:

error: xmlXPathCompOpEval: function current not found

error: Unregistered function

Are there any alternatives to current()? Or where do I find definition for current() and register it?

As an alternative I tried with . and self::node() following this.

But when this expression is evaluated with libxml2 APIs, when test-must value is configured as 0, it returns proper error. However, when test-must value is > 0, it says "invalid expression", which should not return error since value > 1 (which is Success as per must statement).

error: Invalid expression

Can someone provide some help on this?