In XSLT 2.0 you can use regular expressions to perform such string manipulation, using the xsl:analyze string instruction.
In 1.0 you've only got the functions such as substring-before, contains(), and substring-after(). If the text contains a pattern that repeats a variable number of times, you will need to analyze it using a recursive template. For an example, see the str:tokenize template found at
www.exslt.org (you might even be able to use this directly)
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference