Shadowing of options/variables

I took a look at the spec and the test suite and what looks as potentially contradictory prose in the spec (section 2.9: "Variables and options share the same scope and may shadow each other." vs. section 3.2: "That is, no option or variable may lexically shadow another option or variable with the same name.") is, I think, actually correct.

You should not be able to do things like:

   <p:pipeline>
     <p:option name="foo" select="..."/>
     <p:variable name="foo" select="..."/>
     ...

But you be able to do this:

   <p:pipeline>
     <p:option name="foo" select="..."/>
     <p:group>
       <p:variable name="foo" select="..."/>
       ...

I think both follows from the spec, and the test suite confirms that, although it does not cover all scenarios. See tests err-s0004-003.xml, err-s0004-004.xml, variable-006.xml, and variable-007.xml. (What is missing are tests that demonstrate shadowing of options by variables.)

The key point about section 3.2 is that it forbids declaring options/variables with the same name *in the same environment*, but not in different environments.

So that is good: the spec already supports variable/option shadowing.

Regards,
Vojtech

--
Vojtech Toman
Consultant Software Engineer
EMC | Information Intelligence Group
vojtech.toman@emc.com
http://developer.emc.com/xmltech

Received on Wednesday, 20 February 2013 16:23:15 UTC