来自 Java 的 Apache FOP 和 XSLT 2.0 ......? [英] Apache FOP from Java with XSLT 2.0…?

查看:21
本文介绍了来自 Java 的 Apache FOP 和 XSLT 2.0 ......?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在嵌入式使用 Apache FOP 1.0 中使用 XSLT 2.0 的某些功能时遇到问题.特别是在使用current-group()"时出现异常.

I'm having problems using some of the features of XSLT 2.0 in an embedded use of Apache FOP 1.0. In particular I get an exception when using "current-group()".

我看到 FOP 正在使用 xalan 2.6,它引发了异常.

I see that FOP is using xalan 2.6 which is throwing the exception.

我试图排除 xalan 2.6 的传递依赖并将其替换为 2.7.1 但它没有帮助.是否可以将 Apache FOP 与另一个支持更多 2.0 特性的 XSLT 处理器一起使用?

I tried to exclude the transitive dependency of xalan 2.6 and replaced it with 2.7.1 but it didn't help. Is it possible to use Apache FOP with another XSLT processor that supports more 2.0 features?

推荐答案

如果您从命令行将 FOP 作为独立发行版运行,您可以

  1. 使用 XSLT 处理器复制所需的 jar 文件(例如saxon9he.jar) 复制到 FOP 发行版的 lib 目录.

  1. copy the required jar file(s) with the XSLT processor (like e.g. saxon9he.jar) to the lib directory of your FOP distribution.

并通过添加指定 FOP 使用的处理器实现像这样的 VM 参数-Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl(例如 Saxon)到启动脚本(fop 在 Linux 上,fop.bat 在Windows) 在 org.apache.fop.cli.Main 被调用的那一行.

and specify the processor implementation to be used by FOP by adding a VM parameter like this -Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl (example for Saxon) to the start script (fop on Linux, fop.bat on Windows) at the line where org.apache.fop.cli.Main is called.

如果您在 Java 代码中嵌入 FOP,只需使用该 VM 参数启动您的应用程序(并确保所需的 jar 文件在您的 CLASSPATH 中).

If you embed FOP in your Java code, simply start your application with that VM parameter (and make sure the required jar files are in your CLASSPATH).

这篇关于来自 Java 的 Apache FOP 和 XSLT 2.0 ......?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆