I don\'t know if it\'s possible, but I\'m wondering how to do it...
Let\'s say we have the following XSL:
Bla bla
It's not possible exactly as you describe, but if you want to be able to choose a template at run-time based on some value you set elsewhere, there is a trick to do that. The idea is to have your named template also match a node with a corresponding name in a distinct mode (so that it doesn't mess up your normal transformation), and then match on that. For example:
Bla bla bla
Bla bla bla
Note that you can use in , so you can do everything with this that you could do with a plain .
Also, the code above is somewhat lengthier than you might need because it tries to avoid using any XSLT extensions. If your processor supports exslt:node-set(), then you can just generate nodes directly using , and use node-set() to convert the resulting tree fragment to a plain node to match against, without the need for document('') hack.
For more information, see FXSL - it's a functional programming library for XSLT that is based on this concept.