1 Introduction
1.1 XQuery 1.0 and
XPath 2.0 Functions
1.2 XSL
Transformations (XSLT) 2.0 Functions
This document describes the namespace
http://www.w3.org/2005/xpath-functions/
of the
XQuery
1.0 and XPath 2.0 Functions and Operators and XSL
Transformations (XSLT) Version 2.0 specifications (January 2007
versions).
For updated information, please refer to the latest version of the XQuery 1.0 and XPath 2.0 Functions and Operators and/or XSL Transformations (XSLT) Version 2.0 specifications.
This document describes the names that are defined in this namespace at the time of publication. The W3C reserves the right to define additional names in this namespace in the future. XQuery 1.0 and XPath 2.0 Functions and Operators and XSL Transformations (XSLT) Version 2.0 are the only specifications which may amend this namespace.
This section lists all of the functions defined in the XQuery
1.0 and XPath 2.0 Functions and Operators specification. Each
function and operator is uniquely identified with a URI of the
form:
“http://www.w3.org/2005/xpath-functions/#
name”
where name is the name of a function or operator, such as
“max”: http://www.w3.org/2005/xpath-functions/#max
.
The normative definitions of these functions are in the XQuery 1.0 and XPath 2.0 Functions and Operators specification. For convenience, a very brief, non-normative summary of each function is provided. For details, follow the link on the “Summary:” introductory text below each function.
fn:abs
($arg
as
numeric?
) as
numeric?
Summary:
Returns the absolute value of $arg
. If
$arg
is negative returns -$arg
otherwise
returns $arg
. If type of $arg
is one of
the four numeric types xs:float
,
xs:double
, xs:decimal
or
xs:integer
the type of the result is the same as the
type of $arg
. If the type of $arg
is a
type derived from one of the numeric types, the result is an
instance of the base numeric type.
fn:adjust-date-to-timezone
($arg
as
xs:date?
) as
xs:date?
fn:adjust-date-to-timezone ( |
$arg |
as xs:date? , |
$timezone |
as xs:dayTimeDuration? ) as xs:date? |
Summary: Adjusts an xs:date
value to a specific
timezone, or to no timezone at all. If $timezone
is
the empty sequence, returns an xs:date
without a
timezone. Otherwise, returns an xs:date
with a
timezone. For purposes of timezone adjustment, an
xs:date
is treated as an xs:dateTime
with
time 00:00:00
.
fn:adjust-dateTime-to-timezone
($arg
as
xs:dateTime?
) as
xs:dateTime?
fn:adjust-dateTime-to-timezone ( |
$arg |
as xs:dateTime? , |
$timezone |
as xs:dayTimeDuration? ) as xs:dateTime? |
Summary: Adjusts an xs:dateTime
value to a
specific timezone, or to no timezone at all. If
$timezone
is the empty sequence, returns an
xs:dateTime
without a timezone. Otherwise, returns an
xs:dateTime
with a timezone.
fn:adjust-time-to-timezone
($arg
as
xs:time?
) as
xs:time?
fn:adjust-time-to-timezone ( |
$arg |
as xs:time? , |
$timezone |
as xs:dayTimeDuration? ) as xs:time? |
Summary: Returns the xs:dayTimeDuration
that
corresponds to the difference between the normalized value of
$arg1
and the normalized value of $arg2
.
If either $arg1
or $arg2
do not contain
an explicit timezone then, for the purpose of the operation, the
implicit timezone provided by the dynamic context (See
Section C.2 Dynamic Context
ComponentsXP.) is assumed to be
present as part of the value.
fn:avg
($arg
as
xs:anyAtomicType*
) as
xs:anyAtomicType?
Summary:
Selects an item from the input sequence $arg
whose
value is greater than or equal to the value of every other item in
the input sequence. If there are two or more such items, then the
specific item whose value is returned is implementation
dependent.
fn:base-uri
() as
xs:anyURI?
fn:base-uri
($arg
as
node()?
) as
xs:anyURI?
Summary: Returns the value of the base-uri URI property for
$arg
as defined by the accessor function
dm:base-uri()
for that kind of node in Section 5.2
base-uri AccessorDM. If
$arg
is not specified, the behavior is identical to
calling the function with the context item (.
) as
argument. The following errors may be raised: if the context item
is undefined [err:XPDY0002]XP; if the
context item is not a node
[err:XPTY0004]XP.
fn:boolean
($arg
as
item()*
) as
xs:boolean
Summary: Computes the effective boolean value of the sequence
$arg
. See Section 2.4.3 Effective
Boolean ValueXP
fn:ceiling
($arg
as
numeric?
) as
numeric?
Summary: Returns the smallest (closest to negative infinity)
number with no fractional part that is not less than the value of
$arg
. If type of $arg
is one of the four
numeric types xs:float
, xs:double
,
xs:decimal
or xs:integer
the type of the
result is the same as the type of $arg
. If the type of
$arg
is a type derived from one of the numeric types,
the result is an instance of the base numeric type.
fn:codepoint-equal ( |
$comparand1 |
as xs:string? , |
$comparand2 |
as xs:string? ) as xs:boolean? |
Summary: Returns true
or false
depending on whether the value of $comparand1
is equal
to the value of $comparand2
, according to the Unicode
code point collation
(http://www.w3.org/2005/xpath-functions/collation/codepoint
).
fn:codepoints-to-string
($arg
as
xs:integer*
) as
xs:string
Summary: Creates an xs:string
from a sequence of
[The Unicode Standard] code points. Returns the zero-length string
if $arg
is the empty sequence. If any of the code
points in $arg
is not a legal XML character, an error
is raised [err:FONSCH0001].
fn:collection
() as
node()*
fn:collection
($arg
as
xs:string?
) as
node()*
Summary: This function takes an xs:string
as
argument and returns a sequence of nodes obtained by interpreting
$arg
as an xs:anyURI
and resolving it
according to the mapping specified in Available collections
described in
Section C.2 Dynamic Context
ComponentsXP. If Available
collections provides a mapping from this string to a sequence
of nodes, the function returns that sequence. If Available
collections maps the string to an empty sequence, then the
function returns an empty sequence. If Available collections
provides no mapping for the string, an error is raised
[err:FONSDC0004]. If $arg
is not specified, the
function returns the sequence of the nodes in the default
collection in the dynamic context. See
Section C.2 Dynamic Context
ComponentsXP. If the value of the
default collection is undefined an error is raised
[err:FONSDC0002].
fn:compare
($comparand1
as
xs:string?
,
$comparand2
as
xs:string?
) as
xs:integer?
fn:compare ( |
$comparand1 |
as xs:string? , |
$comparand2 |
as xs:string? , |
|
$collation |
as xs:string ) as xs:integer? |
Summary: Returns -1, 0, or 1, depending on whether the value of
the $comparand1
is respectively less than, equal to,
or greater than the value of $comparand2
, according to
the rules of the collation that is used.
fn:concat ( |
$arg1 |
as xs:anyAtomicType? , |
$arg2 |
as xs:anyAtomicType? , |
|
... | ) as xs:string |
Summary: Accepts two or more xs:anyAtomicType
arguments and casts them to xs:string
. Returns the
xs:string
that is the concatenation of the values of
its arguments after conversion. If any of the arguments is the
empty sequence, the argument is treated as the zero-length
string.
fn:contains
($arg1
as
xs:string?
,
$arg2
as
xs:string?
) as
xs:boolean
fn:contains ( |
$arg1 |
as xs:string? , |
$arg2 |
as xs:string? , |
|
$collation |
as xs:string ) as xs:boolean |
Summary: Returns an xs:boolean
indicating whether
or not the value of $arg1
contains (at the beginning,
at the end, or anywhere within) at least one sequence of collation
units that provides a minimal match to the collation units in the
value of $arg2
, according to the collation that is
used.
fn:count
($arg
as
item()*
) as
xs:integer
Summary: Returns the number of items in the value of
$arg
.
fn:current-date
() as
xs:date
Summary: Returns xs:date(fn:current-dateTime())
.
This is an xs:date
(with timezone) that is current at
some time during the evaluation of a query or transformation in
which fn:current-date()
is executed. This function is
stable. The precise instant during the query or transformation
represented by the value of fn:current-date()
is
implementation dependent.
fn:current-dateTime
() as
xs:dateTime
Summary: Returns the current dateTime (with timezone) from the
dynamic context. (See
Section C.2 Dynamic Context
ComponentsXP.) This is an
xs:dateTime
that is current at some time during the
evaluation of a query or transformation in which
fn:current-dateTime()
is executed. This function is
stable. The precise instant during the query or transformation
represented by the value of fn:current-dateTime()
is
implementation dependent.
fn:current-time
() as
xs:time
Summary: Returns xs:time(fn:current-dateTime())
.
This is an xs:time
(with timezone) that is current at
some time during the evaluation of a query or transformation in
which fn:current-time()
is executed. This function is
stable. The precise instant during the query or transformation
represented by the value of fn:current-time()
is
implementation dependent.
fn:data
($arg
as
item()*
) as
xs:anyAtomicType*
Summary: fn:data
takes a sequence of items and
returns a sequence of atomic values.
fn:dateTime
($arg1
as
xs:date?
,
$arg2
as
xs:time?
) as
xs:dateTime?
Summary: Backs up the "+" operator and returns the arithmetic
sum of its operands: ( $arg1 + $arg2
).
fn:day-from-date
($arg
as
xs:date?
) as
xs:integer?
Summary: Returns an xs:integer
between 1 and 31,
both inclusive, representing the day component in the localized
value of $arg
.
fn:day-from-dateTime
($arg
as
xs:dateTime?
) as
xs:integer?
Summary: Returns an xs:integer
between 1 and 31,
both inclusive, representing the day component in the localized
value of $arg
.
fn:days-from-duration
($arg
as
xs:duration?
) as
xs:integer?
Summary: Returns an xs:integer
representing the
days component in the value of $arg
. The result is
obtained by casting $arg
to an
xs:dayTimeDuration
(see 17.1.4 Casting to duration
types) and then computing the days component as described
in 10.3.2.3 Canonical
representation.
fn:deep-equal
($parameter1
as
item()*
,
$parameter2
as
item()*
) as
xs:boolean
fn:deep-equal ( |
$parameter1 |
as item()* , |
$parameter2 |
as item()* , |
|
$collation |
as string ) as xs:boolean |
Summary: Constructs a sequence containing every node that
occurs in the values of either $parameter1
or
$parameter2
, eliminating duplicate nodes. Nodes are
returned in document order. Two nodes are duplicates if they are
op:is-same-node()
.
fn:default-collation
() as
xs:string
Summary: Returns the value of the default collation property from the static context. Components of the static context are discussed in Section C.1 Static Context ComponentsXP.
fn:distinct-values
($arg
as
xs:anyAtomicType*
) as
xs:anyAtomicType*
fn:distinct-values ( |
$arg |
as xs:anyAtomicType* , |
$collation |
as xs:string ) as xs:anyAtomicType* |
Summary: Returns the sequence that results from removing from
$arg
all but one of a set of values that are
eq
to one other. Values of type
xs:untypedAtomic
are compared as if they were of type
xs:string
. Values that cannot be compared, i.e. the
eq
operator is not defined for their types, are
considered to be distinct. The order in which the sequence of
values is returned is implementation dependent.
fn:doc
($uri
as
xs:string?
) as
document-node()?
Summary:
Retrieves a document using an xs:anyURI
, which may
include a fragment identifier, supplied as an
xs:string
. If $uri
is not a valid
xs:anyURI
, an error is raised [err:FONSDC0005]. If it
is a relative URI Reference, it is resolved relative to the value
of the base URI property from the static context. The resulting
absolute URI Reference is promoted to an xs:string
. If
the Available documents discussed in Section 2.1.2 Dynamic
ContextXP provides a mapping from
this string to a document node, the function returns that document
node. If the Available documents provides no mapping for the
string, an error is raised [err:FONSDC0005].
fn:doc-available
($uri
as
xs:string?
) as
xs:boolean
Summary: If fn:doc($uri)
returns a document node,
this function returns true
. If $uri
is
not a valid xs:anyURI
, an error is raised
[err:FONSDC0005]. Otherwise, this function returns
false
.
fn:document-uri
($arg
as
node()?
) as
xs:anyURI?
Summary: Returns the value of the document-uri property for
$arg
as defined by the dm:document-uri
accessor function defined in Section
6.1.2 AccessorsDM.
fn:empty
($arg
as
item()*
) as
xs:boolean
Summary: If the value of $arg
is the empty
sequence, the function returns true
; otherwise, the
function returns false
.
fn:encode-for-uri
($uri-part
as
xs:string?
) as
xs:string
Summary: This function escapes all characters except printable
characters of the US-ASCII coded character set, specifically the
octets ranging from 32 to 126 (decimal). The effect of the function
is to escape a URI in the manner html user agents handle attribute
values that expect URIs. Each character in $uri
to be
escaped is replaced by an escape sequence, which is formed by
encoding the character as a sequence of octets in UTF-8, and then
representing each of these octets in the form %HH, where HH is the
hexadecimal representation of the octet. This function must always
generate hexadecimal values using the upper-case letters A-F.
fn:ends-with
($arg1
as
xs:string?
,
$arg2
as
xs:string?
) as
xs:boolean
fn:ends-with ( |
$arg1 |
as xs:string? , |
$arg2 |
as xs:string? , |
|
$collation |
as xs:string ) as xs:boolean |
Summary: Returns an xs:boolean
indicating whether
or not the value of $arg1
ends with a sequence of
collation units that provides a minimal match to the collation
units of $arg2
according to the collation that is
used.
fn:error
() as
none
fn:error
($error
as
xs:QName
) as
none
fn:error
($error
as
xs:QName?
,
$description
as
xs:string
) as
none
fn:error ( |
$error |
as xs:QName? , |
$description |
as xs:string , |
|
$error-object |
as item()* ) as none |
Summary: The fn:error
function raises an error.
While this function never returns a value, an error is returned to
the external processing environment as an xs:anyURI
or
an xs:QName
. The error xs:anyURI
is
derived from the error xs:QName
. An error
xs:QName
with namespace URI NS and local part LP will
be returned as the xs:anyURI
NS#LP. The method by
which the xs:anyURI
or xs:QName
is
returned to the external processing environment is implementation
dependent.
fn:escape-html-uri
($uri
as
xs:string?
) as
xs:string
Summary: This function escapes all characters except printable
characters of the US-ASCII coded character set, specifically the
octets ranging from 32 to 126 (decimal). The effect of the function
is to escape a URI in the manner html user agents handle attribute
values that expect URIs. Each character in $uri
to be
escaped is replaced by an escape sequence, which is formed by
encoding the character as a sequence of octets in UTF-8, and then
representing each of these octets in the form %HH, where HH is the
hexadecimal representation of the octet. This function must always
generate hexadecimal values using the upper-case letters A-F.
fn:exactly-one
($arg
as
item()*
) as
item()
Summary: Returns $arg
if it contains exactly one
item. Otherwise, raises an error [err:FONSRG0005].
fn:exists
($arg
as
item()*
) as
xs:boolean
Summary: If the value of $arg
is not the empty
sequence, the function returns true
; otherwise, the
function returns false
.
fn:false
() as
xs:boolean
Summary: Returns the xs:boolean
value
false
. Equivalent to xs:boolean("0")
.
fn:floor
($arg
as
numeric?
) as
numeric?
Summary: Returns the largest (closest to positive infinity)
number with no fractional part that is not greater than the value
of $arg
. If type of $arg
is one of the
four numeric types xs:float
, xs:double
,
xs:decimal
or xs:integer
the type of the
result is the same as the type of $arg
. If the type of
$arg
is a type derived from one of the numeric types,
the result is an instance of the base numeric type.
fn:hours-from-dateTime
($arg
as
xs:dateTime?
) as
xs:integer?
Summary: Returns an xs:integer
between 0 and 23,
both inclusive, representing the hours component in the localized
value of $arg
.
fn:hours-from-duration
($arg
as
xs:duration?
) as
xs:integer?
Summary: Returns an xs:integer
representing the
hours component in the value of $arg
. The result is
obtained by casting $arg
to an
xs:dayTimeDuration
(see 17.1.4 Casting to duration
types) and then computing the hours component as described
in 10.3.2.3 Canonical
representation.
fn:hours-from-time
($arg
as
xs:time?
) as
xs:integer?
Summary: Returns an xs:integer
between 0 and 23,
both inclusive, representing the value of the hours component in
the localized value of $arg
.
fn:id
($arg
as
xs:string*
) as
element()*
fn:id
($arg
as
xs:string*
, $node
as
node()
) as
element()*
Summary:
Retrieves a document using an xs:anyURI
, which may
include a fragment identifier, supplied as an
xs:string
. If $uri
is not a valid
xs:anyURI
, an error is raised [err:FONSDC0005]. If it
is a relative URI Reference, it is resolved relative to the value
of the base URI property from the static context. The resulting
absolute URI Reference is promoted to an xs:string
. If
the Available documents discussed in Section 2.1.2 Dynamic
ContextXP provides a mapping from
this string to a document node, the function returns that document
node. If the Available documents provides no mapping for the
string, an error is raised [err:FONSDC0005].
fn:idref
($arg
as
xs:string*
) as
node()*
fn:idref
($arg
as
xs:string*
, $node
as
node()
) as
node()*
Summary: Retrieves a document using an xs:anyURI
,
which may include a fragment identifier, supplied as an
xs:string
. If $uri
is not a valid
xs:anyURI
, an error is raised [err:FONSDC0005]. If it
is a relative URI Reference, it is resolved relative to the value
of the base URI property from the static context. The resulting
absolute URI Reference is promoted to an xs:string
. If
the Available documents discussed in Section 2.1.2 Dynamic
ContextXP provides a mapping from
this string to a document node, the function returns that document
node. If the Available documents provides no mapping for the
string, an error is raised [err:FONSDC0005].
fn:implicit-timezone
() as
xs:dayTimeDuration
Summary: Returns the value of the implicit timezone property from the dynamic context. Components of the dynamic context are discussed in Section C.2 Dynamic Context ComponentsXP.
fn:in-scope-prefixes
($element
as
element()
) as
xs:string*
Summary: Returns the prefixes of the in-scope namespaces for
$element
. For namespaces that have a prefix, it
returns the prefix as an xs:NCName
. For the default
namespace, which has no prefix, it returns the zero-length
string.
fn:index-of ( |
$seqParam |
as xs:anyAtomicType* , |
$srchParam |
as xs:anyAtomicType ) as xs:integer* |
fn:index-of ( |
$seqParam |
as xs:anyAtomicType* , |
$srchParam |
as xs:anyAtomicType , |
|
$collation |
as xs:string ) as xs:integer* |
Summary: Returns a sequence of positive integers giving the
positions within the sequence $seqParam
of items that
are equal to $srchParam
.
fn:insert-before ( |
$target |
as item()* , |
$position |
as xs:integer , |
|
$inserts |
as item()* ) as item()* |
Summary: Returns a new sequence constructed from the value of
$target
with the value of $inserts
inserted at the position specified by the value of
$position
. (The value of $target
is not
affected by the sequence construction.)
fn:iri-to-uri
($iri
as
xs:string?
) as
xs:string
Summary: This function escapes all characters except printable
characters of the US-ASCII coded character set, specifically the
octets ranging from 32 to 126 (decimal). The effect of the function
is to escape a URI in the manner html user agents handle attribute
values that expect URIs. Each character in $uri
to be
escaped is replaced by an escape sequence, which is formed by
encoding the character as a sequence of octets in UTF-8, and then
representing each of these octets in the form %HH, where HH is the
hexadecimal representation of the octet. This function must always
generate hexadecimal values using the upper-case letters A-F.
fn:lang
($testlang
as
xs:string?
) as
xs:boolean
fn:lang
($testlang
as
xs:string?
,
$node
as
node()
) as
xs:boolean
Summary: This function tests whether the language of
$node
, or the context item if the second argument is
omitted, as specified by xml:lang
attributes is the
same as, or is a sublanguage of, the language specified by
$testlang
. The behavior of the function if the second
argument is omitted is exactly the same as if the context item
(.
) had been passed as the second argument. The
language of the argument node, or the context item if the second
argument is omitted, is determined by the value of the
xml:lang
attribute on the node, or, if the node has no
such attribute, by the value of the xml:lang
attribute
on the nearest ancestor of the node that has an
xml:lang
attribute. If there is no such ancestor, then
the function returns false
fn:last
() as
xs:integer
Summary: Returns the context size from the dynamic context. (See Section C.2 Dynamic Context ComponentsXP.) If the context item is undefined, an error is raised: [err:XPDY0002]XP.
fn:local-name
() as
xs:string
fn:local-name
($arg
as
node()?
) as
xs:string
Summary: Returns the local part of the name of
$arg
as an xs:string
that will either be
the zero-length string or will have the lexical form of an
xs:NCName
.
fn:local-name-from-QName
($arg
as
xs:QName?
) as
xs:NCName?
Summary: Returns an xs:NCName
representing the
local part of $arg
. If $arg
is the empty
sequence, returns the empty sequence.
fn:lower-case
($arg
as
xs:string?
) as
xs:string
Summary: Returns the value of $arg
modified so
that every character in the value of $arg
that occurs
at some position N in the value of $mapString
has been replaced by the character that occurs at position
N in the value of $transString
.
fn:matches
($input
as
xs:string?
,
$pattern
as
xs:string
) as
xs:boolean
fn:matches ( |
$input |
as xs:string? , |
$pattern |
as xs:string , |
|
$flags |
as xs:string ) as xs:boolean |
Summary: The function returns true
if
$input
matches the regular expression supplied as
$pattern
as influenced by the value of
$flags
, if present; otherwise, it returns
false
.
fn:max
($arg
as
xs:anyAtomicType*
) as
xs:anyAtomicType?
fn:max
($arg
as
xs:anyAtomicType*
, $collation
as
string
) as
xs:anyAtomicType?
Summary:
Selects an item from the input sequence $arg
whose
value is greater than or equal to the value of every other item in
the input sequence. If there are two or more such items, then the
specific item whose value is returned is implementation
dependent.
fn:min
($arg
as
xs:anyAtomicType*
) as
xs:anyAtomicType?
fn:min
($arg
as
xs:anyAtomicType*
, $collation
as
string
) as
xs:anyAtomicType?
Summary:
selects an item from the input sequence $arg
whose
value is less than or equal to the value of every other item in the
input sequence. If there are two or more such items, then the
specific item whose value is returned is implementation
dependent.
fn:minutes-from-dateTime
($arg
as
xs:dateTime?
) as
xs:integer?
Summary: Returns an xs:integer
value between 0 and
59, both inclusive, representing the minute component in the
localized value of $arg
.
fn:minutes-from-duration
($arg
as
xs:duration?
) as
xs:integer?
Summary: Returns an xs:integer
representing the
minutes component in the value of $arg
. The result is
obtained by casting $arg
to an
xs:dayTimeDuration
(see 17.1.4 Casting to duration
types) and then computing the minutes component as
described in 10.3.2.3
Canonical representation.
fn:minutes-from-time
($arg
as
xs:time?
) as
xs:integer?
Summary: Returns an xs:integer
value between 0 and
59, both inclusive, representing the value of the minutes component
in the localized value of $arg
.
fn:month-from-date
($arg
as
xs:date?
) as
xs:integer?
Summary: Returns an xs:integer
between 1 and 12,
both inclusive, representing the month component in the localized
value of $arg
.
fn:month-from-dateTime
($arg
as
xs:dateTime?
) as
xs:integer?
Summary: Returns an xs:integer
between 1 and 12,
both inclusive, representing the month component in the localized
value of $arg
.
fn:months-from-duration
($arg
as
xs:duration?
) as
xs:integer?
Summary: Returns an xs:integer
representing the
months component in the value of $arg
. The result is
obtained by casting $arg
to an
xs:yearMonthDuration
(see 17.1.4 Casting to duration
types) and then computing the months component as described
in 10.3.1.3 Canonical
representation.
fn:name
() as
xs:string
fn:name
($arg
as
node()?
) as
xs:string
Summary: Returns the name of a node, as an
xs:string
that is either the zero-length string, or
has the lexical form of an xs:QName
.
fn:namespace-uri
() as
xs:anyURI
fn:namespace-uri
($arg
as
node()?
) as
xs:anyURI
Summary: Returns the namespace URI of the xs:QName
of $arg
.
fn:namespace-uri-for-prefix ( |
$prefix |
as xs:string? , |
$element |
as element() ) as xs:anyURI? |
Summary: Returns the namespace URI of one of the in-scope
namespaces for $element
, identified by its namespace
prefix.
fn:namespace-uri-from-QName
($arg
as
xs:QName?
) as
xs:anyURI?
Summary: Returns the namespace URI for $arg
as an
xs:string
. If $arg
is the empty sequence,
the empty sequence is returned. If $arg
is in no
namespace, the zero-length string is returned.
fn:nilled
($arg
as
node()?
) as
xs:boolean?
Summary: Returns an xs:boolean
indicating whether
the argument node is "nilled". If the argument is not an element
node, returns the empty sequence. If the argument is the empty
sequence, returns the empty sequence.
fn:node-name
($arg
as
node()?
) as
xs:QName?
Summary: Returns an expanded-QName for node kinds that can have
names. For other kinds of nodes it returns the empty sequence. If
$arg
is the empty sequence, the empty sequence is
returned.
fn:normalize-space
() as
xs:string
fn:normalize-space
($arg
as
xs:string?
) as
xs:string
Summary: Returns the value of $arg
with whitespace
normalized by stripping leading and trailing whitespace and
replacing sequences of one or more than one whitespace character
with a single space, #x20
.
fn:normalize-unicode
($arg
as
xs:string?
) as
xs:string
fn:normalize-unicode ( |
$arg |
as xs:string? , |
$normalizationForm |
as xs:string ) as xs:string |
Summary: Returns the value of $arg
normalized
according to the normalization criteria for a normalization form
identified by the value of $normalizationForm
. The
effective value of the $normalizationForm
is computed
by removing leading and trailing blanks, if present, and converting
to upper case.
fn:not
($arg
as
item()*
) as
xs:boolean
Summary:
$arg
is first reduced to an effective boolean value by
applying the fn:boolean()
function. Returns
true
if the effective boolean value is
false
, and false
if the effective boolean
value is true
.
fn:number
() as
xs:double
fn:number
($arg
as
xs:anyAtomicType?
) as
xs:double
Summary: Returns the value indicated by $arg
or,
if $arg
is not specified, the context item after
atomization, converted to an xs:double
fn:one-or-more
($arg
as
item()*
) as
item()+
Summary: Returns $arg
if it contains one or more
items. Otherwise, raises an error [err:FONSRG0004].
fn:position
() as
xs:integer
Summary: Returns the context position from the dynamic context. (See Section C.2 Dynamic Context ComponentsXP.) If the context item is undefined, an error is raised: [err:XPDY0002]XP.
fn:prefix-from-QName
($arg
as
xs:QName?
) as
xs:NCName?
Summary: Returns an xs:NCName
representing the
prefix of $arg
. The empty sequence is returned if
$arg
is the empty sequence or if the value of
$arg
contains no prefix.
fn:QName
($paramURI
as
xs:string?
,
$paramQName
as
xs:string
) as
xs:QName
Summary: Returns an xs:QName
with the namespace
URI given in $paramURI
. If $paramURI
is
the zero-length string or the empty sequence, it represents "no
namespace"; in this case, if the value of $paramQName
contains a colon (:
), an error is raised
[err:FONSCA0002]. The prefix (or absence of a prefix) in
$paramQName
is retained in the returned
xs:QName
value. The local name in the result is taken
from the local part of $paramQName
.
fn:remove
($target
as
item()*
,
$position
as
xs:integer
) as
item()*
Summary: Returns a new sequence constructed from the value of
$target
with the item at the position specified by the
value of $position
removed.
fn:replace ( |
$input |
as xs:string? , |
$pattern |
as xs:string , |
|
$replacement |
as xs:string ) as xs:string |
fn:replace ( |
$input |
as xs:string? , |
$pattern |
as xs:string , |
|
$replacement |
as xs:string , |
|
$flags |
as xs:string ) as xs:string |
Summary: The function returns the xs:string
that
is obtained by replacing each non-overlapping substring of
$input
that matches the given $pattern
with an occurrence of the $replacement
string.
fn:resolve-QName
($qname
as
xs:string?
,
$element
as
element()
) as
xs:QName?
Summary: Returns an xs:QName
value (that is, an
expanded-QName) by taking an xs:string
that has the
lexical form of an xs:QName
(a string in the form
"prefix:local-name" or "local-name") and resolving it using the
in-scope namespaces for a given element.
fn:resolve-uri
($relative
as
xs:string?
) as
xs:anyURI?
fn:resolve-uri
($relative
as
xs:string?
,
$base
as
xs:string
) as
xs:anyURI?
Summary: The purpose of this function is to enable a relative URI to be resolved against an absolute URI.
fn:reverse
($arg
as
item()*
) as
item()*
Summary: Reverses the order of items in a sequence. If
$arg
is the empty sequence, the empty sequence is
returned.
fn:root
() as
node()
fn:root
($arg
as
node()?
) as
node()?
Summary: Returns the root of the tree to which
$arg
belongs. This will usually, but not necessarily,
be a document node.
fn:round
($arg
as
numeric?
) as
numeric?
Summary: Returns the number with no fractional part that is
closest to the argument. If there are two such numbers, then the
one that is closest to positive infinity is returned. If type of
$arg
is one of the four numeric types
xs:float
, xs:double
,
xs:decimal
or xs:integer
the type of the
result is the same as the type of $arg
. If the type of
$arg
is a type derived from one of the numeric types,
the result is an instance of the base numeric type.
fn:round-half-to-even
($arg
as
numeric?
) as
numeric?
fn:round-half-to-even
($arg
as
numeric?
, $precision
as
xs:integer
) as
numeric?
Summary: The value returned is the nearest (that is,
numerically closest) value to $arg
that is a multiple
of ten to the power of minus $precision
. If two such
values are equally near (e.g. if the fractional part in
$arg
is exactly .500...), the function returns the one
whose least significant digit is even.
fn:seconds-from-dateTime
($arg
as
xs:dateTime?
) as
xs:decimal?
Summary: Returns an xs:decimal
value greater than
or equal to zero and less than 60, representing the seconds and
fractional seconds in the localized value of $arg
.
fn:seconds-from-duration
($arg
as
xs:duration?
) as
xs:decimal?
Summary: Returns an xs:decimal
representing the
seconds component in the value of $arg
. The result is
obtained by casting $arg
to an
xs:dayTimeDuration
(see 17.1.4 Casting to duration
types) and then computing the seconds component as
described in 10.3.2.3
Canonical representation.
fn:seconds-from-time
($arg
as
xs:time?
) as
xs:decimal?
Summary: Returns an xs:decimal
value greater than
or equal to zero and less than 60, representing the seconds and
fractional seconds in the localized value of $arg
.
fn:starts-with
($arg1
as
xs:string?
,
$arg2
as
xs:string?
) as
xs:boolean
fn:starts-with ( |
$arg1 |
as xs:string? , |
$arg2 |
as xs:string? , |
|
$collation |
as xs:string ) as xs:boolean |
Summary: Returns an xs:boolean
indicating whether
or not the value of $arg1
starts with a sequence of
collation units that provides a minimal match to the collation
units of $arg2
according to the collation that is
used.
fn:static-base-uri
() as
xs:anyURI?
Summary: Returns the value of the Base URI property from the static context. If the Base URI property is undefined, the empty sequence is returned. Components of the static context are discussed in Section C.1 Static Context ComponentsXP .
fn:string
() as
xs:string
fn:string
($arg
as
item()?
) as
xs:string
Summary: Returns the value of $arg
represented as
a xs:string
. If no argument is supplied, the context
item (.
) is used as the default argument. The behavior
of the function if the argument is omitted is exactly the same as
if the context item had been passed as the argument.
fn:string-join
($arg1
as
xs:string*
,
$arg2
as
xs:string
) as
xs:string
Summary: Returns a xs:string
created by
concatenating the members of the $arg1
sequence using
$arg2
as a separator. If the value of
$arg2
is the zero-length string, then the members of
$arg1
are concatenated without a separator.
fn:string-length
() as
xs:integer
fn:string-length
($arg
as
xs:string?
) as
xs:integer
Summary: Returns an xs:integer
equal to the length
in characters of the value of $arg
.
fn:string-to-codepoints
($arg
as
xs:string?
) as
xs:integer*
Summary: Returns the sequence of [The Unicode Standard] code
points that constitute an xs:string
. If
$arg
is a zero-length string or the empty sequence,
the empty sequence is returned.
fn:subsequence
($sourceSeq
as
item()*
,
$startingLoc
as
xs:double
) as
item()*
fn:subsequence ( |
$sourceSeq |
as item()* , |
$startingLoc |
as xs:double , |
|
$length |
as xs:double ) as item()* |
Summary: Returns the contiguous sequence of items in the value
of $sourceSeq
beginning at the position indicated by
the value of $startingLoc
and continuing for the
number of items indicated by the value of $length
.
fn:substring ( |
$sourceString |
as xs:string? , |
$startingLoc |
as xs:double ) as xs:string |
fn:substring ( |
$sourceString |
as xs:string? , |
$startingLoc |
as xs:double , |
|
$length |
as xs:double ) as xs:string |
Summary: Returns the portion of the value of
$sourceString
beginning at the position indicated by
the value of $startingLoc
and continuing for the
number of characters indicated by the value of
$length
. The characters returned do not extend beyond
$sourceString
. If $startingLoc
is zero or
negative, only those characters in positions greater than zero are
returned.
fn:substring-after
($arg1
as
xs:string?
,
$arg2
as
xs:string?
) as
xs:string
fn:substring-after ( |
$arg1 |
as xs:string? , |
$arg2 |
as xs:string? , |
|
$collation |
as xs:string ) as xs:string |
Summary: Returns the substring of the value of
$arg1
that follows in the value of $arg1
the first occurrence of a sequence of collation units that provides
a minimal match to the collation units of $arg2
according to the collation that is used.
fn:substring-before
($arg1
as
xs:string?
,
$arg2
as
xs:string?
) as
xs:string
fn:substring-before ( |
$arg1 |
as xs:string? , |
$arg2 |
as xs:string? , |
|
$collation |
as xs:string ) as xs:string |
Summary: Returns the substring of the value of
$arg1
that precedes in the value of $arg1
the first occurrence of a sequence of collation units that provides
a minimal match to the collation units of $arg2
according to the collation that is used.
fn:sum
($arg
as
xs:anyAtomicType*
) as
xs:anyAtomicType
fn:sum ( |
$arg |
as xs:anyAtomicType* , |
$zero |
as xs:anyAtomicType? ) as xs:anyAtomicType? |
Summary:
Returns a value obtained by adding together the values in
$arg
. If $zero
is not specified, then the
value returned for an empty sequence is the xs:integer
value 0. If $zero
is specified, then the value
returned for an empty sequence is $zero
.
fn:timezone-from-date
($arg
as
xs:date?
) as
xs:dayTimeDuration?
Summary: Returns the timezone component of $arg
if
any. If $arg
has a timezone component, then the result
is an xs:dayTimeDuration
that indicates deviation from
UTC; its value may range from +14:00 to -14:00 hours, both
inclusive. Otherwise, the result is the empty sequence.
fn:timezone-from-dateTime
($arg
as
xs:dateTime?
) as
xs:dayTimeDuration?
Summary: Returns the timezone component of $arg
if
any. If $arg
has a timezone component, then the result
is an xs:dayTimeDuration
that indicates deviation from
UTC; its value may range from +14:00 to -14:00 hours, both
inclusive. Otherwise, the result is the empty sequence.
fn:timezone-from-time
($arg
as
xs:time?
) as
xs:dayTimeDuration?
Summary: Returns the timezone component of $arg
if
any. If $arg
has a timezone component, then the result
is an xs:dayTimeDuration
that indicates deviation from
UTC; its value may range from +14:00 to -14:00 hours, both
inclusive. Otherwise, the result is the empty sequence.
fn:tokenize
($input
as
xs:string?
,
$pattern
as
xs:string
) as
xs:string*
fn:tokenize ( |
$input |
as xs:string? , |
$pattern |
as xs:string , |
|
$flags |
as xs:string ) as xs:string* |
Summary: This function breaks the $input
string
into a sequence of strings, treating any substring that matches
$pattern
as a separator. The separators themselves are
not returned.
fn:trace
($value
as
item()*
,
$label
as
xs:string
) as
item()*
Summary: Provides an execution trace intended to be used in debugging queries.
fn:translate ( |
$arg |
as xs:string? , |
$mapString |
as xs:string , |
|
$transString |
as xs:string ) as xs:string |
Summary: Returns the value of $arg
modified so
that every character in the value of $arg
that occurs
at some position N in the value of $mapString
has been replaced by the character that occurs at position
N in the value of $transString
.
fn:true
() as
xs:boolean
Summary: Returns the xs:boolean
value
true
. Equivalent to xs:boolean("1")
.
fn:unordered
($sourceSeq
as
item()*
) as
item()*
Summary: Returns the items of $sourceSeq
in an
implementation dependent order.
fn:upper-case
($arg
as
xs:string?
) as
xs:string
Summary: Returns the value of $arg
modified so
that every character in the value of $arg
that occurs
at some position N in the value of $mapString
has been replaced by the character that occurs at position
N in the value of $transString
.
fn:year-from-date
($arg
as
xs:date?
) as
xs:integer?
Summary: Returns an xs:integer
representing the
year in the localized value of $arg
. The value may be
negative.
fn:year-from-dateTime
($arg
as
xs:dateTime?
) as
xs:integer?
Summary: Returns an xs:integer
representing the
year component in the localized value of $arg
. The
result may be negative.
fn:years-from-duration
($arg
as
xs:duration?
) as
xs:integer?
Summary: Returns an xs:integer
representing the
years component in the value of $arg
. The result is
obtained by casting $arg
to an
xs:yearMonthDuration
(see 17.1.4 Casting to duration
types) and then computing the years component as described
in 10.3.1.3 Canonical
representation.
fn:zero-or-one
($arg
as
item()*
) as
item()?
Summary: Returns $arg
if it contains zero or one
items. Otherwise, raises an error [err:FONSRG0003].
This section lists all of the functions defined in the XSL
Transformations (XSLT) Version 2.0 specification. Each function
and operator is uniquely identified with a URI of the form:
“http://www.w3.org/2005/xpath-functions/#
name”
where name is the name of a function or operator, such as
“system-property”: http://www.w3.org/2005/xpath-functions/#system-property
.
The normative definitions of these functions are in the XSL Transformations (XSLT) Version 2.0 specification. For convenience, a very brief, non-normative summary of each function is provided. For details, follow the link on the “Summary:” introductory text below each function.
fn:current
() as
item()
Summary:
The current
function, used within an XPath expression,
returns the item that was the context item at the point where the
expression was invoked from the XSLT stylesheet. This is referred
to as the current item. For an outermost expression (an expression
not occurring within another expression), the current item is
always the same as the context item. Thus,
fn:current-group
() as
item()
Summary:
[Definition] The evaluation context for
XPath expressions includes a component called the current
group, which is a sequence. The current group is the collection
of related items that are processed collectively in one iteration
of the xsl:for-each-group
element.
fn:current-grouping-key
() as
xs:anyAtomicType?
Summary: [Definition] The evaluation context for XPath expressions includes a component called the current grouping key, which is an atomic value. The current grouping key is the grouping key shared in common by all the items within the current group.
fn:document
($uri-sequence
as
item()?
) as
node()
fn:document
($uri-sequence
as
item()?
,
$base-node
as
node()
) as
node()
Summary:
The document
function allows access to XML documents
identified by a URI.
fn:element-available
($element-name
as
xs:string
) as
xs:boolean
Summary: The value of the $element-name
argument
must be a string containing a QName. The QName is
expanded into an expanded-QName using the namespace declarations in
scope for the expression. If there is a default namespace in scope,
then it is used to expand an unprefixed QName. The
element-available
function returns true if and only if
the expanded-QName is the name of an instruction. If the
expanded-QName has a namespace URI equal to the XSLT namespace URI,
then it refers to an element defined by XSLT. Otherwise, it refers
to an extension instruction. If the expanded-QName has a null
namespace URI, the element-available
function will
return false.
fn:format-date ( |
$value |
as xs:date? , |
$picture |
as xs:string , |
|
$language |
as xs:string? , |
|
$calendar |
as xs:string? , |
|
$country |
as xs:string? ) as xs:string? |
fn:format-date
($value
as
xs:date?
,
$picture
as
xs:string
) as
xs:string?
Summary:
The format-dateTime
, format-date
, and
format-time
functions format $value
as a
string using the picture string specified by the
$picture
argument, the calendar specified by the
$calendar
argument, the language specified by the
$language
argument, and the country specified by the
$country
argument. The result of the function is the
formatted string representation of the supplied
dateTime
, date
, or time
value.
fn:format-dateTime ( |
$value |
as xs:dateTime? , |
$picture |
as xs:string , |
|
$language |
as xs:string? , |
|
$calendar |
as xs:string? , |
|
$country |
as xs:string? ) as xs:string? |
fn:format-dateTime
($value
as
xs:dateTime?
,
$picture
as
xs:string
) as
xs:string?
Summary:
The format-dateTime
, format-date
, and
format-time
functions format $value
as a
string using the picture string specified by the
$picture
argument, the calendar specified by the
$calendar
argument, the language specified by the
$language
argument, and the country specified by the
$country
argument. The result of the function is the
formatted string representation of the supplied
dateTime
, date
, or time
value.
fn:format-number
($value
as
numeric?
,
$picture
as
xs:string
) as
xs:string
fn:format-number ( |
$value |
as numeric? , |
$picture |
as xs:string , |
|
$decimal-format-name |
as xs:string ) as xs:string |
Summary:
The format-number
function formats $value
as a string using the picture string specified by the
$picture
argument and the decimal-format named by the
$decimal-format-name
argument, or the default
decimal-format, if there is no $decimal-format-name
argument. The syntax of the picture string is described in
16.4.2 Processing the
Picture String.
fn:format-time ( |
$value |
as xs:time? , |
$picture |
as xs:string , |
|
$language |
as xs:string? , |
|
$calendar |
as xs:string? , |
|
$country |
as xs:string? ) as xs:string? |
fn:format-time
($value
as
xs:time?
,
$picture
as
xs:string
) as
xs:string?
Summary:
The format-dateTime
, format-date
, and
format-time
functions format $value
as a
string using the picture string specified by the
$picture
argument, the calendar specified by the
$calendar
argument, the language specified by the
$language
argument, and the country specified by the
$country
argument. The result of the function is the
formatted string representation of the supplied
dateTime
, date
, or time
value.
fn:function-available
($function-name
as
xs:string
) as
xs:boolean
fn:function-available ( |
$function-name |
as xs:string , |
$arity |
as xs:integer ) as xs:boolean |
Summary: A function is said to be available within an XPath expression if it is present in the in-scope functionsXP for that expression (see 5.4.1 Initializing the Static Context). Functions in the static context are uniquely identified by the name of the function (a QName) in combination with its arity.
fn:generate-id
() as
xs:string
fn:generate-id
($node
as
node()?
)
as
xs:string
Summary:
The generate-id
function returns a string that
uniquely identifies a given node. The unique identifier
must consist of ASCII alphanumeric characters and
must start with an alphabetic character. Thus, the
string is syntactically an XML name. An implementation is free to
generate an identifier in any convenient way provided that it
always generates the same identifier for the same node and that
different identifiers are always generated from different nodes. An
implementation is under no obligation to generate the same
identifiers each time a document is transformed. There is no
guarantee that a generated unique identifier will be distinct from
any unique IDs specified in the source document. If the argument is
the empty sequence, the result is the zero-length
string. If the argument is omitted, it defaults to the
context node.
fn:key
($key-name
as
xs:string
,
$key-value
as
xs:anyAtomicType?
) as
node()
fn:key ( |
$key-name |
as xs:string , |
$key-value |
as xs:anyAtomicType? , |
|
$top |
as node() ) as node() |
Summary:
The key
function does for keys what the
id
function does for IDs.
fn:regex-group
($group-number
as
xs:integer
) as
xs:string
Summary:
[Definition] While the
xsl:matching-substring
instruction is active, a set of
current captured substrings is available, corresponding to
the parenthesized sub-expressions of the regular expression.
These captured substrings are accessible using the function
regex-group
. This function takes an integer argument
to identify the group, and returns a string representing the
captured substring.
fn:system-property
($property-name
as
xs:string
) as
xs:string
Summary:
The $property-name
argument must
evaluate to a lexical QName. The lexical QName is expanded as
described in 5.1 Qualified Names.
fn:type-available
($type-name
as
xs:string
) as
xs:boolean
Summary: A schema type (that is, a simple type or a complex
type) is said to be available within an XPath expression if it is a
type definition that is present in the in-scope schema
typesXP for that expression (see
5.4.1 Initializing the Static
Context). This includes built-in types, types imported
using xsl:import-schema
, and extension types defined
by the implementation.
fn:unparsed-entity-public-id
($entity-name
as
xs:string
) as
xs:string
Summary: The unparsed-entity-public-id
function
returns the public identifier of the unparsed entity whose name is
given by the value of the $entity-name
argument, in
the document containing the context node. It returns the
zero-length string if there is no such entity, or if the
entity has no public identifier. This function maps to
the dm:unparsed-entity-public-id
accessor defined in
[Data Model].
fn:unparsed-entity-uri
($entity-name
as
xs:string
) as
xs:anyURI
Summary: The unparsed-entity-uri
function returns
the URI of the unparsed entity whose name is given by the value of
the $entity-name
argument, in the document containing
the context node. It returns the zero-length
xs:anyURI
if there is no such entity.
This function maps to the
dm:unparsed-entity-system-id
accessor defined in [Data
Model].
fn:unparsed-text
($href
as
xs:string?
)
as
xs:string?
fn:unparsed-text
($href
as
xs:string?
,
$encoding
as
xs:string
) as
xs:string?
Summary:
The unparsed-text
function reads an external resource
(for example, a file) and returns its contents as a string.
fn:unparsed-text-available
($href
as
xs:string?
)
as
xs:boolean
fn:unparsed-text-available ( |
$href |
as xs:string? , |
$encoding |
as xs:string? ) as xs:boolean |
Summary:
The unparsed-text-available
function determines
whether a call on the unparsed-text
function with
identical arguments would return a string.