I agree this would be a useful addition to the spec. I can't think of any reason why it's not in there. I don't think it's been requested. I don't know why I didn't push for it myself - I just put it down to being too busy - as you probably know, there's a Saxon extension to provide a default value.
It's unlikely to make it in now - new features are pretty well banned. But you could raise it as a public comment anyway - it's a good time to get things on the list for v2.
Michael Kay

From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Marcus.Edwards@digitalsteps.com
Sent: 18 August 2005 09:24
To: saxon-help@lists.sourceforge.net
Subject: [saxon] [OT] XQuery variable default values

Dr Kay,

Although this post does not relate to Saxon directly, it does deal with XQuery and since you have demonstrated a deep knowledge and understanding of the spec, I thought I'd ask it here. If you feel that this question would be better directed to another forum, could you point me in the right direction.

Do you have any insight as to why the XQuery spec doesn't  allow variables with 'external' to be declared with an initial value? "If the variable declaration includes the keyword external, a value must be provided for the variable by the external environment before the query can be evaluated." (http://www.w3.org/TR/xquery/#id-variable-declarations)

XSLT provides this facility for it's parameter declarations: "[DEFINITION: A top-level xsl:param element declares a stylesheet parameter. A stylesheet parameter is a global variable with the additional property that its value can be supplied by the caller when a transformation is initiated.]" (http://www.w3.org/TR/xslt20/#global-variables)

Having this facility in XQuery would be tremendously useful for all the same reasons that being able to override an XSLT stylesheet parameter is useful.

-- Marcus