[xsl] telling an outer template which template to call...

Subject: [xsl] telling an outer template which template to call...
From: Felix Breuer <felix@xxxxxxxxxx>
Date: 01 Sep 2003 22:13:05 +0200
Hello!

I would like an outer template to call an inner template which is
specified by a parameter. I.e. I would like to get the following example
working:

<xsl:template match="/">
  <xsl:apply-templates select="foo">
    <xsl:with-param name="para">bar</xsl:with-param>
  </xsl:apply-templates select="foo">
</xsl:template>

<xsl:template match="foo">
  <xsl:param name="para">moo</xsl:with-param>
  ...
  <xsl:call-template name="{$para}"/>
  ...
</xsl:template>

<xsl:template name="bar">...</xsl:template>
<xsl:template name="moo">...</xsl:template>

I hope the above makes it clear what I am aiming at. [Obviously the
whole stylesheet is going to be a bit more complicated or such an
involved solution wouldn't be necessary.]

Now, when I run the above through xsltproc (libxslt) I get errors like

xsl:call-template : template {$para} not found

Obviously, the problem is that the parameter $para is not expanded
before the call-template element is executed.

My questions are:
1) Is $para supposed not to be expanded in time? Or is this a bug in
libxslt?
2) Is there a way to get this stylesheet working? With libxslt or any
other processor?

Thanks in advance,
Felix Breuer


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


Current Thread