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
cast as type(item)
permanently changes the type of an item
treat as type(item)
temporarily changes
the type
of the item for this expression only
if ($x castable as xsd:gYear)
then cast as xsd:gYear($x)
else if ($x castable as xsd:integer)
then cast as xsd:integer($x)
else if ($x castable as xsd:decimal)
then cast as xsd:decimal($x)
else cast as string($x)