You need to declare $currentTotal as a stylesheet parameter. Add the following, as a child of the xsl:stylesheet element:

<xsl:param name="currentTotal" as="xsd:double" required="yes"/>

Michael Kay

On 08/08/2010 15:40, Full Midnight wrote:
Hi all,

I have the following XSLT 2.0 template in my style-sheet:
<xsl:template name="t1">
   <xsl:variable name="totalpos" as="xsd:double" select="$currentTotal"/>

I am struggling to provide currentTotal as a parameter to the transformer, like this:
System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl");
TransformerFactoryImpl transformerFactory = new TransformerFactoryImpl();
Transformer transformer = transformerFactory.newTransformer(inputNodes);

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?
What I am doing wrong? How should I invoke the setParameter() call so that the currentTotal defined in my application will be seen inside the style-sheet?

Thank you in advance!
------------------------------------------------------------------------------ This email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge
_______________________________________________ saxon-help mailing list archived at