问题描述
限时送ChatGPT账号..我已经创建了 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.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.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 输出时,我收到导致 BUILD FAILED 的错误:
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.mymods.pdf.param
:
<extension-point id="dita.conductor.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"/>
这篇关于是否可以使用 DITA-OT 将自定义 ANT 参数传递到自定义插件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论