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

Re: Programming without Assignment Statements

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

> 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">
  <base>0</base>
  <contant>3.14159</contstant>
</xsl:variable>

or

<xsl:variable name="x">
  <base>1</base>
  <contant>2.171828</contstant>
</xsl:variable>


Then instead of

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

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.

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp

 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.