eval Action

Evaluates its text content as an XPath expression. The result can be assigned to a variable.

<eval out="$mock">false()</eval>

The action is mostly used to assign variables.

Besides atomic values such as strings, numbers and booleans, an expression may yield a DOM node-set:

<eval out="$parts">split($request/path, "/")</eval>
<eval out="$links">content()/html/body//a[@href] | content()/html/head/link[@href]</eval>

If you need to create a structured JSON object use templating.

Syntax

The action body must contain an XPath expression.

out is optional. If defined, it must contain a variable name. If no out is given, the result is discarded.

Omitting output is useful to call functions with side-effects:

<eval>fit-log(concat("login error for user ", $request/post/username))</eval>

See also

Last updated