xsl-list
[Top] [All Lists]

Re: telling an outer template which template to call...

2003-09-01 14:09:40
See:

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


http://fxsl.sourceforge.net/articles/FuncProg/Functional%20Programming.html

or

"Functional programming in XSLT using the
FXSL library"

at


http://www.mulberrytech.com/Extreme/Proceedings/xslfo-pdf/2003/Novatchev01/EML2003Novatchev01.pdf



=====
Cheers,

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



"Felix Breuer" <felix(_at_)fbreuer(_dot_)de> wrote in message
news:1062447181(_dot_)9215(_dot_)24(_dot_)camel(_at_)tapir(_dot_)(_dot_)(_dot_)
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



<Prev in Thread] Current Thread [Next in Thread>