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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.