i want to check via and xslt function if a string of an..17 and if a character like this fould it will be replaced with underscore _. My problem is that i dont know how to implement with the specific set of non ASCI characters. Should i create a set of the non ASCI characters and iterate through the string? Any ideas?
Asked
Active
Viewed 43 times
0
-
Please state which version of XSLT your processor supports - see: https://stackoverflow.com/a/25245033/3016153 – michael.hor257k Mar 23 '23 at 10:25
1 Answers
1
In XSLT 2.0 or higher you can do:
replace($yourString, '[^\p{IsBasic_Latin}]', '_')
to replace all non-ASCII characters with an underscore.
Note that this will preserve all ASCII characters - including non-printable control codes.

michael.hor257k
- 113,275
- 6
- 33
- 51
-
For an XSLT 1.0 solution, see: https://stackoverflow.com/a/38817745/3016153 – michael.hor257k Mar 23 '23 at 11:22
-
-
-
-
1It's not a variable, it's a Unicode block: https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block) – michael.hor257k Mar 23 '23 at 12:14