support elseif for xtemplate. Fixes #664