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

Re: Variables and constants

Subject: Re: Variables and constants
From: "John E. Simpson" <simpson@xxxxxxxxxxx>
Date: Fri, 25 Feb 2000 09:18:47 -0500
xslt constants kay
At 08:16 AM 2/25/2000 -0500, John Lam wrote:
This is more of a philosophical question. Since I haven't worked with
functional programming languages before, can anyone explain to me the
rationale for not having true variables a'la procedural programming
languages (i.e. you can re-assign the value of an existing variable)?

Yes, it is rather a philosophical question. There was much debate about it here on the list when the first Working Draft of the spec to mention it first appeared.

David Carlisle just mentioned, in a reply to another message, XSLT's "side-effect-free" nature, and it applies here too. The "instructions" in an XSLT stylesheet are not true procedural instructions, in the manner of those found in procedural languages, but simple *declarations* of an effect to be achieved in the result tree given some condition in the source. This means that an XSLT processor doesn't need to process the instructions in any particular order -- again, very different from procedural languages. And if the instructions aren't processed in any particular order then the notion of a variable whose value may from time to time be reassigned becomes practically useless. In a procedural language, a variable's value can be relied on only at the point of reference -- which of course changes if you change the order of execution.

In general, I agree that developers accustomed to procedural-language conventions need to make a conceptual leap to use XSLT effectively. (And the term "variable" is only the tip of the iceberg.) But this list is peopled with dozens of such developers who've made the leap and been delighted with what they've learned.

(All just my opinion, of course.)

John E. Simpson          | I'm having amnesia and deja vu at the
http://www.flixml.org    | same time. I think I've forgotten
simpson@xxxxxxxxxxx      | this before.  (Steven Wright)

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

Current Thread


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.
First Name
Last Name
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.