xsl-list
[Top] [All Lists]

Re: how to get variable value outside scope

2005-02-27 02:58:07

Mukul,

There are a few technical issues, eg

The form [1] binds a variable name to a simple(simplest!) RTF. This
form is similar to declaration : <xsl:variable name="varname"
select="'mukul'" /> . The form [2] binds a variable name to a tree
fragment 

actually the form <xsl:variable name="x">foo</xsl:variable> also binds a
result tree fragment, which is immportant it means you normally
shouldn't do it as it's inefficient and has the wrong behaviour when
coerced to boolean.

But mainly I wanted to comment on the general premise that

So the variable construct in XSLT behaves quite differently than
traditional variables. 

This is like describing chinese by saying that it doesn't use the
traditional english alphabet. The behaviour may be different from your
expectation but "tradition" depends on who you are, and how long you've
been there.

The use of variables to denote values rather than memory locations has a
long tradition that is much older than digital computers, and even in
the context of digital computer languages goes back at least as far as
lisp in the early 1960's. Given that, it reads rather strangely to see
such newfangled languages as Java, and even C, described as
"traditional". When I was first shown computer programmining (Fortran,
at school in the mid 70's) the use of "variables" in that language and
the fact that X=X+1 actually meant something and wasn't just a false
equation, was described by all the beginner guides as a strange use of
"variable" but a necessary low level feature in order to control a
machine which wasn't capable of the normal mathematical reasoning. How
times change....

David



________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--