This can be achieved using Xpath function translate in XSL.
Let us first understand how this function works, then we will use it for our requirement.
Xpath function : string translate (string, string, string)
The translate function accepts 3 arguments and returns the first argument string with occurrences of characters in the second argument string replaced by the character at the corresponding position in the third argument string.
Lets understand it by an example, translate("bar","abc","ABC") returns the string BAr. If there is a character in the second argument string with no character at a corresponding position in the third argument string (because the second argument string is longer than the third argument string), then occurrences of that character in the first argument string are removed. For example, translate("--aaa--","abc-","ABC") returns "AAA". If a character occurs more than once in the second argument string, then the first occurrence determines the replacement character. If the third argument string is longer than the second argument string, then excess characters are ignored.
Solution to our problem -
- For fetching numbers use -
Above statement will return '123123'
- For fetching characters use -
Above statement will return 'qweasd'
Please leave your valuable suggestions in the comments section. Enjoy. :)