<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/xdmp.formatNumber.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>xdmp.formatNumber</api:function-name><api:suggest>xdmp.formatnumber</api:suggest><api:suggest>xdmp</api:suggest><api:suggest>formatnumber</api:suggest><api:function-link mode="xquery" fullname="xdmp:format-number">/apidoc/8.0/xdmp:format-number.xml</api:function-link><api:function mode="javascript" name="formatNumber" type="builtin" lib="xdmp" category="Extension" subcategory="XSLT" hidden="false" bucket="MarkLogic Built-In Functions" prefix="xdmp" namespace="http://marklogic.com/xdmp" fullname="xdmp.formatNumber"><api:summary>
   Returns a formatted number value based on the picture argument.
   The difference between this function and the W3C standards
   <code xmlns="http://www.w3.org/1999/xhtml">fn:format-number</code> function is that this function imitates
   the XSLT <code xmlns="http://www.w3.org/1999/xhtml">xsl:number</code> instruction, which has richer
   formatting options than the <code xmlns="http://www.w3.org/1999/xhtml">fn:format-number</code> function.
   This function can be used for spelled-out and ordinal numbering
   in many languages.  This function is
   available in XSLT as well as in all dialects of XQuery and Server-Side
   JavaScript.
 </api:summary><api:params><api:param name="value" type="xs:numeric*" optional="false"><api:param-description>
     The given numeric <code xmlns="http://www.w3.org/1999/xhtml">$value</code> that needs to be formatted.
   </api:param-description><api:param-name>value</api:param-name><api:param-type>xs.numeric[]</api:param-type></api:param><api:param name="picture" type="xs:string?" optional="true"><api:param-description>
     The desired string representation of the given numeric <code xmlns="http://www.w3.org/1999/xhtml">$value</code>.
     The picture string is a sequence of characters, in which the
     characters represent variables such as, decimal-separator-sign,
     grouping-sign, zero-digit-sign, digit-sign, pattern-separator,
     percent sign and per-mille-sign.  For details on the picture string, see
     <a href="http://www.w3.org/TR/xslt20/#date-picture-string" target="_blank" xmlns="http://www.w3.org/1999/xhtml">http://www.w3.org/TR/xslt20/#date-picture-string</a>.
     Unlike fn:format-number(), here the picture string allows
     spelled-out (uppercase, lowercase and Capitalcase) formatting.
   </api:param-description><api:param-name>picture</api:param-name><api:param-type>String?</api:param-type></api:param><api:param name="language" type="xs:string?" optional="true"><api:param-description>
     The desired language for string representation of the numeric
     <code xmlns="http://www.w3.org/1999/xhtml">$value</code>.
     An empty sequence must be passed in even if a user doesn't want to
     specifiy this argument.
   </api:param-description><api:param-name>language</api:param-name><api:param-type>String?</api:param-type></api:param><api:param name="letter-value" type="xs:string?" optional="true"><api:param-description>
     Same as letter-value attribute in xsl:number. This argument is
     ignored during formatting as of now. It may be used in future.
     An empty sequence must be passed in even if a user doesn't want to
     specifiy this argument.
   </api:param-description><api:param-name>letter-value</api:param-name><api:param-type>String?</api:param-type></api:param><api:param name="ordchar" type="xs:string?" optional="true"><api:param-description>
     If $ordchar is "yes" then ordinal numbering is attempted. If this
     is any other string, including an empty string, then then cardinal
     numbering is generated.
     An empty sequence must be passed in even if a user doesn't want to
     specifiy this argument.
   </api:param-description><api:param-name>ordchar</api:param-name><api:param-type>String?</api:param-type></api:param><api:param name="zero-padding" type="xs:string?" optional="true"><api:param-description>
     Value of $zero-padding is used to pad integer part of a number on
     the left and fractional part on the right, if needed.
     An empty sequence must be passed in even if a user doesn't want to
     specifiy this argument.
   </api:param-description><api:param-name>zero-padding</api:param-name><api:param-type>String?</api:param-type></api:param><api:param name="grouping-separator" type="xs:string?" optional="true"><api:param-description>
     Value of $grouping-separator is a character, used to groups of digits,
     especially useful in making long sequence of digits more readable.
     For example, 10,000,000- here "," is used as a separator after
     each group of three digits.
     An empty sequence must be passed in even if a user doesn't want to
     specify this argument.
   </api:param-description><api:param-name>grouping-separator</api:param-name><api:param-type>String?</api:param-type></api:param><api:param name="grouping-size" type="xs:integer?" optional="true"><api:param-description>
     Represents size of the group, i.e. the number of digits before after
     which grouping separator is inserted.
     An empty sequence must be passed in even if a user doesn't want to
     specifiy this argument.
   </api:param-description><api:param-name>grouping-size</api:param-name><api:param-type>Number?</api:param-type></api:param></api:params><api:return>String</api:return><api:usage>
   <p xmlns="http://www.w3.org/1999/xhtml">Most, but not all formatting combinations work. The following table
   shows formatting options by language, and lists what is supported and
   what is not.</p>
   <table border="1" xmlns="http://www.w3.org/1999/xhtml">
   <tr><th>Language</th><th>Numeric Cardinals</th><th>Numeric Ordinals</th><th>Spelled Out Cardinals</th><th>Spelled Out Ordinals</th></tr>
       <tr><td>en</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
       <tr><td>fr</td><td>Yes</td><td>Yes</td><td>Yes</td><td>No</td></tr>
       <tr><td>it</td><td>Yes</td><td>Yes</td><td>Yes</td><td>No</td></tr>
       <tr><td>de</td><td>Yes</td><td>No</td><td>Yes</td><td>Yes</td></tr>
       <tr><td>ru</td><td>Yes</td><td>No</td><td>Yes</td><td>No</td></tr>
       <tr><td>es</td><td>Yes</td><td>Yes</td><td>Yes</td><td>No</td></tr>
       <tr><td>ar</td><td>Yes</td><td>Yes</td><td>Yes</td><td>No</td></tr>
       <tr><td>zh</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
       <tr><td>ko</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
       <tr><td>fa</td><td>Yes</td><td>No</td><td>Yes</td><td>No</td></tr>
       <tr><td>nl</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
       <tr><td>ja</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
       <tr><td>pt</td><td>Yes</td><td>Yes</td><td>Yes</td><td>No</td></tr>


   </table>
 </api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var res = new Array();
res.push(xdmp.formatNumber(29,"01","en","",null,'0',",",3));
res.push(xdmp.formatNumber(09,"W","en","",null,'"',",",3));
res.push(xdmp.formatNumber((5),"w","es",null,null,"0",",",3));
res.push(xdmp.formatNumber((5),"w","fr",null,null,"0",",",3));
res;
=&gt;
["29", "NINE", "cinco", "cinq"]
 </pre>
 </api:example></api:function></api:function-page>