Xpath current() in Yang

旧时模样 提交于 2019-12-11 03:08:33

问题


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?

来源:https://stackoverflow.com/questions/55888566/xpath-current-in-yang

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!