Subject: RE: Wish List: Allow <xsl:choose> within <xsl:call-template>
From: "Clark C. Evans" <clark.evans@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 10 Nov 1999 22:14:14 -0500 (EST)
|
On Wed, 10 Nov 1999, Mike Brown wrote:
> I don't get it. Did your example templates demonstrate what you were trying
> to say? It seems like this would do just as well in the second template, and
> wouldn't be that much more tedious:
>
> <xsl:choose>
> <xsl:when test="$one">
> <xsl:call-template name="base-function">
> <xsl:with-param name="one" select="$one" />
> </xsl:call-template>
> </xsl:when>
> <xsl:when test="$done" >
> <xsl:call-template name="base-function">
> <xsl:with-param name="one" select="$done" />
> </xsl:call-template>
> </xsl:when>
> </xsl:choose>
This works when you only have one parameter; but in the
general case with N parameters, you have N! cases
to handle with the current method shown above -- by
allowing the <xsl:choose> inside the <xsl:call-template>
you avoid all this unnecessary writing. In my current
application I have 8 parameters in the base function;
each with non-trivial default values. As a work-around
I've had to make each "default value" a stand-alone
template that is called by the derived function.
Does this explain better?
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|