Re: Binding of variables in an attribute set

Kay Michael wrote:
> 
> In the XSLT WD of 21 April 1999:
> 
> Section 9.1.4 states: "the value of attributes in an attribute set is
> determined
> when the attribute set is used rather than when it is defined".
> 
> It's not clear whether this is intended to override the rules on scope of
> variables;

It's not.  It doesn't say anything that conflicts with the rules on
variable scoping.

> section 13 states that the set of variable bindings in scope for
> an expression is those that are visible at the point where the expression
> [textually] occurs.

Right.  It's lexically scoped.

> (If it doesn't mean this, what does it mean?)
> 
> I'm thinking of the case where the value of an attribute in an attribute set
> is determined by reference to a variable. It might also happen that the name
> of an attribute in an attribute set is defined using an attribute value
> template that references a variable. The statement in section 9.1.4 refers
> to the values of the attributes, not their names, but it would be odd if the
> two cases were different.

Not really.  It's exactly the same as with invoking a template:

If I do

  <xsl:call-template name="foo"/>

then the result tree fragment I get from the call-template is determined
when the template is called, not when the template is defined, but the
scope of variables in the template is still lexical.

You could argue that attribute-sets should have parameters as well, but
it doesn't seem worth it.

James

Received on Thursday, 13 May 1999 04:37:19 UTC