You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A https://www.saxonica.com/html/documentation12/javadoc/net/sf/saxon/lib/TraceListener.html allows to get intermediate results of the transformation. The listener can easily be added to the Saxon configuration, for example in a Spring Boot application. However, the SchematronTransformerFactory always creates its own instance with no outside access to the configuration.
It would be nice to have a configuration setting to enable Feature.COMPILE_WITH_TRACING to true, and state my own implementation of the TraceListener.
My use case for this particular request is that complex rules using functions are often hard to understand. So I want to present intermediate (function) results to the user as additional explanation, and the trace listener would give me easy access to this.
The text was updated successfully, but these errors were encountered:
I added a static method SchematronTransformerFactory.setTransformerFactoryCustomizer (Consumer <TransformerFactory>) so that you can customize the created TransformerFactory to your needs. Hope that makes sense to you. Just apply the setting globally, before calling the first Schematron stuff.
Wow, this was super fast. And it works like a charm, thanks a million.
For anyone also using this from Spring Boot:
Create your net.sf.saxon.Configuration bean as usual in a @configuration class
Set Feature.COMPILE_WITH_TRACING to true
Build your Saxon trace listener (extend XSLTTraceListener and override as you wish)
In a @PostContruct init method that @dependsOn the Saxon config bean, obtain the net.sf.saxon.Configuration bean, and inject it into a
TransformerFactoryConsumer class that implements Consumer, and then call
SchematronTransformerFactory.setTransformerFactoryCustomizer with your consumer class
In your consumer class, in method accept, cast TransformerFactory to net.sf.saxon.TransformerFactoryImpl and set the net.sf.saxon.Configuration from step 4
ph-schematron-api/src/main/java/com/helger/schematron/saxon/SchematronTransformerFactory.java
A https://www.saxonica.com/html/documentation12/javadoc/net/sf/saxon/lib/TraceListener.html allows to get intermediate results of the transformation. The listener can easily be added to the Saxon configuration, for example in a Spring Boot application. However, the SchematronTransformerFactory always creates its own instance with no outside access to the configuration.
It would be nice to have a configuration setting to enable Feature.COMPILE_WITH_TRACING to true, and state my own implementation of the TraceListener.
My use case for this particular request is that complex rules using functions are often hard to understand. So I want to present intermediate (function) results to the user as additional explanation, and the trace listener would give me easy access to this.
The text was updated successfully, but these errors were encountered: