RE: Direct FO transform fails in Java 25

"Simon Steiner" <[email protected]>
Newsgroups gmane.text.xml.fop.devel
Message-ID <[email protected]>
Hi,

 

We raised a bug on the JDK for this issue.

 

Thanks

 

From: Daniel Robinson <[email protected]> 
Sent: 24 September 2025 10:59
To: [email protected]
Subject: Direct FO transform fails in Java 25

 

 

Hello,

 

Using Java25, FOP 2.11, Windows11.

 

This way be related to issue FOP-3275.

 

We directly generate FO files from the UI layer of our application. And use FOP to transform these into PDF files.

 

We are in the process of moving to Java 25. Since this move the transform is no longer working. We get the error : FWK005 parse may not be called while parsing.

 

To do this we call the transformation like this :

TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer();
// 5️⃣ Set up input (FO file) and output (SAXResult to FOP)
StreamSource src = new StreamSource(foFile);
SAXResult res = new SAXResult(fop.getDefaultHandler());
// 6️⃣ Transform the FO to PDF
transformer.transform(src, res);

 

However, we have found the if we wrap our FO (fopInvoice2.xml) file into an XSL file (fopInvoice3.xml) and use a dummy xml for the transform it works.

 

Source xslSource = new StreamSource(reader);
    String xml = """
    <doc></doc>
""";
    Source xmlSource = new StreamSource(new StringReader(xml));
    Transformer transformer = tf.newTransformer(xslSource);
    // 5) Pipe the XSLT result directly into FOP as SAX events
    Result res = new SAXResult(fop.getDefaultHandler());
    transformer.transform(xmlSource, res);

 

This approach seems couter-intuitive as adding a transformation layer reduces the transformation imbrication.

 

Are we doing something wrong? 

 

Kind regards,

 

Daniel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.