FOP 0.95新版本升级时碰到的问题

(0 comments)

这段时间正好重新在虚拟机上配置系统,看到FOP连续发布了0.94和0.95两个版本,决定尝试将目前Docbook编译PDF使用的FOP 0.25版本升级到最新的0.95版本。

编译PDF文件时报错,提示信息如下:

org.apache.fop.apps.FOPException: Error(Unknown location): No element mapping definition found for (Namespace URI: "http://xml.apache.org/fop/extensions", Local Name: "destination")

在网上搜索到相关解答如下:

The DocBook-independent answer is: The http://xml.apache.org/fop/extensions
namespace has changed to http://xmlgraphics.apache.org/fop/extensions
for FOP versions 0.90 and higher.

进入/usr/share/sgml/docbook/xsl-stylesheets目录,查找所有包含http://xml.apache.org/链接的文件。

find . -exec grep -l http:\/\/xml.apache.org/ {} \;

发现文件数量众多,手工修改非常麻烦,编写脚本fixlinks.sh,内容如下:

#! /bin/sh
sed 's/http:\/\/xml.apache.org/http:\/\/xmlgraphics.apache.org/g' $1 \ > /tmp/fixlink$$
mv /tmp/fixlink$$ $1

结合find命令,替换掉所有文件中的错误链接:

find . -type f -exec /opt/fop/fixlinks.sh {} \;

再次执行find命令,确保上述替换工作成功完成。

find . -exec grep -l http:\/\/xml.apache.org/ {} \;
Currently unrated

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required