我使用适用于 Microsoft Word 的 Oracle BI Publisher 插件创建了一个 XSL-FO 模板,我想使用 FOP 对其进行转换,并将其导出为 PDF 文件。
从 Oracle 命名空间中发现第一个标记后,转换操作失败,错误消息显示:
(Location of error unknown)org.apache.fop.fo.ValidationException: Invalid property encountered on "fo:root": xdofo:nf-separator (No context info available)
这是代码:
FopFactory fopFactory = FopFactory.newInstance();
out = new BufferedOutputStream(new FileOutputStream(new File("result.pdf")));
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out);
StreamSource source = new StreamSource(generateOrderInvoiceXml(orderId));
StreamSource transformSource = new StreamSource(new File("template.xsl"));
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(transformSource);
Result res = new SAXResult(fop.getDefaultHandler());
transformer.transform(source, res);
有没有办法使用 FOP 转换这样的模板?