Returns the value of $arg
with leading and trailing whitespace removed, and
sequences of internal whitespace reduced to a single space character.
fn:normalize-space
( xs:string
fn:normalize-space
( $arg
as xs:string?
xs:string
If the value of $arg
is the empty sequence, the function returns the
zero-length string.
The function returns a string constructed by stripping leading and trailing whitespace
from the value of $arg
, and replacing sequences of one or more adjacent
whitespace characters with a single space, #x20
.
The whitespace characters are defined in the metasymbol S (Production 3) of .
If no argument is supplied, then $arg
defaults to the string value
(calculated using fn:string
) of the context item (.
).
The expression fn:normalize-space(" The wealthy curled darlings
of our nation. ")
returns "The wealthy curled darlings of our nation."
.
The expression fn:normalize-space(())
returns ""
.
If no argument is supplied and the context item is absent then a dynamic error is raised: .
The definition of whitespace is unchanged in . It is repeated here for convenience:
S ::= (#x20 | #x9 | #xD | #xA)+