是否可以通过自定义的ANT参数到自定义插件使用DITA-OT? [英] Is it possible to pass custom ANT parameters into custom plugin with DITA-OT?

查看:689
本文介绍了是否可以通过自定义的ANT参数到自定义插件使用DITA-OT?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建DITA-OT PDF插件,做工不错,并像它应该。下一步是ANT参数传递到我的自定义插件的压倒一切的XSLT文件。正如你可以看到这个扩展插件pdf2加工和我有一个正在自定义样式表。

I have created DITA-OT PDF plugin that works good and like it should. Next step is to pass ANT parameters into my custom plugin's overriding XSLT files. As you can see this extends pdf2 plugin processing and I have custom stylesheets which are working.

下面是关于如何做到这一点的文档。这适用于默认插件(pdf2,XHTML。等)
http://dita-ot.github.io/1.8/dev_ref/plugin -xsltparams.html

Here is documentation about how to do this. This works for default plugins (pdf2, xhtml. etc) http://dita-ot.github.io/1.8/dev_ref/plugin-xsltparams.html

但是,当我尝试做同样的伎俩对我自己的插件,我从来没有能够通过整合运行。我已经加入以下行的plugin.xml

But when I try to do the same trick for my own plugin I never can run integration through. I have added following line into "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看起来像:

And my "insertParameters.xml" looks like that:

<?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我得到这样的:

Then when I try to integrate changes into DITA-OT I get this:

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插件而不是我自己的插件:

One additional info: I have tried to change in "plugin.xml" one line to point to original pdf2 plugin instead of my own plugin:

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

然后整合是全成,但后来当我尝试处理PDF输出与我的插件,我得到的错误导致构建失败:

Then integration is successfull but then when I try to process pdf output with my plugin I get error that causes 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为例)?什么我哪里做错了?

Is it possible at all to pass ANT parameters into custom plugin XSLT processing or is it only possible to default DITA-OT transformation scenarios (pdf2,xhtml for example)? What I'm I doing wrong?

推荐答案

您需要添加一个的扩展点 dita.conductor.com.mymods.pdf.param

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

如果你想通过与自定义扩展点定义的参数,你需要将这些参数添加到 mycustom.xsl

If you want to pass the parameters defined with your custom extension point, you need to add those parameters into mycustom.xsl:

<xsl:param name="custom.data1"/>
<xsl:param name="custom.data2"/>

这篇关于是否可以通过自定义的ANT参数到自定义插件使用DITA-OT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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