作成時におけるソース・リゾルバーの使用

実行可能ファイルの作成時にソース・リゾルバーを指定すると、 そのときに参照された URI をインタープリットする方法をプロセッサーに指示できます。

手順

実行可能ファイルの作成時にソース・リゾルバーを指定します。

この指定により、その作成時に (例えば、スタイルシート の xsl:import および xsl:include ディレクティブ内で) 参照された URI を インタープリットする方法がプロセッサーに指示されます。

デフォルトのソース解決動作としては、 基本 URI が使用可能な場合には、式、照会、またはスタイルシートの 基本 URI に基づいて相対 URI をインタープリットし、基本 URI が使用不可の場合には、 現行作業ディレクトリーに相対のファイル・パスとしてこれらの URI をインタープリットします。 絶対 URI はそのまま使用されます。

この動作を変更するには、XSourceResolver インターフェースを実装する Java™ クラスを作成し、スタイルシートの作成前に このクラスを XStaticContext に登録します。

以下に、ソース・リゾルバーの登録方法についての基本的な例を示します。
XFactory factory = XFactory.newInstance();

// Register the source resolver with the static context
XStaticContext staticContext = factory.newStaticContext();
XSourceResolver sourceResolver=new ASourceResolver(replacementBase);
staticContext.setSourceResolver(sourceResolver);

// Prepare the sylesheet
XSLTExecutable executable = factory.prepareXSLT(new StreamSource(stylesheetFile), staticContext);

XDynamicContext dynamicContext = factory.newDynamicContext();

// Execute the stylesheet
XSequenceCursor cursor = executable.execute(new StreamSource(inputFile), dynamicContext);

トピックのタイプを示すアイコン タスク・トピック



タイム・スタンプ・アイコン 最終更新: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=txml_resolvers_source_prep
ファイル名:txml_resolvers_source_prep.html