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

Re: Wish List: Allow <xsl:choose> within <xsl:call-template>

Subject: Re: Wish List: Allow <xsl:choose> within <xsl:call-template>
From: "Alexandra Morgan" <lexalex@xxxxxxxxxxxxx>
Date: Thu, 11 Nov 1999 09:09:15 -0800
alexandra morgan
Nikita's snippit is interesting, but would it actually work? Section 11.5 of www.w3.org/TR/xslt states "...the binding is visible for all following siblings and their descendants." I read this and took this to mean that once you've passed the end of the element that's the parent of the xsl:variable element, the variable is gone... which, in this case, would mean that $par_one is only bound inside the xsl:when. Not very useful, I thought, but otherwise I don't know what they mean.

I would test this myself, but I can't seem to get variables working at all....

-- Lex "short for perpLEXed" 
 
--

On Thu, 11 Nov 1999 10:09:55   Nikita Ogievetsky wrote:
>Yow always can define parameters before calling a template.
>It is not very big price to pay.
>For example:
>
><xsl:choose>
>    <xsl:when test="$one">
>        <xsl:variable name="par_one" select="$one"/>
>    </xsl:when>
>    <xsl:when test="$done" >
>        <xsl:variable name="par_one" select="$done"/>
>    </xsl:when>
></xsl:choose>
>      ...
><xsl:call-template name="base-function">
>    <xsl:with-param name="one" select="$par_one" />
></xsl:call-template>
>
>On Thursday, 11 Nov 1999, Clark C. Evans wrote:
>> 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?
>
>
>Nikita Ogievetsky
>http://www.cogx.com
>
>
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


***********************************
chickclick.com
http://www.chickclick.com
girl sites that don't fake it.
http://www.chickmail.com
sign up for your free email.
***********************************


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


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.