functx:trim
Trims leading and trailing whitespace
Description
The functx:trim function removes whitespace at the beginning and end of a string. Unlike the built-in fn:normalize-space function, it only removes leading and trailing whitespace, not whitespace in the middle of the value. Whitespace is defined as it is in XML, namely as space, tab, carriage return and line feed characters. If $arg is the empty sequence, it returns a zero-length string.
Parameters |
Description |
---|---|
arg:string() |
the string to trim |
Examples
XPath |
Results |
---|---|
functx:trim(’ xyz ‘) |
xyz |
functx:trim(’ xyz’) |
xyz |
functx:trim(‘x xyz ‘) |
x xyz |