Subject: Re: [xsl] dynamic template invocation From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Mon, 7 Sep 2009 08:27:23 -0700 |
Search about FXSL. This feature is there (in a way that is allowed by the XSLT 1.0 language) since 2002. -- Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without significant intelligence. --------------------------------------- To invent, you need a good imagination and a pile of junk ------------------------------------- Never fight an inanimate object ------------------------------------- You've achieved success in your field when you don't know whether what you're doing is work or play ------------------------------------- I enjoy the massacre of ads. This sentence will slaughter ads without a messy bloodbath. On Sun, Sep 6, 2009 at 11:06 PM, ac<ac@xxxxxxxxxxxxx> wrote: > 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> > B <xsl:when test="$mode eq 'mode1'"><xsl:apply-templates mode="mode1"/> > B <xsl:when test="$mode eq 'mode2'"><xsl:apply-templates mode="mode2"/> > B <xsl:when test="$mode eq 'mode3'"><xsl:apply-templates mode="mode3"/> > B ... > </xsl:choose> > or > <xsl:choose> > B <xsl:when test="$mode eq 'mode1'"><xsl:call-template name="name1"/> > B <xsl:when test="$mode eq 'mode2'"><xsl:call-template name="name2"/> > B <xsl:when test="$mode eq 'mode3'"><xsl:call-template name="name3"/> > B ... > </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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] dynamic template invocati, Jingjun Long | Thread | Re: [xsl] dynamic template invocati, ac |
Re: [xsl] dynamic template invocati, ac | Date | Re: [xsl] dynamic template invocati, Jingjun Long |
Month |