normalize-space function
The fn:normalize-space function strips leading and trailing white space characters from a string and replaces each internal sequence of white space characters with a single blank character.
Syntax
>>-fn:normalize-space(-+---------------+-)--------------------->< '-source-string-'
- source-string
- A string in which whitespace is to be normalized.
source-string is an xs:string value or the empty sequence.
If source-string is not specified, the argument of fn:normalize-space is the current context item, which is converted to an xs:string value by using the fn:string function.
Returned value
The returned value is the
xs:string value that results when the following operations are performed
on source-string:
- Leading and trailing whitespace characters are removed.
- Each internal sequence of one or more adjacent whitespace characters is replaced by a single space (X'20') character.
If source-string is the empty sequence, a string of length 0 is returned.
Example
The following function removes extra
whitespace characters from the string "a b c d ".
fn:normalize-space(" a b c d " )
The returned value is "a b c d".
