blob: 6811bc60febb10495753aa26ef7ba12f77f11c2b [file] [log] [blame]
<?xml version="1.0"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<!-- A fictitious state machine used by test cases. Meant to illustrate
prefixed XPath expressions in the Commons SCXML Data() function -->
<scxml xmlns="http://www.w3.org/2005/07/scxml"
version="1.0"
datamodel="jexl"
initial="ten">
<!-- Start with same prefixes, defined in two different places -->
<state id="ten">
<datamodel>
<data id="data10" xmlns:ns1="http://namespace.test.domain/1">
<root xmlns="">
<ns1:foo>
<bar>10</bar>
</ns1:foo>
</root>
</data>
</datamodel>
<transition xmlns:ns1="http://namespace.test.domain/1"
event="done.state.ten" cond="Data('string($data10/root/ns1:foo/bar)') eq 10"
target="twenty" />
</state>
<!-- Already defined (and different) prefixes -->
<state id="twenty" xmlns:ns1="http://namespace.test.domain/1"
xmlns:ns2="http://namespace.test.domain/2"
xmlns:ns3="http://namespace.test.domain/1"
xmlns:ns4="http://namespace.test.domain/2">
<datamodel>
<!-- Start with a prefixless XPath -->
<data id="data20">
<ns1:root>
<ns2:foo>20</ns2:foo>
</ns1:root>
</data>
</datamodel>
<transition event="done.state.twenty" cond="Data('string($data20/ns3:root/ns4:foo)') eq 20"
target="thirty" />
</state>
<!-- XPath looking at attribute -->
<state id="thirty">
<datamodel>
<!-- Start with a prefixless XPath -->
<data id="data30">
<root xmlns="http://namespace.test.domain/1">
<foo xmlns="http://namespace.test.domain/2"
xmlns:ns1="http://namespace.test.domain/3"
ns1:content="30"/>
</root>
</data>
</datamodel>
<transition event="done.state.thirty"
xmlns:ns1="http://namespace.test.domain/1"
xmlns:ns2="http://namespace.test.domain/2"
xmlns:ns3="http://namespace.test.domain/3"
cond="Data('string($data30/ns1:root/ns2:foo/@ns3:content)') eq 30"
target="forty" />
</state>
<final id="forty"/>
</scxml>