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

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

手順

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

この指定により、その実行時に (例えば、fn:doc() または document() 関数などへの 呼び出しで) 参照された URI をインタープリットする方法がプロセッサーに指示されます。

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

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

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

XStaticContext staticContext = factory.newStaticContext();

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

XDynamicContext dynamicContext = factory.newDynamicContext();
// Register the source resolver with the dynamic context
XSourceResolver sourceResolver=new ASourceResolver(replacementBase);
dynamicContext.setSourceResolver(sourceResolver);

// Execute the XPath expression
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_exec
ファイル名:txml_resolvers_source_exec.html