2

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?

sailfish
  • 43
  • 6

1 Answers1

0

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"/>
jelovirt
  • 5,844
  • 8
  • 38
  • 49
  • Now it runs through and creates PDF. For some reason I can't pass value properly from ANT-script into mycustom.xsl. Therefore "custom.data1" and "custom.data2" are empty. Extra info: parameter values are given straightly from command line. Thanks for helping me this far already! – sailfish Mar 31 '14 at 10:42
  • Do you have processing for `dita.conductor.com.mymods.pdf.param` in your Ant? Note that your custom extension point doesn't automagically process the parameters, you have to explicitly implement it in your Ant script with something like ``. – jelovirt Mar 31 '14 at 12:36
  • Which ANT script do you mean? Plugin directory's `build_mymods_pdf_template.xml` and there to ``? Then I should add an XSLT task which includes `` elements as in `insertParameters.xml`? – sailfish Apr 02 '14 at 12:07
  • Yes, in `build_mymods_pdf_template.xml`. There is nothing about the extension name `dita.conductor.com.mymods.pdf.param` that makes it being used to pass parameters, it's just an extension point name. Thus, you have to tell DITA-OT exactly what to do with it. In this case using the `InsertAction` processing. – jelovirt Apr 03 '14 at 15:53
  • Added to build_my_mods_pdf_template.xml into : `` And I keep getting this error: **xslt doesn't support the nested "extension" element.** Seems that I have to do something with extension point attribute but can't figure out how in this case. – sailfish Apr 07 '14 at 08:23
  • Are you trying to use `build_mymods_pdf_template.xml` as is as the Ant script? DITA-OT doesn't dynamically process extensions, thus you have to declare `build_mymods_pdf_template.xml` as a template in your `plugin.xml` and use the generated `build_mymods_pdf.xml` as the Ant script. – jelovirt Apr 07 '14 at 18:43
  • Yes. I forgot to add it here but yes it has been there for the last tries before answering my own question. I also changed build.xml to import generated `build_mymods_pdf.xml` and then I faced that problem what I had in my earlier comment. – sailfish Apr 08 '14 at 05:52