XPath String Functions

Below are some of the common string functions used in XSLT

1) format-number() – Converts a number into a string

2) starts-with(string1, string2) – Returns true if the first string starts with the second string.

3) contains(string1, string2) – Returns true if the first string contains the second string.

4) normalize-space(string) – Trims the leading and trailing space from string. Also replaces consecutive occurrences of white space with a single space.

5) translate(string1, string2, string3) – Returns string1 after any matching characters in string2 have been replaced by the characters in string3.

6) concat(string1, string2, ) – Concatenates all strings (i.e. joins them together).

Some more functions —

7) current() – Returns the current node

8) document() – Used to access the nodes in an external XML document

9) element-available() – Tests whether the element specified is supported by the XSLT processor

10) function-available() – Tests whether the function specified is supported by the XSLT processor

11) generate-id() – Returns a string value that uniquely identifies a specified node

12) key() – Returns a node-set using the index specified by an element