usage of current vs ../ in yang xpath expressions

送分小仙女□ 提交于 2019-12-02 03:51:42

The way you use current() in your example is correct, but redundant. current() returns the initial context node and since all expressions start with the initial context node in their contexts in makes no sense to explicitly state this.

This does not mean that current() is equivalent to ../ at the beginning of an expression. The latter may be expanded into parent::node()/child::node(), which returns all children of the parent of the initial context node. The returning node set will contain the initial context node, along with all its siblings. This is not what current() returns - it is at best similar.

What would be equivalent is . or, written alternatively, self::node(). If an expression starts with ., it may return the same node as current(), but this is entirely dependent on the context where . is used.

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