SAXONICA

Saxon Documentation
Full Contents
About Saxon
Changes in this Release
Conditions of Use
Using XSLT 2.0
Using XQuery
Handling Source Documents
XML Schema Processing
The XPath API
Saxon on .NET
Extensibility
Saxon Extensions
Sample Saxon Applications
The Saxon SQL Extension
XSLT Elements
XPath 2.0 Expression Syntax
Function Library
Standards Conformance

# 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.

Next