DITA-OTの2009年1月的インストール
お金を使わずにDITAを導入する為には,DITA Open Toolkit (DITA-OT)を使うのが一般的だ.
しかし,日本語情報があまりないプロダクトを使う時の常.あちこちにハマりどころがある.
まず,動作環境の構築から.DITAはantで動くのが前提となっているので,antおよびJDK(JRE)のインストールが要る.
fopとかxercesとか色々利用しているモジュールがあるのだけれども,full_easy_install_bin パッケージを選ぶと,
かなり楽.
$ java -version java version "1.5.0_16" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284) Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)
# mkdir -p /opt # cd /opt # tar xvjf /{どこか}/DITA-OT1.4.2.1_full_easy_install_bin.tar.gz
ただし,これだけでは済まない.
PDFのビルドでエラーとその対策
早速,パッケージに含まれるデモをビルドしてみよう.
# cd DITA-OT1.4.2.1 # ant -f build_demo.xml
以下,ログが長いので,かいつまんで.
Buildfile: build_demo.xml
(中略)
[input] The DITA map filename: [/opt/DITA-OT1.4.2.1/samples/hierarchy.ditamap]
入力が促されるので,単にリターンを押す.
[input] The output directory (out): [out]
ここも単にリターン.
[input] The output type: (eclipse, htmlhelp, javahelp, pdf, [web], docbook) pdf
ここでは,PDFを選ぶ.
[input] Continue? (Y, [y], N, n)
ここは,単に,リターン.
そうすると,ビルドが開始される…のだが.
dita.map.fo: [xslt] Processing /opt/DITA-OT1.4.2.1/temp/hierarchy.ditamap to /opt/DITA-OT1.4.2.1/temp/hierarchy_MERGED.xml [xslt] Loading stylesheet /opt/DITA-OT1.4.2.1/xsl/topicmerge.xsl [xslt] : Error! file:/opt/DITA-OT1.4.2.1/xsl/topicmerge.xsl: line 60: 属性 'refclass' がエレメントの外側です。 [xslt] : Error! file:/opt/DITA-OT1.4.2.1/xsl/topicmerge.xsl: line 74: 属性 'refclass' がエレメントの外側です。 [xslt] : Error! file:/opt/DITA-OT1.4.2.1/xsl/topicmerge.xsl: line 95: 属性 'refclass' がエレメントの外側です。 [xslt] : Error! /opt/DITA-OT1.4.2.1/tasks/changingtheoil.xml (No such file or directory) [xslt] : Error! File not found: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: /opt/DITA-OT1.4.2.1/tasks/changingtheoil.xml (No such file or directory) [xslt] : Error! com.sun.org.apache.xalan.internal.xsltc.TransletException: java.io.FileNotFoundException: ../tasks/changingtheoil.xml [xslt] Failed to process /opt/DITA-OT1.4.2.1/temp/hierarchy.ditamap BUILD FAILED /opt/DITA-OT1.4.2.1/build_demo.xml:707: The following error occurred while executing this line: /opt/DITA-OT1.4.2.1/build_demo.xml:778: The following error occurred while executing this line: /opt/DITA-OT1.4.2.1/build_dita2pdf.xml:32: The following error occurred while executing this line: /opt/DITA-OT1.4.2.1/build_dita2pdf.xml:59: javax.xml.transform.TransformerException: com.sun.org.apache.xalan.internal.xsltc.TransletException: com.sun.org.apache.xalan.internal.xsltc.TransletException: java.io.FileNotFoundException: ../tasks/changingtheoil.xml Total time: 21 seconds
デモサンプルのビルドができないってのは,どーよそれって.
PDFのビルドでエラー,その対策
ビルドができないっていうのは,かなーり深刻だと思うのだけれども,googleでいくら情報を漁っても出てこない.
似た情報はあるのだけれど…いまさら1.4系に戻すのは抵抗があるし,たぶんいくつかのclassファイルは,既に1.5系でないと動かないだろうし.
本当は,ここで2時間近く経ち往生したのだけれど,結論を書く.dita-otのダウンロードページから,fo-1.4.2jdk1.5.zip を取得し、中にあるREADME.txtの通りにインストールする.Saxon 6.5.5 もインストールせよと書いてあるので,同じくsourceforgeから取得する.
私が試した範囲では,最新のsaxon9でも動作するようだ.この場合は,もちろんJava版を.最近は.NET版などもあるので念の為.
インストールを終えたら,先程と同じように ant -f build_demo.xml とする.
数十秒ほど待つと….
dita.fo2pdf.nouserconfig: [fop] [INFO] Using com.icl.saxon.aelfred.SAXDriver as SAX2 Parser [fop] [INFO] Using com.icl.saxon.aelfred.SAXDriver as SAX2 Parser [fop] /opt/DITA-OT1.4.2.1/out/hierarchy.fo -> /opt/DITA-OT1.4.2.1/out/hierarchy.pdf [fop] [INFO] building formatting object tree [fop] [INFO] setting up fonts [fop] [INFO] [1] [fop] [INFO] [2] [fop] [INFO] [1] [fop] [INFO] [2] [fop] [INFO] [3] [fop] [INFO] [4] [fop] [INFO] [5] [fop] [INFO] [6] [fop] [INFO] Parsing of document complete, stopping renderer topic2pdf: dita2pdf: prompt.output.web: prompt.output.docbook: prompt.output: [echo] [echo] output in the out directory [echo] [echo] Before rebuilding, please delete the output or the directory. BUILD SUCCESSFUL Total time: 18 seconds
out/hierarchy.pdf が生成される.これで DITA-OTのインストールは完了.
…しかし,困難はまだ続くのであった.