String manipulation is one of the most common tasks in XSLT. Whether you are formatting output, parsing codes, or normalising values from external systems, XPath provides a rich set of string functions. This reference covers the most useful ones with examples you can run in XSLT Playground .
Basic string functions (XSLT 1.0+)
string-length
Returns the number of characters in a string.
Enter fullscreen mode
Exit fullscreen mode
substring
Extracts a portion of a string. Arguments: string, start position (1-based), optional length.
Enter fullscreen mode
Exit fullscreen mode
substring-before and substring-after
Split a string on a delimiter.
Enter fullscreen mode
Exit fullscreen mode
contains, starts-with, ends-with
Test membership without extracting.
... ...
...
Enter fullscreen mode
Exit fullscreen mode
concat
Joins strings together.…