Automatic downcasting

In 4.0, the term coercion rules replaces function conversion rules.

The coercion rules (which determine how the supplied value for a function argument or XSLT variable can differ from the declared type) now allow downcasting. For example, if the required type is declared as xs:positiveInteger then the supplied value can be 42: there is no longer any need for the caller to cast it as xs:positiveInteger(42). Of course, an error occurs if the cast fails. The effect of this is to make derived types such as xs:positiveInteger much more usable. Note that this rule doesn't allow any casting operation, only a strict relabelling of the supplied value. For example, if the required type is xs:integer then you can supply the decimal value 3.0, but you can't supply 3.1, even though casting 3.1 to xs:integer is allowed.