<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/fn.formatNumber.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>fn.formatNumber</api:function-name><api:suggest>fn.formatnumber</api:suggest><api:suggest>fn</api:suggest><api:suggest>formatnumber</api:suggest><api:function-link mode="xquery" fullname="fn:format-number">/apidoc/8.0/fn:format-number.xml</api:function-link><api:function mode="javascript" name="formatNumber" type="builtin" lib="fn" category="XSLTBuiltins" bucket="W3C-Standard Functions" hidden="false" prefix="fn" namespace="http://www.w3.org/2005/xpath-functions" fullname="fn.formatNumber"><api:summary>
   Returns a formatted string representation of value argument based
   on the supplied picture. An optional decimal format name may also
   be supplied for interpretation of the picture string.  This
   is an XSLT function, and it is available in XSLT, XQuery 1.0-ml,
   and Server-Side JavaScript.
 </api:summary><api:params><api:param name="value" type="xs:double" 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>Number</api:param-type></api:param><api:param name="picture" type="xs:string" optional="false"><api:param-description>
     The desired string representation of the given number <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 format-number
     picture string, see
     <a href="http://www.w3.org/TR/xslt20/#function-format-number" target="_blank" xmlns="http://www.w3.org/1999/xhtml">http://www.w3.org/TR/xslt20/#function-format-number</a>.
   </api:param-description><api:param-name>picture</api:param-name><api:param-type>String</api:param-type></api:param><api:param name="decimal-format-name" type="xs:string" optional="true"><api:param-description>
     Represents a named <code xmlns="http://www.w3.org/1999/xhtml">&lt;xsl:decimal-format&gt;</code> instruction.
     It is used to assign values to the variables mentioned above
     based on the picture string.
   </api:param-description><api:param-name>decimal-format-name</api:param-name><api:param-type>String</api:param-type></api:param></api:params><api:return>String</api:return><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn.formatNumber(xs.integer("1000000"),"#,##0.00");
=&gt;
1,000,000.00
 </pre>
 </api:example><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var stylesheet = xdmp.unquote(
'&lt;xsl:stylesheet version="2.0"\n\
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\n\
   xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;\n\
    &lt;xsl:decimal-format name="testformat" decimal-separator="."/&gt;\n\
    &lt;xsl:template match="foo"&gt;\n\
      &lt;xsl:sequence select="format-number(xs:float('
        + "'1234.5'), '#,##0.00', 'testformat')"
        + '"/&gt;\n\
    &lt;/xsl:template&gt;\n\
&lt;/xsl:stylesheet&gt;').next().value;
xdmp.xsltEval(stylesheet, xdmp.unquote('&lt;foo/&gt;').next().value);
=&gt;
1,234.50
 </pre>
 </api:example></api:function></api:function-page>