0

我正在处理一个 Apache Cocoon 项目,我想以 PDF 格式发布 XML 文档。我使用了以下管道:

 <map:pipeline id="pdf">
      <map:match pattern="pd/*/*/data.pdf">
        <map:generate src="PD{1}{2}.xml" type="file"/>
        <map:transform src="doc2pdf.xslt" type="xslt"/>
        <map:serialize type="fo2pdf"/>
      </map:match>
    </map:pipeline>

.xslt是从 Apache Cocoon How-Tos 复制而来的。我的 XML 文件包含希腊字符。样品在这里

这个转换的输出是这样的:

http://localhost:8888/GRLegislation/pd/2011/54 ####### ####### ######### ##µ#####
##### #######µµ###### ########## ### ######## ### ####µ## ##### ### ###
########µ## ### (#### #####) text text/xml gr 2011-05-20 ###### A' 135 2011 ##
(######### ########) 54 2011 ######## ######### true ########## ######µ####
########## ##### true ########## ######µ###, ################## &#########
####### ########## true ########## #####µ##, ######### & ####### #######
######### true ######## ### ##µ######## ########## ### ####### ##### ########
#####
4

1 回答 1

0

搜索了一整天,我发现 Apache Cocoon 使用 Apache FOP 1.0 。还有一个最新版本的 FOP 1.1。具有 Maven 依赖项:

<dependency>
  <groupId>org.apache.xmlgraphics</groupId>
  <artifactId>fop</artifactId>
  <version>1.1</version>
</dependency>

这种依赖关系破坏了与其他一些依赖关系的链接,FOP 需要这些依赖关系,例如 Avalon 框架 4.2 。我在某处读到,也许这段代码可以解决这个问题:

<dependency>
  <groupId>org.apache.xmlgraphics</groupId>
  <artifactId>fop</artifactId>
  <version>1.1</version>
  <exclusions>
    <exclusion>
     <artifactId>avalon-framework-api</artifactId>
     <groupId>org.apache.avalon.framework</groupId>
    </exclusion>
    <exclusion>
     <artifactId>avalon-framework-impl</artifactId>
     <groupId>org.apache.avalon.framework</groupId>
    </exclusion>
  </exclusions>
  </dependency>
  <!-- these two are to correct issues in fop dependency --> 
  <dependency>
   <groupId>avalon-framework</groupId>
   <artifactId>avalon-framework-api</artifactId>
   <version>4.2.0</version>
  </dependency>
  <dependency>
   <groupId>avalon-framework</groupId>
   <artifactId>avalon-framework-impl</artifactId>
   <version>4.2.0</version>
  </dependency>

现在编译返回以下错误:“无法在项目 GRLegislation 上执行目标 org.apache.cocoon:cocoon-maven-plugin:1.0.0-M2:prepare (prepare): There are at least two artifacts with the ID 'avalon-框架 api': avalon 框架:avalon 框架 api:jar:4.2.0:compile"。

于 2014-01-25T13:11:32.667 回答