Dear fellow users,
I updated to BaseX 9.1 and I observe an unexpected behaviour of fn:trace
http://docs.basex.org/wiki/XQuery_3.1#fn:trace
I inserted logging statements to give warnings in case important content is missing, like so:
declare function local:my-function ( $id as xs:string?,
$value as xs:string? )
as xs:string?
{
if ( $ value != '' )
then
“foo”
else
trace( $id, 'No foo given for this record! ')
} ;
So far, the fn:trace output could be read in the Info window of BaseX.
Now, the id-value of the above call to trace is ALSO output to the Result window.
Even though the documentation states that the behaviour of trace is implementation-dependent, this behaviour seems unexpected and unhelpful. The extra output to result is hard to notice and destroys a possibly fully
valid result file (the trace call is only a warning, there is not necessarily an actual error).
1.
Is there anything wrong with my XQuery?
2.
Why is trace behaving this way in BaseX 9.1?
3.
How to best achieve the desired output? (Desired output is: result file unchanged and warning in Info window.)
Thank you and best regards,
MK