Is it possible to pass custom ANT parameters into custom plugin with DITA-OT?

一笑奈何 提交于 2019-12-23 04:09:43

问题


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.

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

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>

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>

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

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"/>

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)

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?


回答1:


You need to add an extension point for dita.conductor.com.mymods.pdf.param:

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

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"/>


来源:https://stackoverflow.com/questions/22715482/is-it-possible-to-pass-custom-ant-parameters-into-custom-plugin-with-dita-ot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!