Project

Profile

Help

fn:trace

Added by Anonymous over 16 years ago

Legacy ID: #4662066 Legacy Poster: James Fuller (cutlass)

I am embarrassed to say I have not been able to get this function working (SAXON-SA) in any incantation ... anyone got an working example ? cheers, Jim Fuller


Replies (5)

Please register to reply

RE: fn:trace - Added by Anonymous over 16 years ago

Legacy ID: #4662206 Legacy Poster: Michael Kay (mhkay)

<xsl:template name="go"> <out> <xsl:variable name="v" select="2"/> <xsl:value-of select="trace($v, 'this is $v')"/> </out> </xsl:template> outputs the message: this is $v: xs:integer: 2 and the normal result: <?xml version="1.0" encoding="UTF-8"?><out>2</out>

RE: fn:trace - Added by Anonymous over 16 years ago

Legacy ID: #4662228 Legacy Poster: James Fuller (cutlass)

I should have clarified, I meant using fn:trace() in XQuery context. for example; let $var1 := 4 return trace($var1, 'The value of $var1 is: ') I get output that looks like the amalgam of standard output and error output. I assume that fn:trace is writing to std:err ? are there any commandline switches controlling behavior here? many thx in advance. regards ,Jim Fuller

RE: fn:trace - Added by Anonymous over 16 years ago

Legacy ID: #4662240 Legacy Poster: Michael Kay (mhkay)

By default trace output is sent to standard error, while query output goes to standard output. You can redirect either or both of these from the command line: ">out.xml" for the query output (or use the -o option), and "2>trace.out" for the trace output.

RE: fn:trace - Added by Anonymous over 16 years ago

Legacy ID: #4772325 Legacy Poster: James Fuller (cutlass)

is there any control over emitting trace messages or not (command line flag?) for example in this invocation; <java classname="net.sf.saxon.Query" fork="true" failonerror="false" maxmemory="256m" output="@{dest}/"> <arg line="-sa -s @{input} @{query}"/> <classpath> <pathelement location="${p.dir.lib.saxon-ext}"/> <pathelement location="${p.dir.lib.saxon}"/> <fileset dir="${p.dir.lib.saxon}"> <include name="saxon8sa.jar"/> </fileset> </classpath> </java> ant writes both stdout and stderr to the same output .. one can define a few other attributes to specifically handle error output on java ... though I was wondering if there was any way of 'muting' trace messages in saxon ? thx and apologies for any churn.

RE: fn:trace - Added by Anonymous over 16 years ago

Legacy ID: #4772396 Legacy Poster: Michael Kay (mhkay)

If you're using a TraceListener (-T or -TL on the command line) then trace() output will be written there; in all other cases it is written to System.err. Using a TraceListener just to mute the output is a bit of a sledgehammer, I'm afraid. I hate adding more switches but this does seem to be an area that needs one.

    (1-5/5)

    Please register to reply