SCXML-tutorial

Contents Overview Examples Editor Forum

<param>

Video version

The <param> tag provides a general way of identifying a key and a dynamically calculated value which can be passed to an external service or included in an event.

Attribute Details

NameRequiredAttribute ConstraintsTypeDefault ValueValid ValuesDescription
nametrueNMTOKENnoneA string literalThe name of the key.
exprfalseMay not occur with ‘location’value expressionnoneValid value expressionA value expression (see 5.9.3 Legal Data Values and Value Expressions) that is evaluated to provide the value.
locationfalseMay not occur with ‘expr’location expressionnoneValid location expressionA location expression (see 5.9.2 Location Expressions) that specifies the location in the datamodel to retrieve the value from.

Examples:

1. Value is provided by 'expr' attribute.

param - expr

<scxml datamodel="lua" initial="s0" name="Scxml" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
	<state id="s0" initial="s01">
		<transition cond="_event.data.someParam==1" event="done.state.s0" target="End"/>
		<state id="s01">
			<transition target="s02"/>
		</state>
		<final id="s02">
			<donedata>
				<param expr="1" name="someParam"/>
			</donedata>
		</final>
	</state>
	<final id="End">
		<onentry>
			<log expr="'Pass'" label="Outcome"/>
		</onentry>
	</final>
</scxml>

2. Value is provided by 'location' attribute.

param - location

<scxml datamodel="lua" initial="s0" name="Scxml" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
	<datamodel>
		<data expr="1" id="VarA"/>
	</datamodel>
	<state id="s0" initial="s01">
		<transition cond="_event.data.someParam==1 and
_event.data.someParam==VarA" event="done.state.s0" target="End"/>
		<state id="s01">
			<transition target="s02"/>
		</state>
		<final id="s02">
			<donedata>
				<param location="VarA" name="someParam"/>
			</donedata>
		</final>
	</state>
	<final id="End">
		<onentry>
			<log expr="'Pass'" label="Outcome"/>
		</onentry>
	</final>
</scxml>

W3C IRP tests

1. Test 298

If the 'location' attribute on a param element does not refer to a valid location in the data model, the processor MUST place the error error.execution on the internal event queue.

test298

2. Test 343

If the 'location' attribute on a param element does not refer to a valid location in the data model, or if the evaluation of the 'expr' produces an error, the processor MUST ignore the name and value.

test343

3. Test 488

If the evaluation of the 'expr' produces an error, the processor MUST place the error error.execution on the internal event queue.

test488

TOP Contents Overview Examples Editor Forum