Re: [xsl] passing template names

Subject: Re: [xsl] passing template names
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Fri, 7 Jul 2006 05:54:34 -0700
What you call "dynamic templates" are actually higher-order functions.
Fortunately, extensions are not necessary.

Do have a look at the articles on the FXSL page (http://fxsl.sf.net)
where the general solution to this problem for XSLT 1.0 is presented.

Also, most of their contents is also presented in:

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

At the forthcoming Extreme Markup Languages 2006 next month in
Montreal I will present the solution for XSLT 2.0 -- for those who
could not attend the conference a link will be posted on the FXSL page
when the IDEALLIANCE conference publications page is updated with this
year's articles.

--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.


On 7/7/06, Karl <call14@xxxxxxxxx> wrote:
I am in a situation where in a particular section need to call
different template dynamically based on which template invokes it.
Though I can use <xsl:choose> or <xsl:if> to do that, i wish i pass
the template name as a param value.

e.g.
<xsl:call-template name="A">
<xsl:with-param name="TemplateName">xx_template</xsl:with-param>
</xsl:apply-templates>
...

<xsl:call-template name="A">
<xsl:with-param name="TemplateName">yy_template</xsl:with-param>
</xsl:apply-templates>

and then

<xsl:template name="A">
<xsl:param name="TemplateName"/>
....
<xsl:call-template name="{$TemplateName}"/>
..
</xsl:template>

I doesnt work. Is it valid? If not, are there any better method to
achieve similar result. Currently, iam  passing numbers in param and
use <xsl:choose> to call different templates .

Thanks
karl



___________________________________________________________
All New Yahoo! Mail  Tired of Vi@gr@! come-ons? Let our SpamGuard protect
you. http://uk.docs.yahoo.com/nowyoucan.html

Current Thread