Skip to content

Latest commit

 

History

History
44 lines (29 loc) · 1.01 KB

eval.md

File metadata and controls

44 lines (29 loc) · 1.01 KB

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