|
|
xdmp:format-number(
|
|
$value as numeric,
|
|
$picture as xs:string,
|
|
$language as xs:string,
|
|
$letter-value as xs:string,
|
|
$ordchar as xs:string,
|
|
$zero-padding as xs:string,
|
|
$grouping-separator as xs:string,
|
|
$grouping-size as xs:string
|
| ) as xs:string |
|
 |
Summary:
Returns a formatted number value based on the picture argument.
The difference between this function and the W3C standards
fn:format-number function is that this function imitates
the XSLT xsl:number instruction, which has richer
formatting options than the fn:format-number 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.
|
Parameters:
$value
:
The given numeric $value that needs to be formatted. The
type of this argument must be a numeric type (for example, xs:integer,
xs:float, xs:double, or xs:decimal).
|
$picture
:
The desired string representation of the given numeric $value.
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
http://www.w3.org/TR/xslt20/#date-picture-string.
Unlike fn:format-number(), here the picture sting allows
spelled-out (uppercase, lowercase and Capitalcase) formatting.
|
$language
:
The desired language for string representation of the numeric
$value.
An empty sequence must be passed in even if a user doesn't want to
specifiy this argument.
|
$letter-value
:
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.
|
$ordchar
:
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.
|
$zero-padding
:
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.
|
$grouping-separator
:
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.
|
$grouping-size
:
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.
|
|
Usage Notes:
Most, but not all formatting combinations work. The following table
shows formatting options by language, and lists what is supported and
what is not.
| Language |
Numeric Cardinals |
Numeric Ordinals |
Spelled Out Cardinals |
Spelled Out Ordinals |
| en |
Yes |
Yes |
Yes |
Yes |
| fr |
Yes |
Yes |
Yes |
No |
| it |
Yes |
Yes |
Yes |
No |
| de |
Yes |
No |
Yes |
Yes |
| ru |
Yes |
No |
Yes |
No |
| es |
Yes |
Yes |
Yes |
No |
| ar |
Yes |
Yes |
Yes |
No |
| zh |
Yes |
Yes |
Yes |
Yes |
| ko |
Yes |
Yes |
Yes |
Yes |
| fa |
Yes |
No |
Yes |
No |
| nl |
Yes |
Yes |
Yes |
Yes |
| ja |
Yes |
Yes |
Yes |
Yes |
| pt |
Yes |
Yes |
Yes |
No |
|
Example:
xdmp:format-number(29,"01","en","",(),'0',",",3),
xdmp:format-number(09,"W","en","",(),'"',",",3),
xdmp:format-number((5),"w","es",(),(),"0",",",3)
=>
29
NINE
cinco
|
|
|