Xalan について

[1] 関連リンク

[2] Xalan とは何か

Xalan はXML文書をHTML, text 並びに他のXML文書型へ変換するためのXSLTプロセッサです。

"Xalan is an XSLT processor for transforming XML documents into HTML, text, or other XML document types."

[3] 前提事項

以下ではつぎの環境を前提にしています。

※ Windows2000以外の環境では試していません。また Cygwin 環境は必須ではありません。

[4] インストールのための準備

あらかじめ Xalan と Xerces のためのインストールディレクトリを設けておきます。

たとえば /usr/local/xmlapache など。これを以下 $XML_APACHE と呼びます。

[5] Xerces C++ のインストール

まず Xerces C++ からインストールします。

apache.org のアーカイブ http://archive.apache.org/dist/xml/ から

をダウンロードします(バージョンは変わってることがあるから適宜読みかえること)。

これを $XML_APACHE に置いて、まずチェックサムを行います。チェックサムは Cygwin の場合

$ md5sum -c xerces-c_2_5_0-windows_nt-msvc_60.zip.md5

で出来ます。うまくいけば

xerces-c_2_5_0-windows_nt-msvc_60.zip: OK

と出るはずです(うまくいかなければダウンロードしたファイルは怪しいということ)。

つづいて md5sum -c xerces-c_2_5_0-windows_nt-msvc_60.zip を解凍・展開します。

$ unzip xerces-c_2_5_0-windows_nt-msvc_60.zip

xerces-c_2_5_0-windows_nt-msvc_60 ディレクトリが作られているはずです。

[6] Xalan C++ のインストール

やはりアーカイブ http://archive.apache.org/dist/xml/ から

をダウンロードします。

これを $XML_APACHE に置きます。

Xalan-C_1_8_0-windows_2000-msvc_60.zip を解凍・展開します。

$ unzip Xalan-C_1_8_0-windows_2000-msvc_60.zip

Xalan-C_1_8_0-windows_2000-msvc_60 ディレクトリが作られます。

[7] パスの設定(Cygwinの場合)

.bash_profile に次の行を書き加えます。


xmlapache=/usr/local/xmlapache
PATH=$PATH:$xmlapache/xerces-c_2_5_0-windows_nt-msvc_60/bin:$xmlapache/Xalan-C_1
_8_0-windows_2000-msvc_60/bin

※ 変数 xmlapache は$XML_APACHEに設定すること。上の例は XML_APACHE=/usr/local/xmlapache の場合を想定してある。

これで Cygwin の起動と同時に xalan が使えるようになっているはずです。

[8] テスト

ホームディレクトリから


$ xalan

を実行してみてください。

Xalan version 1.8.0.
Xerces version 2.5.0.
Usage: Xalan [options] source stylesheet
Options:
-a Use xml-stylesheet PI, not the 'stylesheet' argument
-e encoding Force the specified encoding for the output.
-i integer Indent the specified amount.
-m Omit the META tag in HTML output.
-o filename Write output to the specified file.
-p name expression Sets a stylesheet parameter.
-t Display timing information.
-u Disable escaping of URLs in HTML output.
-? Display this message.
-v Validates source documents.
- A dash as the 'source' argument reads from stdin.
('-' cannot be used for both arguments.)

と表示されれば正常です。