In the list below, you can find various list path operators with their explanation.

Location Path Step
var $host-name = $results/system/host-name;
Each / 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.

Multiple Steps
var $host-name = $results//host-name;
The // 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.

Parent Axis
var $errors = $results/..//xnm:error;
The .. is an abbreviation for the parent axis. It indicates that the parent axis should be searched instead of the default child axis.

Attribute Axis
var $changed = $configuration//@changed;
The @ sign is an abbreviation for the attribute axis, indicating that Junos should search the attribute axis instead of the default child axis.

Wildcard Match
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.

Context Node
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.

version 1.0;

ns junos = "*/junos";
ns xnm = "";
ns jcs = "";

import "../import/junos.xsl";

match / {
    <op-script-results> {
        var $interface = "ge-0/0/0";
        /* Junos XML API Element for show interface terse */
        var $get-interface-rpc = <get-interface-information> {

        /* Retrieve the results of the API request */
        var $results = jcs:invoke( $get-interface-rpc );

        /* Assign all matching nodes from the results to the $admin-status variable */
        var $admin-status = $results/physical-interface[name==$interface]/admin-status;

        /* Output the interface admin status to the console */
        <output> "The admin status of " _ $interface _ " is " _ $admin-status;