I would think the right way to do this is with a custom TraceListener. 

http://www.saxonica.com/documentation/index.html#!javadoc/net.sf.saxon.lib/TraceListener

By monitoring startCurrentItem() and endCurrentItem(), and maintaining a stack, you always know what the context item is (which in simple cases translates to the node in the source document that you are processing). By monitoring enter() and leave() you can detect execution of instructions that construct nodes (typically in the final result tree). To look at the content of the result nodes you will also need to intercept the events being sent to the output, which isn't difficult, though working out how they synchronize with the TraceListener events can be a little subtle because there can be a bit of buffering. But that's the way I would tackle it.

In fact the old saxon:trace attribute switched sending of events to a TraceListener on and off dynamically. That's no longer possible because the decisions are made at compile time to reduce overheads. But the ability to send to the TraceListener is still there.

Michael Kay
Saxonica


On 10 Oct 2013, at 10:07, philippe.favrais@continental-corporation.com wrote:

Hello,

In fact, i should have started by explaining what i want to do.

I have implemented XSL which do XML to XML transformation.
Now, i would like to be able to generate a "design" document showing the binding between (elements and attributs)  XML input document processed by my XSL and the generated XML document (elements and attributs).

My idea is to create this "design" document while my XSL is running. For that, i want to instrument my XSL code with some tracer functions which could output the context of the input docment and the context of the output document.

As i am not sure that it is the best solution, i prefer to ask the questions : What is the best way to do it ? Are there existing solution as well ?

Thank you
Philippe



De :        Michael Kay <mike@saxonica.com>
A :        Mailing list for the SAXON XSLT and XQuery processor <saxon-help@lists.sourceforge.net>
Date :        08/10/2013 12:48
Objet :        Re: [saxon] Use of saxon:trace




The namespace you are using is for Saxon versions <= 6.5.5. Since about 2001(!) the namespace has been http://saxon.sf.net/

And I see the documentation is for 6.5.5:

http://saxon.sourceforge.net/saxon6.5.5/extensions.html#trace

I think the option to switch tracing on and off from within the stylesheet disappeared a long time ago. You can switch it on globally using the -T option on the command line, and if you want to be more selective, I think you have to write a TraceListener.

Regards,

Michael Kay
Saxoinca

On 8 Oct 2013, at 11:01, philippe.favrais@continental-corporation.com wrote:

Hello All,

I am trying to play with saxon:trace in order to get more information on the flow of my templates but i get no trace at all.


Here is what i trried to activate the trace outputr

- I am using saxon-b and run it from a batch file

- I put
<xsl:template match="*:SHORT-NAME" saxon:trace="yes">
- i also tried  
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"        xmlns:saxon="http://icl.com/saxon" saxon:trace="yes">

are there additional options or commands to use ?


Thank you

Philippe Favrais
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >

http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk_______________________________________________
saxon-help mailing list archived at
http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk_______________________________________________
saxon-help mailing list archived at
http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help