It's possible in principle, but the details depend entirely on the XSLT processor that you are using. Look in the product documentation for "extension functions".
With XSLT 2.0 you can do some pretty complex string parsing within the XSLT language, using instructions such as xsl:analyze-string.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference