Description
The fn:normalize-space function collapses whitespace in a string. Specifically, it performs three steps:
- Replaces each carriage return (#xD), line feed (#xA), and tab (#x9) character with a single space (#x20)
- Collapses all consecutive spaces into a single space
- Removes all leading and trailing spaces
This description is © Copyright 2007, Priscilla Walmsley. It is excerpted from the book XQuery by Priscilla Walmsley, O'Reilly, 2007. For a complete explanation of this function, please refer to Appendix A of the book. Arguments and Return TypeName | Type |
$arg |
xs:string? |
return value |
xs:string |
ExamplesXQuery Example | Results |
---|
normalize-space('query') |
query |
normalize-space(' query ') |
query |
normalize-space('xml query') |
xml query |
normalize-space('xml query') |
xml query |
normalize-space('xml
query') |
xml query |
normalize-space('') |
zero-length string |
normalize-space(' ') |
zero-length string |
normalize-space(()) |
zero-length string |
normalize-space(
<element> query </element>) |
query |
See AlsoHistory |
Recommended Reading:
|