7.4. x:eval

(x:eval xpath)

(x:eval xpath base)

Evaluates XPath expression xpath using base as the current node. If base is not given, the current node is the XSLT context node.

If xpath is a literal expression (a string, a number, etc) or a function call, then x:eval returns the result as a string literal.

Otherwise, x:eval returns a list of nodes, or an empty list if xpath selected no nodes.

In case of error the result is the value #unspecified.

Example 35. Using x:eval

<s:scheme>
  `("context node name: " ,(x:eval "name()"))
</s:scheme>

For a more sophisticated example, read Section 6.5, “Miltiple sum, or quantity times price”.