I have to create an XSL variable with a choose in it. Like the following:
The strategies in the other answers are good, in fact preferable to this one when feasible. But there are times when you don't have control over (or it's harder to control) what's in the variable. In those cases, you can strip away the surrounding space when you're testing the variable:
Instead of
use
normalize-space() strips the leading and trailing whitespace, and collapses other repeating white spaces to single ones.