Using the EXSLT String Extensions
Problem
You have good reason to use extension functions for string processing, but you are concerned about portability.
Solution
You may find that your XSLT processor already implements string functions defined by the EXSLT community (http://www.exslt.org/). At the time of publication, these functions are:
-
node-set str:tokenize(string input, string delimiters?) The
str:tokenizefunction splits up a string and returns a node set of token elements, each containing one token from the string.The first argument is the string to be tokenized. The second argument is a string consisting of a number of characters. Each character in this string is taken as a delimiting character. The string given by the first argument is split at any occurrence of any character.
If the second argument is omitted, the default is the string
	

 (i.e., whitespace characters).If the second argument is an empty string, the function returns a set of token elements, each of which holds a single character.
-
node-set str:replace(string, object search, object replace) The
str:replacefunction replaces any occurrences of search strings within a string with replacement nodes to create a node set.The first argument gives the string within which strings are to be replaced.
The second argument is an object that specifies a search string list. If the second argument is a node set, then the search string list shows the result of converting each node in the node ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access