2

我创建了 DITA-OT PDF 插件,效果很好,而且应该。下一步是将 ANT 参数传递到我的自定义插件的覆盖 XSLT 文件中。正如您所看到的,这扩展了 pdf2 插件处理,并且我有正在工作的自定义样式表。

这是有关如何执行此操作的文档。这适用于默认插件(pdf2、xhtml 等) http://dita-ot.github.io/1.8/dev_ref/plugin-xsltparams.html

但是当我尝试为自己的插件做同样的事情时,我永远无法运行集成。我在“plugin.xml”中添加了以下行

<?xml version='1.0' encoding='UTF-8'?>
<plugin id="com.mymods.pdf">
  <require plugin="org.dita.pdf2" />
  <feature extension="dita.conductor.transtype.check" value="com.mymods.pdf" />
  <feature extension="dita.transtype.print" value="com.mymods.pdf" />
  <feature extension="dita.conductor.target.relative" file="integrator.xml" />
  <feature extension="dita.conductor.com.mymods.pdf.param" file="insertParameters.xml"/>
<template file="build_mymods_pdf_template.xml"/>
</plugin>

我的“insertParameters.xml”看起来像这样:

<?xml version='1.0' encoding='UTF-8'?>
<dummy>
  <!-- EXAMPLE: <param name="paramNameinXSLT" expression="${antProperty}" if="antProperty"/> -->
  <param name="custom.data1" expression="${custom.data1}" if="custom.data1"/>
  <param name="custom.data2" expression="${custom.data2}" if="custom.data2"/>
</dummy>

然后,当我尝试将更改集成到 DITA-OT 中时,我得到了这个:

BUILD FAILED
DITA-OT1.8.4\integrator.xml:59: The following error occurred while executing this line:
DITA-OT1.8.4\integrator.xml:49: Integration failed: Plug-in com.mymods.pdf uses an undefined extension point dita.conductor.com.mymods.pdf.param

一个附加信息:我试图在“plugin.xml”中更改一行以指向原始 pdf2 插件而不是我自己的插件:

<feature extension="dita.conductor.pdf2.param" file="insertParameters.xsl"/>

然后集成成功,但是当我尝试使用我的插件处理 pdf 输出时,我收到导致 BUILD FAILED 的错误:

mycustom.xsl Fatal Error! Variable custom.data1 has not been declared (or its declaration is not in scope)
mycustom.xsl Fatal Error! Variable custom.data2 has not been declared (or its declaration is not in scope)

是否可以将 ANT 参数传递到自定义插件 XSLT 处理中,还是只能使用默认的 DITA-OT 转换场景(例如 pdf2、xhtml)?我做错了什么?

4

1 回答 1

0

您需要为以下内容添加扩展dita.conductor.com.mymods.pdf.param

<extension-point id="dita.conductor.com.mymods.pdf.param"
                 name="Custom parameters"/>

如果要传递使用自定义扩展点定义的参数,则需要将这些参数添加到mycustom.xsl

<xsl:param name="custom.data1"/>
<xsl:param name="custom.data2"/>
于 2014-03-29T07:06:19.480 回答