RE: Shadowing of variables..

Geert,

Good catch, I think you have found a bug in the specification. In the section 5.7 (Variables, Options, and Parameters), the specification indeed says:

"Variables are created in compound steps and, like XSLT variables, are single assignment, though they may be shadowed by subsequent declarations of other variables with the same name."

But in section 3.2 (Scoping of names) it also says that:

"It is a static error (err:XS0004) if an option or variable declaration duplicates the name of any other option or variable in the same environment. That is, no option or variable may lexically shadow another option or variable with the same name."

These two statements clearly contradict each other. I think the fix is to remove the mention of shadowing from 5.7, but the WG will need to discuss this.

Regards,
Vojtech

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

> -----Original Message-----
> From: Geert Josten [mailto:geert.josten@dayon.nl]
> Sent: Sunday, November 27, 2011 1:59 PM
> To: XProc Dev
> Subject: Shadowing of variables..
> 
> The recommendation says:
> 	"Variables are created in compound steps and, like XSLT
> variables,
> are single assignment, though they may be shadowed by subsequent
> declarations of other variables with the same name."
> 	(http://www.w3.org/TR/xproc/#variables-options-parameters)
> 
> But doing this is not accepted by XMLCalabash:
> 
> 	<p:variable name="myvar" select="1"/>
> 	<p:variable name="myvar" select="2"/>
> 
> Nor is:
> 
> 	<p:variable name="myvar" select="1"/>
> 	<p:group>
> 		<p:variable name="myvar" select="2"/>
> 
> Is XMLCalabash too strict here or should I read 'subsequent
> declarations'
> in a different way?
> 
> Kind regards,
> Geert
> 
> 
> drs. G.P.H. (Geert) Josten
> Senior Developer
> 
> 
> 
> Dayon B.V.
> Delftechpark 37b
> 2628 XJ Delft
> 
> T +31 (0)88 26 82 570
> 
> geert.josten@dayon.nl
> www.dayon.nl
> 
> De informatie - verzonden in of met dit e-mailbericht - is afkomstig
> van
> Dayon BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit
> bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen.
> Aan
> dit bericht kunnen geen rechten worden ontleend.
> 

Received on Monday, 28 November 2011 08:04:21 UTC