“~” Notation

The first non-standard syntax is to add a new character '~' to represent the current node. (The traditional '.' will not work as you might expect - it will always refer to the root node, and, therefore, should not be used - all paths are relative to the root by default.) The XPath expression is preprocessed to replace the '~' with the path to the current node. To represent the character '~' itself, use two of them "~~".

For example, if you are processing an entry in the XML with entry node path "/root/entry[7]", you can reference child elements as either,


or in a shorter form as