The expression E cast as T
converts the value of expression E
to type
T
. Since T
must currently be a built-in schema-defined simple type, the
effect is exactly the same as using the constructor function T (E)
.
Saxon implements most of the conversions defined in the XPath 2.0 specifications, for the data types that it supports, but the details of how the conversions are performed may vary in detail. The specification is still evolving in this area.
The expression E treat as T
is designed for environments that perform static type
checking. Saxon doesn't do static type checking, so this expression has very little use, except to
document an assertion that the expression E
is of a particular type. A run-time failure
will be reported if the value of E
is not of type T
; no attempt is made
to convert the value to this type.