Redirecting output from trace() function

Help
user
2012-03-26
2012-10-08
  • user
    user
    2012-03-26

    I'm using Saxon Home Edition dlls for evaluation of XPath expressions. Is
    there a way to redirect output from trace() function to another window/message
    box that I specify? I'm creating a new textwriter object and setting console
    error to this object using:
    Console.SetError(textwriterobj)
    After this, I call the saxon xpath query evaluate function, but the results of
    trace() function don't come in the textwriter object but the default console
    of my application. However, using Console.Write redirects the messages to my
    textwriter object correctly. It seems that the saxon dlls are still using the
    default application console for sending the trace results, any pointers on how
    I could redirect it? Thanks.

     
  • Michael Kay
    Michael Kay
    2012-03-26

    From the command line, you can use -traceout:filename. From a .NET
    application, the XsltTransformer and XQueryEavluator objects have a property
    TraceFunctionDestination that you can set. Unfortunately this isn't exposed in
    the XPath API, so I would suggest executing your Xpath expressions via the
    XQuery API.

    Please note that this forum is being replaced by the new site at
    http://dev.saxonica.com/.