Write a recursive template that accepts the string as input, after doing normalize-space(). Use substring-after() to get the "tail", i.e. the content after the first space. If the tail contains a space, recurse passing the tail as the argument. Otherwise, use substring-before() to get the the content before the first space, and that's your answer.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
|