I was striving for the hypothetical (but illegal) solution of
<xsl:call-template name="$variable" /> (names cannot be variable).
Three suggestions:
(a) Have multiple task-oriented stylesheets each of which imports a
stylesheet containing common components. Start the transformation by
invoking a task-oriented stylesheet. The common code can call back using
<xsl:call-template name="name" /> provided that each task-oriented
stylesheet provides an implementation of "name": it doesn't have to be the
same code in each one.
(b) Use FXSL. This provides genuine higher-order programming, allowing you
to pass functions around as parameters, so you can call a function that was
supplied to you by your caller.
(c) Use the central idea behind FXSL, without actually using FXSL itself (it
has become quite a powerful monster). The central idea is to use an element
as a surrogate for a template. Instead of doing <xsl:call-template
name="$variable"/>, you do <xsl:apply-templates name="$variable"/>, where
$variable holds an element that will be matched by the template you want to
invoke (so there's a one-to-one correspondence between these elements and
their corresponding templates).
Michael Kay
http://www.saxonica.com/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--