p:variable :: What does shaddowing mean and can I reassign a new value to a previously declared p:variable

110 Views Asked by At

I've not tried it yet.

Can we update the value of p:variable anywhere else in the pipeline i.e. after its valid declaration at start of some step? If not then why? Also what is the best way of doing this, if I really need to do or at least simulate it.

1

There are 1 best solutions below

0
On

I forwarded your question to the xproc-dev mailinglist. Apparently, the recommendation seems to contradict itself. Section 5.7 ( http://www.w3.org/TR/xproc/#variables-options-parameters ) says quite explicitly that shadowing should be allowed in specific conditions. But section 3.2 ( http://www.w3.org/TR/xproc/#scoping ) says that reusing the same variable name in a scope is an error. The consensus was though that this should in principle work:

<p:variable name="myvar" select="1"/>
<p:group>
    <p:variable name="myvar" select="2"/>

However, XMLCalabash (0.9.40) chokes on this. You might try Calumet or other processors though..