Re: xslt core and intuition was RE: [xsl] Reference to variable c annot be resolved.

Subject: Re: xslt core and intuition was RE: [xsl] Reference to variable c annot be resolved.
From: Mike Brown <mike@xxxxxxxx>
Date: Fri, 14 Feb 2003 13:37:36 -0700 (MST)
Kienle, Steven C [IT/0200] wrote:
> the use of the name "variable" in XSLT was perhaps not the
> best name for the element.

This has been argued before, and the FAQ mentions that in XSLT, a variable is
more like a variable in the mathematical sense than like a constant.

The notion of a variable is defined in the XPath spec, and if you read just
that spec, there's nothing confusing about it at all, actually. It just says
that you have a set of variable bindings as part of the context, and that the
value of each variable is an object that may be one of the core XPath types or
maybe some other type, and you can reference the variable in an XPath
expression as long as an appropriate binding is in the context.

The confusion all comes from XSLT, where the bindings are established. XSLT
provides an instruction that establishes a variable binding, and then tries to
place restrictions on multiple bindings so that there's no ambiguity about
what binding is in scope as it trudges through the instructions and hops from
template to template. It could have been done without the restrictions, but
they were also trying to make things simpler for the implementations, which
supposedly could be optimized better if the processing flow was kept free of
side effects that would lock it into a single-threaded model. This hasn't
turned out to be used very much; we have yet to see very many multithreaded
XSLT processors that apply templates out of order and assemble the results at
the end, partly because it's more efficient to generate output as they go,
forgetting about entire branches of the result tree as soon as they are

Anyway, I might have argued for something like xsl:label-object instead of
xsl:variable, to make it somewhat easier to grok, but this would then make it
less clear that the point of the instruction is to establish what XPath still
needs to rightly call a variable.


  Mike J. Brown   |
  Denver, CO, USA |

 XSL-List info and archive:

Current Thread