xsl:call-template question

Subject: xsl:call-template question
From: Joni Fazo <joni@xxxxxxxxxxx>
Date: Wed, 16 Feb 2000 11:36:38 -0800
Title: xsl:call-template question

Hello,

Is it possible to call a template and pass in as a parameter the name of the template you would like the called template to call?

Here's a (non-working) example of what I am trying to do:

<!-- / Template -->

<xsl:template match="/">
<HTML>
<xsl:call-template name="buildpage">
        <xsl:with-param name="nexttemplate">buildbody</xsl:with-param>
</xsl:call-template>
</HTML>
</xsl:template>

<!-- buildpage Template -->

<xsl:template name="buildpage">
        <xsl:param name="nexttemplate">defaulttemplate</xsl:param>
        <xsl:value-of select="$nexttemplate"/>
        <xsl:call-template name="{$nexttemplate}"/>
</xsl:template>

<!-- buildbody Template -->

<xsl:template name="buildbody">
<BODY> 
</BODY>
</xsl:template>

I get the error "No named template "{$nexttemplate}" found" when the line
<xsl:call-template name="{$nexttemplate}"/>
is processed.  I am able to get the value of $nexttemplate though...

Thanks in advance for any help you can give me.

Joni

Current Thread