So I would propose something like the following:
1) Have the TreeProcessor pass the sitemap source location in setGenerator(), addTransformer(), and setSerializer() to the ProcessingPipeline.
2) In "Debug" mode instrument the PipelineProcessor to write the output of each stage to a temporary file and regenerate SAX events from the temporary file (with location information). The PipelineProcessor would catch any exception thrown by a pipeline component and generate a "Cocoon" stack trace that includes the source location of the temp file. The Cocoon error reporter could even display the source code (maybe in tab-panes or whatever) of the pipeline intermediate results together with the stack trace. Hypothetically the label or tooltip on the tab-pane would be something like:
C:\TEMP\Pipeline_1060734815693.xml (output of C:\cocoon\build\webapp\samples\sitemap.xmap::66:16)
where the sitemap location refers to a <map:generate> or <map:transform> instruction.
WDYT?
IIRC, profiler pipeline already does some of this, like it saves output of every stage. Me thinks this "debug" mode should be part of profiling pipeline.
PS I don't like writing to a temp file part
Vadim
