This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
I don't understand why XPTY0004 should be raised here. The declared type of the external variable $ext is xs:integer, and the value 862 assigned to this variable is an instance of xs:integer. The fact that the default value for $ext is a node should not matter.
A processor is certainly allowed to raise a type error here during static analysis (the inferred type of the initializer doesn't match the required type of the variable) but I agree that it isn't required to detect this during static analysis and that if it doesn't, the query will run successfully. So there should be an alternative result. Which I have added.