I'm trying to print the <xsl:message>
in a JTextArea using JAXP.
My Problem is, that I can't create a saxonica Controller with my transformer and I don't know why because I'm using TransformerFactoryImpl as in some answers is called.
Here is my Java Code:
public static void xslTransform(File xmlFile,File xslFile, JTextArea output){
StreamSource source = new StreamSource(xmlFile);
StreamResult result = new StreamResult(xslFile);
TransformerFactoryImpl tfimpl = new TransformerFactoryImpl();
Transformer transformer = tfimpl.newInstance().newTransformer(new StreamSource(xslFile));
Controller controller = new Controller(transformer);
import for Controller:
net.sf.saxon.Controller;
Hope anybody can help me.
KaFu
There has never been a constructor on the Controller class that took a JAXP Transformer as a parameter, I don't know where you got that idea from.
In releases prior to Saxon 9.6, you can cast the Transformer to a Controller if you want to call methods on the Controller object, that is
In 9.6, the relationship between Controller and Transformer has changed, because the JAXP API is becoming increasingly unsuitable to take advantage of the facilities becoming available in XSLT 3.0. You can now cast the Transformer to
net.sf.saxon.jaxp.TransformerImpl
, and from the TransformerImpl you can callgetUnderlyingController()
to get to the Controller.But do you really want to do it this way? An alternative would be to do
where MyMessageEmitter is your implementation of Saxon's MessageEmitter inferface.