Thanks for this answer.  It does not seem terribly intuitive.  After all by supplying an 'as' attribute I am telling the processor what I expect the contents to be treated as.
 
Martin


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Michael Kay
Sent: 18 July 2008 15:01
To: 'Mailing list for the SAXON XSLT and XQuery processor'
Subject: Re: [saxon] Error with parameters

The rules here are the same as the rules for function calling: if a function expects an integer, then you can pass it an integer, or an untypedAtomic value, or a node containing an integer or an untypedAtomic value, but you can't pass it (for example) a string or a double.
 
Either pass an integer as the value, or pass an untypedAtomic value (this is what happens from the command line), or declare the parameter as being of type string, and convert it to an integer by casting, that is xs:integer($param).
 
Also, I would suggest getting into the habit of writing this kind of thing as
 
<xsl:param name="logLevel" as="xs:integer" select="1"/>
 
It's much more direct, and in some cases much more efficient, to initialize the value to the integer 1, rather than to a document node containing a text node containing the string representation of the number 1.
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of martin.me.roberts@bt.com
Sent: 18 July 2008 13:37
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Error with parameters

Hi, 
 
 I am getting a "Cannot promote non-numeric value to xs:integer" with a parameter value. The parameter definition looks like this:
 
    <xsl:param name="logLevel" as="xsd:integer">1</xsl:param>
 
  When setting up the parameters in Java I pass in a value as a string.
 
Can you please help?
 
Martin