Usually when someone tries to do this, it means they are not aware of the full power of xsl:apply-templates. The way to do dynamic despatch in XSLT is to use xsl:apply-templates. For example, for the problem cited, write template rules such as
...
...
...
and then use to do the despatch.