question about call-template

Subject: question about call-template
From: "Reid M. Pinchback" <reidmp@xxxxxxx>
Date: Sat, 29 Jan 2000 20:40:06 -0500
[Apologies if anybody has seen this message before.  I'm pretty sure the
 listserv never sent it out the first time, but the archive on Mulberry's
 web site is broken and I can't check to make sure.]


I'm stumped.

I've learned how to write a template.  Ditto for calling a template by name,
and for passing parameters to a template.

I can't find a way to pass the *name* of a template to another template,
and then call that template by that name.  In other words, something like:

<xsl:template match="/">
  <html><body>
    <xsl:call-template name="A">
      <xsl:with-param name="Tpl">B</xsl:with-param>
    </xsl:call-template>
  </body></html>
</xsl:template>

<xsl:template name="A">
  <xsl:param name="Tpl"></xsl:param>
  <xsl:call-template name="$Tpl"></xsl:call-template>
</xsl:template>

<xsl:template name="B">
  <HR/>
</xsl:template>

Should this be possible?  I'm using IBM's XSL processor, but when I try 
this I just get:

    "XSL Error: Could not find template named: '$Tpl'

Basically what I'm looking for is the same kind of functionality you get
in languages that allow you to pass a function by reference.  That way
I could create one template that did common processing, and pass a
specialized template to it to handle issues specific to the portion
of the document tree I'm trying to process (eg: create a generic reusable
table layout vs dealing with content-specific layout issues in the rows).

Thanks in advance for any assistance.



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread