I was going through some online materials from Understanding XPath Processor Terms. Here I found definitions of current node and context node as below.
Current Node Current node is the node that the XPath processor is looking at when it begins evaluation of a query. In other words, the current node is the first context node that the XPath processor uses when it starts to execute the query. During evaluation of a query, the current node does not change. If you pass a document to the XPath processor, the root node is the current node. If you pass a node to the XPath processor, that node is the current node.
Context Node A context node is the node the XPath processor is currently looking at. The context node changes as the XPath processor evaluates a query. If you pass a document to the XPath processor, the root node is the initial context node. If you pass a node to the XPath processor, the node that you pass is the initial context node. During evaluation of a query, the initial context node is also the current node.
Although the definitions are a bit good to understand the difference between current node and context node,examples are not good to understand the differences practically to me.
Can any give me some good examples to show the below two things explicitly ?
- During
xpath
evaluation current node is fixed,but context nodes are keep changing. - context node and current node are co-incised with each other.