Literals are simply constant values that are directly represented in a query, such as "ACC"
and 29.99
. They can be used in expressions anywhere a constant value is needed, for example the strings in the comparison expression:
if ($department ="ACC"
) then"accessories"
else"other"
or the numbers 1
and 30
in the function call:
substring($name,1
,30
)
There are two kinds of literals:
string literals, which must be enclosed in single or double quotes, and numeric literals, which must not. Numeric literals can take the form of simple integers, such as 1
, decimal numbers, such as 1.5
, or floating-point numbers, such as 1.5E2
. The processor makes assumptions about the type of a numeric literal based on its format.
You can also use type constructors to convert your literal values to the desired type. For example, to include a literal date in an expression, you can use xs:date("2006-05-03")
. For literal Boolean values, you can use the expressions true( )
and false( )
.
13.59.200.206