|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: question on calling templates
Hi Eugene:
The name attribute on call-template is a qname, so there is no way to
use a variable in this sense.
What I would recommend is using modes instead... i.e.
<xsl:param name="outputType"/>
<xsl:call-template name="header"/>
<!-- handle the body -->
<xsl:choose>
<xsl:when test="$outputType='format1'">
<xsl:apply-templates mode="format1"/>
</xsl:when>
<xsl:when test="$outputType='format2'">
<xsl:apply-templates mode="format2"/>
</xsl:when>
</xsl:choose>
<xsl:call-template name="footer"/>
<xsl:template match="myelement" mode="format1">
...
</xsl:template>
HTH!
Dion
-----Original Message-----
From: Rotkop, Eugene [mailto:Eugene.Rotkop@xxxxxx]
Sent: Thursday, August 29, 2002 1:17 PM
To: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx'
Subject: question on calling templates
Hi,
I was wondering if there is a way to store template name in the variable
and
then call template.
So, the sample XSL would be following:
<xsl:variable name="currentTemplate" select="'test'"/>
<xsl:call-template name="$currentTemplate"/>
Seems like XSLT does not allow this. Am I using the wrong syntax? Can
this
be achieved in any other way?
The reason I am asking about this is that I am trying to use multiple
templates to create
header, body and footer for a web page. Header and footer stays the same
for
all the pages. However,
body always changes. If I assign template names to header, footer and
body,
I can call them to apply these templates.
I want to be able to call diffent body templates depending on the value
of a
variable.
Any help would be appreciated.
Thanks,
Eugene
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








