This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: xsl:variable {RE: XSL to handle display mutiple pages}
- To: xsl-list at mulberrytech dot com
- Subject: Re: xsl:variable {RE: XSL to handle display mutiple pages}
- From: Mike Brown <mike at skew dot org>
- Date: Tue, 7 Nov 2000 17:08:00 -0700 (MST)
- Reply-To: xsl-list at mulberrytech dot com
Xu, Xiaocun wrote:
> I read in the book that once set, xsl:variable is non-changable.
Correct, for as long as the variable is in scope. When/where the variable
goes out of scope, you can assign it to something else.
> How do I have a changable variable, xsl:param?
No, xsl:param lets you assign a default value. It is usually used in
conjuction with xsl:with-param to pass a value to a template where the
variable would have otherwise been out of scope.
Understand that a variable is a *name* assigned to an *object* of one of
the basic types: boolean, number, string, node-set, result tree fragment.
When we talk about a variable's "value" we usually mean the object,
because a variable's "string-value" is the object's string-value, and is a
distinct concept.
xsl:variable or xsl:param just provide ways to bind a name to an object.
Once such a binding is made, you cannot bind the variable to another name.
What is it you are trying to do? Chances are, you are trying to do
procedural programming in a functional, declarative language, and there's
another way to accomplish the same result that doesn't rely on variable
rebinding.
- Mike
____________________________________________________________________
Mike J. Brown, software engineer at My XML/XSL resources:
webb.net in Denver, Colorado, USA http://www.skew.org/xml/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list