# fn:trace

fn:trace($value as item()*, $label as xs:string) as item()*

Function signature

$value | item() *
$label | xs:string
Result | item() *

Returns the value of the first argument after outputting a diagnostic message

XPath 2.0 Specification

Note:The Saxon implementation outputs the value of each item in a sequence as it is evaluated (except when the sequence is empty, in which case it outputs "empty sequence" at the start). Atomic values are output by converting them to a string, nodes by calling getPath() to generate a path expression to the node. With complex expressions the order of evaluation may be rather different from the expected order. The trace output is directed to System.err, this may be redirected by using "2>log.txt" on the command line. If a TraceListener has been nominated, then instead of writing the output to System.err, the information instead results in events being notified to the TraceListener.

Expand | Up Next