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" の 1 行を、自分のプラグインではなく元の 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 に答える