I'd like sometimes to be able to have saxon do a trace when invoked as part of the teitoX tools. I do not currently see a way to do this. I read saxon's documentation but do not see there a way to cause the saxon instances launched by the teitoX tools to get parameters elsewhere than from the ant task launched by teitoX. In particular, I see no way to set an environment variable that would affect saxon's configuration. Saxon supports a configuration file (since version 9.4 in Saxon-HE) but I do not see in the saxon documentation any default file path for a configuration file. (But this is buggy, see below.) In other words, saxon will not read any configuration file unless told so explicitly.
(Someone could probably hack something together by creating a custom jar and using --saxonjar, but yuck!)
I've experimented with a modified version of teitodocx and a corresponding build-to.xml so as to have saxon read a configuration from a configuration file but I was not able to get it to work because of a bug reported here:
I still think that once the bug fix makes it through latest stable release, this will be the way to go.
In the meantime, I've continued experimenting to obtain at least a trace. I'm attaching some patches to this feature request. This is not a complete solution because if no listener class is specified by the user, then http://saxon.sf.net/feature/traceListenerClass is set to an empty string, which saxon interprets as a class name, which it tries to load and then crashes. This is because if no listener class is specified then the factory net.sf.saxon.TransformerFactoryImpl should be instantiated without any attributes, rather than attributes set to empty strings. Certainly possible to get something nicer but I don't see how to do it without seriously refactoring build-to.xml. (But my ant-fu is very rusty so maybe there's a very simple solution I'm not seeing.) I'd rather not spend more effort on this given that, as I mentioned earlier, the ultimate solution will be to provide support to get saxon to read a configuration file.