次の XSLT 2.0 テンプレートがあります。
<xsl:template name="t1">
<xsl:variable name="totalpos" as="xsd:double" select="$currentTotal"/>
..
currentTotal
次のように、トランスフォーマーにパラメーターとしてプログラムで提供するのに苦労しています。
transformer.setParameter("currentTotal", new Double("100"))
..しかし、肯定的な結果はありません:
/xsl:transform/xsl:template[3]/xsl:variable[1] でのエラー XPST0008: {$currentTotal} の行 -1 の char 13 での XPath 構文エラー: 変数 $currentTotal が宣言されていません
を呼び出すsetParameter()
と、currentTotal
変数も定義されますよね?アプリケーションで定義された がスタイルシート内に表示されるsetParameter()
ようにするには、どのように呼び出しを呼び出す必要がありますか?currentTotal
明確にするために、次のようにトランスフォーマーをインスタンス化しています。
System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl");
transformerFactory = new TransformerFactoryImpl();
transformer = transformerFactory.newTransformer(inputNodes);