Subject: Re: [xsl] passing template names From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx> Date: Fri, 7 Jul 2006 16:47:50 +0530 |
Saxon supports an alternative instruction saxon:call-template. This has the same effect as xsl:call-template, except that the name attribute may be written as an attribute value template, allowing the called template to be decided at run-time. The string result of evaluating the attribute value template must be a valid QName that identifies a named template somewhere in the stylesheet.
Regards, Mukul
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] passing template names, Karl | Thread | Re: [xsl] passing template names, George Cristian Bina |
[xsl] passing template names, Karl | Date | Re: [xsl] passing template names, George Cristian Bina |
Month |