この質問は次のとおりです: DITA-OT を使用してカスタム ANT パラメーターをカスタム プラグインに渡すことは可能ですか?
DITA-OT/plugins フォルダーの下にcom.mymods.pdfというプラグイン フォルダーがあります。以下では、構造とファイルについて簡単に説明します (この例に厳密に従いますhttp://dita-ot.github.io/1.8/readme/dita2pdf-customization.html )。プラグインは機能しますが、ANT コマンド ライン パラメーターを mycustom.xsl に渡したいと思います。
com.mymods.pdf/
cfg/
common/
vars/
en.xml
fo/
attrs/
mycustom.xsl
xsl/
mycustom.xsl
catalog.xml
integrator.xml
plugin.xml
build_mymods_pdf_template.xml (dita2com.mymods.pdf.init target is here and it depends on dita2pdf2)
build.xml (<project><import file="build_mymods_pdf.xml"/></project>)
insertParameters.xml (see the linked question for contents)
では、どこに変更を適用したり、新しいファイルを追加したりする必要があるのでしょうか?
「dita2mymodsPDF」を使用するためのターゲットとトランスタイプを持つ「mainANT.xml」を使用して、別の場所からプラグインを使用します。
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"/>
<extension-point id="dita.conductor.com.mymods.pdf.param" name="PDF XSLT parameters"/>
</plugin>
build_mymods_pdf_template.xml コード:
<?xml version='1.0' encoding='UTF-8'?>
<project name="com.mymods.pdf" default="com.mymods.pdf">
<property name="transtype" value="com.mymods.pdf"/>
<target name="dita2com.mymods.pdf.init">
<property location="${dita.plugin.com.mymods.pdf.dir}/cfg" name="customization.dir" />
<property location="${dita.plugin.com.mymods.pdf.dir}/xsl/fo/topic2fo_shell_fop.xsl" name="args.xsl.pdf" />
<property name="args.chapter.layout" value="BASIC" />
<property name="args.bookmark.style" value="COLLAPSED" />
<!--property name="args.fo.include.rellinks" value="nofamily" /-->
</target>
<target depends="dita2com.mymods.pdf.init, dita2pdf2" name="dita2com.mymods.pdf" />
</project>
また、integrator.xml コード:
<?xml version='1.0' encoding='UTF-8'?>
<project name="com.mymods.pdf">
<target name="dita2com.mymods.pdf.init">
<property location="${dita.plugin.com.mymods.pdf.dir}/cfg" name="customization.dir" />
<property location="${dita.plugin.com.mymods.pdf.dir}/xsl/fo/topic2fo_shell_fop.xsl" name="args.xsl.pdf" />
<property name="args.chapter.layout" value="BASIC" />
<property name="args.bookmark.style" value="COLLAPSED" />
<!--property name="args.fo.include.rellinks" value="nofamily" /-->
</target>
<target depends="dita2com.mymods.pdf.init, dita2pdf2" name="dita2com.mymods.pdf" />
</project>
integrator.xml または build_mymods_pdf_template.xml が実際にそうあるべきかどうかは完全にはわかりません。しかし、このファイルセットは機能し、mycustom.xsl を使用します (属性には other、XSLT オーバーライドには other)。ここでの問題は、プラグインがその値を認識できるように、独自のカスタム ANT パラメータを取得する方法です。
これは pdf2 プラグインの場合は非常に簡単ですが、まだcom.mymods.pdf内で動作させることはできません。正常に動作している「mycustom.xsl」ファイルがどこにあるかを示すだけなので、catalog.xml を投稿する必要はないと思います。