fn:string-length function
The fn:string-length function returns the length of a string.
Syntax
- source-string
- The string for which the length is to be returned.
source-string has the xs:string data type, or is an empty sequence.
Returned value
If source-string is not the empty sequence, the returned value is an xs:integer value that is the number of characters in source-string.
If source-string is the empty sequence, the returned value is the xs:integer value 0.
If source-string is not specified, the argument of fn:string-length defaults to the string value of the context item. If the context item is undefined, an error is raised.
Example
The following function returns the
length of the string "Test literal".
fn:string-length("Test literal")
The returned value is 12.