I think I had more or less the same problem as you. I had an "outer" template and wanted to call a different "inner" template depending on some variable set at run-time. I found your question by Googling for a way to have a dynamic <xsl:call-template>
. I solved it by using <xsl:apply-templates>
instead, as follows.
The input XML (generated at run-time) contains something along the lines of:
<template name="template_name_1"/>
The XSL in the "outer" template has:
<xsl:apply-templates select="template"/>
(The select="template"
in this apply-templates refers to the <template>
tag in the input XML)
And finally the "inner" template, which I wanted to include as a result of the value of the name
attribute in my XML, looks like:
<xsl:template match="template[@name='template_name_1']">
<!-- XSL / XHTML goes here -->
</xsl:template>
(Again, the match="template[@name='xyz']"
refers to the previous select="template"
and in turn to the <template>
tag and its name
attribute in the input XML)
In this way I can have a dynamically "called" template simply by controlled from my input XML.
This might not be the same problem as you are trying to solve but I think it's pretty close, and much simpler than the FSXL solutions mentioned elsewhere on this page.