fn:normalize-space

Return its argument with normalized whitespace.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

fn:normalize-space(string? $string) => string?

Description

This function returns the argument with normalized whitespace. Normalizing whitespace includes stripping leading and trailing whitespace and replace more than one whitespace character with a single whitespace character.

Argument

$string

string value

Example

  • Return the normalized form of a string with lots of spaces:

    normalize-space("   lots of  spaces   everywhere   ...    ")

    This returns the string "lots of spaces everywhere ...".