Here's an answer similar to Dimitre's. I'd already written it, so I thought I'd go ahead and post it...
XSLT (2.0)
Also, if you're using XSLT 2.0 (I assumed you were since you used ends-with()
) you can use tokenize()
to capture pieces of the name.
Example: