OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

tamie message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Exit question


Title: Exit question

Suppose you have a scriplet that generates an XML effect.  Maybe it adds two values from events that it catches and puts them into a total elemet, like this:

<scriplet>
  <total>
    <var name="total1">
      <catch>
         <match condition="content/order[@customer='1']/@total"/>
      </catch>
    </var>
    <if condition="$total1 lt 0">
       <exit/>
    </if>
    <var name="total2">
      <catch>
         <match condition="content/order[@customer='2']/@total"/>
      </catch>
    </var>
    <if condition="$total2 lt 0">
       <exit/>
    </if>
    <eval expr="$total1 + $total2"/>
  </total>
</scriplet>

Everything is fine as long as both totals are greater than 0.  But if either of the exit conditions are met, what is the effect of the scriplet?

I see three options:

1)  The effect is anything that was produced up to when the exit was encountered.  In this case, that would be an empty total element.

2)  The effect is nothing at all.

3)  We allow the exit instruction to be a container for other instructions.  When an exit is encountered, its effect becomes the effect of the scriplet.  For example,

<if condition="$total2 lt 0">
  <exit>
    <error>Total must be greater than or equal to zero</error>
  </exit>
</if>

At this point, I like option 3.

- Chuck



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]