Subtype substitution
Subtype substitution is the use of a value whose dynamic type is derived from an expected type.
Subtype substitution does not change the actual type of a value. For example, if an xs:integer value is used where an xs:decimal value is expected, the value retains its type as xs:integer.
In the following example, the fn:compare function compares an xs:string
value to an xs:NCName value:
fn:compare("product", xs:NCName("product"))
The returned value is 0, which means that the arguments compare as equal. Although the fn:compare function expects arguments of type xs:string, the function can be invoked with a value of type xs:NCNAME because this type is derived from xs:string.
Subtype substitution is used whenever an expression is passed a value that is derived from an expected type.