instance of
tests the type of an item against the QName of a type
Casting changes the type of an item
Not all casts are legal, but mostly it works like you'd expect.
castable
returns true if the cast is possible, false otherwise
item cast as type
permanently changes the type of an item
item treat as type
temporarily changes
the type
of the item for this expression only
if ($x castable as xs:gYear)
then $x cast as xs:gYear
else if ($x castable as xs:integer)
then $x cast as xs:integer
else if ($x castable as xs:decimal)
then $x cast as xs:decimal
else $x cast as string