- From: Jim Barnett <Jim.Barnett@genesyslab.com>
 - Date: Tue, 12 Feb 2013 21:50:32 +0000
 - To: Gavin Kistner <phrogz@me.com>, "www-voice@w3.org" <www-voice@w3.org>, "www-voice@w3.org" <www-voice@w3.org>
 - Message-ID: <57A15FAF9E58F841B2B1651FFE16D281020538@GENSJZMBX03.msg.int.genesyslab.com>
 
Gavin,
<transition> is not allowed inside the <scxml> element (in part to avoid problems like this.) <scxml> can have <state>, <parallel>, and <final> children (along with <datamodel> and <script>), but <transition is not allowed.
-          Jim
From: Gavin Kistner [mailto:phrogz@me.com]
Sent: Tuesday, February 12, 2013 4:39 PM
To: www-voice@w3.org; www-voice@w3.org
Subject: Fallback for LCCA when <scxml> is included
The prose for findLCCA() says "Note that there is guaranteed to be such an element since the <scxml> wrapper element is a common ancestor of all states." This makes sense; of course findLCCA() should always return something, the <scxml> if nothing else.
Then the prose says "Note also that since we are speaking of proper ancestor (parent or parent of a parent, etc.) the LCCA is never a member of stateList.". This is also true from the implementation.
However, if the <scxml> element itself is in stateList, then the current implementation causes the second statement to win over the first, and findLCCA() has a Null return value. Consider this document:
    <scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0">
      <transition cond="In('a')" target="pass"/>
      <parallel id="p"><state id="a"/></parallel>
      <final id="pass"/>
    </scxml>
When processing the states to enter in enterStates() findLCCA() is passed t.source, which is the <scxml>. Consequently findLCCA() returns Null, which causes the call to getProperAncestors(s,ancestor) to include the <scxml> element (since there is no stop node). This adds <scxml> to the configuration, and consequently my runtime gets cranky when it hits an active 'state' with no id.
The proposed fix is to add a final fallback line to findLCCA() as follows:
    function findLCCA(stateList):
      for anc in getProperAncestors(stateList.head(),null).filter(isCompoundState):
        if stateList.tail().every(lambda s: isDescendant(s,anc)):
          return anc
      return findScxml() # returns the root 'doc' <scxml> element
Received on Tuesday, 12 February 2013 21:51:00 UTC