Download presentation
Presentation is loading. Please wait.
1
Examples of using current() & deref() in XPath
oimt2019.KL _XPath-current-deref 封面主标题字体: 方正正中黑简体 微软雅黑 ONF OIMT & OTCC San Jose Joint Meeting CICT-FiberHome Kam LAM
2
XPath in YANG 1.1 – RFC 7950 XPath – XML Path Language
YANG relies on XPath 1.0 as a notation for specifying inter-node references and dependencies In RFC 7950 – YANG 1.1 6.4 XPath Evaluations: XPath Context, examples 10 XPath Functions: 10.1 Node Sets current() node-set current() The current() function takes no input parameters and returns a node set with the initial context node as its only member.
3
XPath in YANG 1.1 – RFC 7950 In RFC 7950 – YANG 1.1
6.4 XPath Evaluations: XPath Context, examples 10 XPath Functions: 10.1 Node Sets current() 10.3 YANG Types leafref & instance- identifier deref() node-set deref(node-set nodes) The deref() function follows the reference defined by the first node in document order in the argument "nodes" and returns the nodes it refers to
4
XPath in YANG 1.1 – RFC 7950 Use of deref() and current() in XPath
deref() is needed when you need to follow a leafref to the leaf it is pointing to current() is needed to get the current element Beniot Example (via Scott) There are authors and books. A book has an author. You want to make sure the author has an account-id. So the current() returns author. To get to the account-id, you need to follow the leafref to /authors/author/name, then backup a level in the tree and then down to account-id. Just like navigating paths in unix.
5
THANKS!
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.