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

Subject: [xsl] Re: telling an outer template which template to call...
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Mon, 1 Sep 2003 23:09:40 +0200

  "The Functional Programming Language XSLT - A proof through examples"



"Functional programming in XSLT using the
FXSL library"




Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

"Felix Breuer" <felix@xxxxxxxxxx> wrote in message
> 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

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

Current Thread