<?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet href="../make-menu.xsl" type="text/xsl"?><html> <head> <this-is section="expressions" page="cast" subpage=""/> <!-- Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: Cast as, Treat as</title> <meta name="coverage" content="Worldwide"/> <meta name="copyright" content="Copyright Saxonica Ltd"/> <meta name="title" content="Saxonica: XSLT and XQuery Processing: Cast as, Treat as"/> <meta name="robots" content="noindex,nofollow"/> <link rel="stylesheet" href="../saxondocs.css" type="text/css"/> </head> <body class="main"> <h1>Cast as, Treat as</h1> <p>The expression <code>E cast as T</code> converts the value of expression <code>E</code> to type <code>T</code>. Whether T is a built-in type or a user-defined type, the effect is exactly the same as using the constructor function <code>T (E)</code>.</p> <p>The expression <code>E treat as T</code> 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 <code>E</code> is of a particular type. A run-time failure will be reported if the value of <code>E</code> is not of type <code>T</code>; no attempt is made to convert the value to this type.</p> <table width="100%"> <tr> <td> <p align="right"><a class="nav" href="except.xml">Next</a></p> </td> </tr> </table> </body> </html>