saxonica.com

Cast as, Treat as

The expression E cast as T converts the value of expression E to type T. Whether T is a built-in type or a user-defined type, the effect is exactly the same as using the constructor function T (E).

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.

Next