Use XPath Axis and Wildcard Expressions in the Expression Builder

You can include XPath axis and wildcard expressions in actions that support the Expression Builder (for example, assign and switch actions support the Expression Builder).

  1. Create an assign action or switch action and navigate to the Expression Builder.

  2. In the Expression field for an assign or switch action, build an expression using either option:
    • Wildcard expression:

      For this example, a wildcard is entered to select all elements below Answer.

      /nssrcmpr:process/nssrcmpr:Answer/*

      Or, to select all elements:

      /*
    • Axis expression:

      For this example, descendant is entered to select all descendants (child, grandchildren, and so on) of the current node. Any descendant with this ID and namespace (mb_v1_3:ID) is retrieved by the expression.

      /nssrcmpr:process/nssrcmpr:Answer/descendant::mb_v1_3:ID

      Axis expressions adhere to the following syntax:

      axisname::nodetest[predicate]

      The following table provides examples of axis expressions:

      Syntax Result
      child::book

      Selects all book nodes that are children of the current node.

      attribute::lang

      Selects the lang attribute of the current node.

      child::*

      Selects all element children of the current node.

      attribute::*

      Selects all attributes of the current node.

      child::text()

      Selects all text node children of the current node.

      child::node()

      Selects all children of the current node.

      descendant::book

      Selects all book descendants of the current node

      ancestor::book

      Selects all book ancestors of the current node.

      ancestor-or-self::book

      Selects all book ancestors of the current node and the current if it is a book node.

      child::*/child::price

      Selects all price grandchildren of the current node.

  3. Click the Expression Summary icon to validate the expression.

  4. When complete, click Close.