Converts $string-var (a string) to a decimal value.
If $string-var is the empty sequence, the empty sequence is returned. The empty sequence is a sequence containing zero items (), which is similar to null in SQL.
xs:decimal(xs:string $string-var) —> xs:decimal
Returns the decimal value of $string-var.
Invoking decimal("2.2") returns the decimal value 2.2 as shown in the following example query:
<decimal>{xs:decimal("2.2")}</decimal>
The preceding query generates the following result:
<decimal>2.2</decimal>
Invoking decimal(()) returns an empty sequence. The empty sequence is a sequence containing zero items (), which is similar to null in SQL.
For example, the following example query:
<decimal>{xs:decimal(())}</decimal>
The preceding query generates the following result:
<decimal/>
W3C decimal data type description