Reputation: 929
Is there any straight function in XSLT to remove the punctuation as like [:punct:]
we have in Perl?
Upvotes: 0
Views: 124
Reputation: 167716
http://perldoc.perl.org/perlrecharclass.html suggests that [:punct:]
is some Perl specific way to define a range of punctuation characters in regular expression matching and replacement, it seems the characters defined by that notation differ depending on various factors like ASCII or Unicode treatment, I am not able to tell exactly which characters it defines in Unicode.
However, XSLT and XPath always work on Unicode and allow you to denote the range of all Unicode punctuation characters with the characters class \p{P}
so you can use that with e.g. replace('a.b,c', '\p{P}', '')
. There are other more restrictive punctuation ranges, see the "Category escape" section in https://www.w3.org/TR/xmlschema-2/#charcter-classes.
Upvotes: 3