[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

dynamic template invocation

Subject: dynamic template invocation
From: ac <ac@xxxxxxxxxxxxx>
Date: Mon, 07 Sep 2009 02:06:09 -0400
 dynamic template invocation
Hi,

Is there, or shouldn't there be, a way to invoke templates dynamically as in:

<xsl:apply-templates mode="$mode"/> or
<xsl:call-template name="$name"/>

rather than :
<xsl:choose>
   <xsl:when test="$mode eq 'mode1'"><xsl:apply-templates mode="mode1"/>
   <xsl:when test="$mode eq 'mode2'"><xsl:apply-templates mode="mode2"/>
   <xsl:when test="$mode eq 'mode3'"><xsl:apply-templates mode="mode3"/>
   ...
</xsl:choose>
or
<xsl:choose>
   <xsl:when test="$mode eq 'mode1'"><xsl:call-template name="name1"/>
   <xsl:when test="$mode eq 'mode2'"><xsl:call-template name="name2"/>
   <xsl:when test="$mode eq 'mode3'"><xsl:call-template name="name3"/>
   ...
</xsl:choose>

as the <xsl:choose/> seems clumsy, verbose, repetitive, error-prone, and counter productive,
especially when also passing invocation parameters (<xsl:with-param .../>) ?


A sample use case may be letting a user select in which mode she wishes to run a process, payroll for example, in trial, debug, report, post, archive, or purge modes.

Thanks,
ac

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.