Now that we know about values and types in XQuery, we describe how the static type system assigns types to expressions. The static type system checks that the type of an expression is compatible with the type required by the context in which the expression is used. If they are not compatible, the static type system raises a type error.
In the remaining sections, the term type refers to the static type associated with an XQuery expression. We use the phrase dynamic type whenever referring to the type associated with a value.
Literals are the simplest XQuery expressions. Every literal expression has one of the types xs:string, xs:integer, xs:decimal, or xs:double. Here are some examples:
"hello" has type xs:string 42 has ...