I have the following XSLT 2.0 template:
<xsl:template name="t1">
<xsl:variable name="totalpos" as="xsd:double" select="$currentTotal"/>
..
I am struggling to programmatticaly provide currentTotal
as a parameter to the transformer, like this:
transformer.setParameter("currentTotal", new Double("100"))
.. but without any positive results:
Error at /xsl:transform/xsl:template[3]/xsl:variable[1] XPST0008: XPath syntax error at char 13 on line -1 in {$currentTotal}: Variable $currentTotal has not been declared
When calling setParameter()
, the currentTotal
variable will also get defined, right?
How should I invoke the setParameter()
call so that the currentTotal
defined in my application will be seen inside the style-sheet?
For clarification, I am instantiating the transformer like this:
System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl");
transformerFactory = new TransformerFactoryImpl();
transformer = transformerFactory.newTransformer(inputNodes);