<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="extensibility" page="converting-args" subpage="converting-atomic"/>
      <!--
           Generated at 2010-10-29T18:20:48.427+01:00--><title>Saxonica: XSLT and XQuery Processing: Converting Atomic Values</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title"
            content="Saxonica: XSLT and XQuery Processing: Converting Atomic Values"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>Converting Atomic Values</h1>
      <p>This section describes the conversions that occur when calling a method that expects an atomic value, such as a String or
 a boolean.</p>
      <p>If the supplied value is a node, then it is atomized.</p>
      <p>If the supplied value contains more than item and only a single item is expected, an error is reported. There is no
 implicit extraction of the first value (as happened in earlier Saxon releases).</p>
      <p>If the supplied value is an empty sequence, then a null value is passed. However, if the required type is a primitive Java
 type such as <code>int</code> or <code>bool</code>, then passing an empty sequence will result in a type error.</p>
      <p>In other cases, the supported conversions are as follows. Italicized names are Saxon-specific classes in package
 <code>net.sf.saxon.value</code>.</p>
      <table>
         <tr>
            <td content="para">
               <p>
                  <b>Supplied type</b>
               </p>
            </td>
            <td content="para">
               <p>
                  <b>Required type</b>
               </p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>boolean</p>
            </td>
            <td content="para">
               <p>
                  <i>BooleanValue</i>, Boolean</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>dateTime</p>
            </td>
            <td content="para">
               <p>
                  <i>DateTimeValue</i>, Date</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>date</p>
            </td>
            <td content="para">
               <p>
                  <i>DateValue</i>, Date</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>decimal</p>
            </td>
            <td content="para">
               <p>
                  <i>DecimalValue</i>, BigDecimal, Double, Float</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>double</p>
            </td>
            <td content="para">
               <p>
                  <i>DoubleValue</i>, Double</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>duration</p>
            </td>
            <td content="para">
               <p>
                  <i>DurationValue</i>
               </p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>float</p>
            </td>
            <td content="para">
               <p>
                  <i>FloatValue</i>, Float, Double</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>integer, long, int</p>
            </td>
            <td content="para">
               <p>
                  <i>IntegerValue</i>, BigInteger, BigDecimal, Long, Integer, Double, Float</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>short</p>
            </td>
            <td content="para">
               <p>
                  <i>IntegerValue</i>, BigInteger, BigDecimal, Long, Integer, Short, Double, Float</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>byte</p>
            </td>
            <td content="para">
               <p>
                  <i>IntegerValue</i>, BigInteger, BigDecimal, Long, Integer, Short, Byte, Double, Float</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>string</p>
            </td>
            <td content="para">
               <p>
                  <i>StringValue</i>, (String, CharSequence)</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>anyURI</p>
            </td>
            <td content="para">
               <p>
                  <i>AnyURIValue</i>, java.net.URI, java.net.URL, (String, CharSequence)</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>QName</p>
            </td>
            <td content="para">
               <p>
                  <i>QNameValue</i>, javax.xml.namespace.QName</p>
            </td>
         </tr>
      </table>
      <p>A required type of one of the Java primitive types such as <code>int</code> or <code>bool</code> is treated as
equivalent to the corresponding boxed type (<code>Integer</code> or <code>Boolean</code>), except that with the boxed
types, an empty sequence can be supplied in the function call and is translated to a Java null value as the actual
argument.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="converting-node.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>