In the list below, you can find various list path operators with their explanation.
Location Path Step
var $host-name = $results/system/host-name;
/ represents one step in the XML hierarchy. The direction of the step depends on the axis in use, with the default being the child axis.
var $host-name = $results//host-name;
// skips over multiple steps in the hierarchy. This example is the same as the previous example but the
<system> element node is skipped since the
// operator will search through zero or more steps. If there were
<host-name> element nodes in other hierarchy levels they would be returned by this location path as well.
var $errors = $results/..//xnm:error;
.. is an abbreviation for the parent axis. It indicates that the parent axis should be searched instead of the default child axis.
var $changed = $configuration//@changed;
@ sign is an abbreviation for the attribute axis, indicating that Junos should search the attribute axis instead of the default child axis.
var $user-children = $configuration/system/login/user/*;
The wildcard matches all nodes along the given axis (by default the child axis). In this example it would match all of the child nodes for all
<user> element nodes.
var $ge-interface = $configuration/interfaces/interface[ startswith( name, “ge” ) ];
Predicates are bounded by
[ ]. If their expression evaluates to false then the node is not included in the location path result.
var $ge-interface = $configuration/interfaces/interface/name[ starts-with(., “ge”) ];
A period can be used within a predicate to indicate that the expression should use the context node value. In this example the
<name> element node itself is evaluated by the
starts-with() function since the
. is used as an argument.