test150.txml 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?xml version="1.0"?>
  2. <!-- test that foreach causes a new variable to be declared if 'item' doesn't already exist. Also
  3. test that it will use an existing var if it does exist. -->
  4. <scxml initial="s0" conf:datamodel="" version="1.0" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance">
  5. <datamodel>
  6. <data conf:id="1"/>
  7. <data conf:id="2"/>
  8. <data conf:id="3">
  9. <conf:array123/>
  10. </data>
  11. </datamodel>
  12. <state id="s0">
  13. <onentry>
  14. <!-- first use declared variables -->
  15. <foreach conf:item="1" conf:index="2" conf:arrayVar="3"/>
  16. <raise event="foo"/>
  17. </onentry>
  18. <transition event="error" conf:targetfail=""/>
  19. <transition event="*" target="s1"/>
  20. </state>
  21. <state id="s1">
  22. <onentry>
  23. <!-- now use undeclared variables -->
  24. <foreach conf:item="4" conf:index="5" conf:arrayVar="3"/>
  25. <raise event="bar"/>
  26. </onentry>
  27. <transition event="error" conf:targetfail=""/>
  28. <transition event="*" target="s2"/>
  29. </state>
  30. <state id="s2">
  31. <!-- check that var4 is bound -->
  32. <transition conf:isBound="4" conf:targetpass=""/>
  33. <transition conf:targetfail=""/>
  34. </state>
  35. <conf:pass/>
  36. <conf:fail/>
  37. </scxml>