Can I do this?
<sequence>
<annotation><appinfo...>
<dfdl:setVariable ref="foo" .../>
<dfdl:sequence initiator="{...expression involving foo...}"/>
<dfdl:newVariableInstance ref="foo" value="{...some expression...}"/>
<dfdl:sequence terminator="{...expression involving foo...}"/>
</appinfo></annotation>
</element>
See how I am spreading out the evaluation of the runtime-valued properties with the setVariable and newVariable stuff.
This works so long as we evaluate everything in schema definition order.
Now let me throw one more wrench (spanner for the UK folks) in the works. I'm going to add a short form annotation:
<sequence dfdl:separator="{... expression...}">
<annotation><appinfo...>
<dfdl:setVariable ref="foo" .../>
<dfdl:sequence initiator="{...expression involving foo...}"/>
<dfdl:newVariableInstance ref="foo" value="{...some expression...}"/>
<dfdl:sequence terminator="{...expression involving foo...}"/>
</appinfo></annotation>
</element>
Now, a short form annotation is equivalent to a long form conversion thereof, but in this case is it this one???
<sequence>
<annotation><appinfo...>
<!-- short form annotation comes FIRST when converted. -->
<dfdl:sequence separator="{...expression ...}"/> <!-- Expression cannot use variable foo. -->
<dfdl:setVariable ref="foo" .../>
<dfdl:sequence initiator="{...expression involving foo...}"/>
<dfdl:newVariableInstance ref="foo" value="{...some expression...}"/>
<dfdl:sequence terminator="{...expression involving foo...}"/>
</appinfo></annotation>
</element>
Or... is it this one:
<sequence>
<annotation><appinfo...>
<dfdl:setVariable ref="foo" .../>
<dfdl:sequence initiator="{...expression involving foo...}"/>
<dfdl:newVariableInstance ref="foo" value="{...some expression...}"/>
<dfdl:sequence terminator="{...expression involving foo...}"/>
<!-- short form annotation comes LAST when converted -->
<dfdl:sequence separator="{...expression ...}"/> <!-- expression could use varible foo. -->
</appinfo></annotation>
</element>
I would argue I prefer the first one, because makes the lexical order of appearance consistent with evaluation order.
...mikeb
--
Mike Beckerle | OGF DFDL WG Co-Chair
Tel: 781-330-0412