[SCXML] Incorrect XPath expressions in IR tests 153 & 155

Hi,

I think I detected the following incorrect XPath expression in IR test 153

The scxml test document generated by the confXPath.xsl stylesheet contains the 
following datamodel:

   <datamodel>
     <data id="Var1" expr="0"/>
     <data id="Var2"/>
     <data id="Var3">
       <node xmlns="">1</node><node xmlns="">2</node><node xmlns="">3</node>
     </data>
     <data id="Var4" expr="1"/>
   </datamodel>

and the following <foreach> element:

   <foreach item="Var2" array="$Var3/*">
     <if cond="$Var1/text() &lt;$Var2/text() ">
       <assign location="$Var1" expr="$Var2/text()"/>
     <else/>
       <!-- values are out of order, record failure -->
       <assign location="$Var4" expr="0"/>
     </if>
   </foreach>

The "Var2/text()" xpath expressions in the if condition check and the assignment 
value expression above are not valid/usable in this context.

The foreach element will assign each of the Var3 <node>x</node> children to the 
Var2 variable, and the Var2 variable (its data node) thus will contains no 
(direct) text node children, only a (single) "node" child.

To access the actual text value of that "node" child, the expression must be: 
"$Var2/*/text()" or if desired "$Var2/node[1]/text()".


And IMO a similar incorrect xpath expression, although produced differently and 
in different context, exists in test 155 where:

   expr="$Var1/text() + $Var2/text()"

should be:

   expr="$Var1/text() + $Var2/*/text()"
or
   expr="$Var1/text() + $Var2/node[1]/text()"

to produce the correct result.


Thanks, Ate

Received on Sunday, 8 February 2015 22:23:11 UTC