This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav:< [Date Index] [Subject ex] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread&nNext]

Here is the way I would solve it.
Regards,
Gerard

<?xml version="1.0"?>
<xsl:stylesheet version="1                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
             <!-- / Template -->

<xsl:variable name="nexttemplate">1</xsl:variable>

<xsl:template match>
<HTML>
<xsl:call-template name="buildpage">
         <xsl:with-param name="nexttemplate">buildbody<l:with-param>
</xsl:call-template>
</HTML>
</xsl:template>

<!-- buildpage Template -->

<xsl:late name="buildpage">
         <xsl:param name="nexttemplate">defaulttemplate</xsl:param>
         Invoking xsl:value-of select="$nexttemplate"/>
         <xsl:choose>
         <xsl:when test="$nexttemplate = 'buildbody';
           <xsl:call-template name="buildbody"/>
         </xsl:when>
         <xsl:when test="$nexttemplat''">
           <xsl:call-template name="defaulttemplate"/>
         </xsl:when>
         </xsl:choose>;/xsl:template>

<xsl:template name="defaulttemplate">
In defaulttemplate
</xsl:template>

<!-- buildbody late -->

<xsl:template name="buildbody">
<BODY>
</BODY>
</xsl:template>
</xsl:stylesheet>
11:36 AM 2/16/00 -0800, you wrote:

>Hello,
>
>Is it possible to call a template and pass in as a parameter the nam 
>the template you would like the called template to call?
>
>Here's a (non-working) example of what I am trying t:
>
><!-- / Template -->
>
><xsl:template match="/">
><HTML>
><xsl:call-template nameildpage">
>         <xsl:with-param name="nexttemplate">buildbody</xsl:with-param>
></xsl:call-templgt;
></HTML>
></xsl:template>
>
><!-- buildpage Template -->
>
><xsl:template name="bpage">
>         <xsl:param name="nexttemplate">defaulttemplate</xsl:param>
>         <xsl:value-of ct="$nexttemplate"/>
>         <xsl:call-template name="{$nexttemplate}"/>
></xsl:template>
>
>&l- buildbody Template -->
>
><xsl:template name="buildbody">
><BODY>
></BODY>
></xsl:tate>
>
>I get the error "No named template "{$nexttemplate}" found" when the line
><xsl:call-template name="{ttemplate}"/>
>is processed.  I am able to get the value of $nexttemplate though...
>
>Thanks in advance for anyp you can give me.
>
>Joni

==========================
Gerard Berthet
XML Networks, Inc.
Email: gberthet@xmlnetworks.cA  HREF="http://www.xmlnetworks.com">http://www.xmlnetworks.com
Tel:  +1 (408) 356 - 5549
Cell: +1 (408) 218 - 1178
Fax: (408) 356 - 0136


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

-X-References--> htdig_noindex--> td>[Date Prev] [Date Next]
Index Nav: [Date Index] [Subject Index] [Author x] [Thread Index]
Message Nav: [Thread Prev] [Thread Next]