Saxon extensions to the W3C XSLT/XQuery specifications
From Saxon 11.2, a new clause is introduced for FLWOR expressions, to assist diagnostics. It has the syntax:
TraceClause ::= "trace" Exprand can be used anywhere in a FLWOR expression to display selected information about the current tuple stream.
For example,
for $item in //items trace "item: " || $item/@id let $price := $item/cost + $item/markup trace "selling-price: " || $price return "€" + $priceOutput is displayed in the same way as for the fn:trace()
function. It is sent to the current Logger
,
and for each item in the trace output, a line is output in the format FLWOR<- n/m type: message
where n is the sequence number of the tuple, m is the position of the item within one evaluation of the expression,
type is the type of item displayed, and message is a representation of the item. The arrow symbol "<-" is used
when the FLWOR expression is evaluated in pull mode, and is replaced by "->" when evaluated in push mode; the distinction
is only of interest when doing internal diagnosis.