Re: [xsl] Programming without Assignment Statements

Subject: Re: [xsl] Programming without Assignment Statements
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 5 Jan 2001 14:12:52 GMT

> The following seems verbose, inefficient and impractical:

Actually it only seems that way, it is none of them:-)
Mainly it looks verbose because of the XML syntax, but
that's just something to live with.

On the other hand why set a variable to 1 or 0 and then keep testing for
it, when you can put the values you want there in the first place.

Instead of testing $zerobased all the time you could go
<xsl:variable name="x">


<xsl:variable name="x">

Then instead of

   <xsl:variable name="y">
         <xsl:when test="$zeroBased"> 3.14159 </xsl:when>
         <xsl:otherwise> 2.71828 </xsl:otherwise>

you can just do $x/constant (in XSLT1.1 or use node-set() or document()
workarounds in XSLT 1.0)

It depends on the context, whether you know these dependent values at
the time you are making the choice of setting zero or one based.


This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit

 XSL-List info and archive:

Current Thread