Document Developer - instructions > XPath > More XPath expressions

More XPath expressions
Example 39
A field value reference to a field in the third instance of block1:
/data/message/block1[3]/field1
A relative path to the position_x field:
./position_x
A specific value of a variable:
$section[.="Section3"]
The first three instances of a block:
/data/message/block1[position()<=3]
The last three instances of a block:
/data/message/block1[position() > last()-3]
The value of the current array index when repeating for example a table row:
$x[@index = current()/@index]
Current context, with the condition that variable has specific value:
self::*[$section=’Section3’]
Current context, with the condition that the field is defined and has a non-blank value:
self::*[string(field)]
 
Example 40
$color_red[current()/value < 0]
 
Example 41
The string is returned for 1 div (value < 0) = 1. This is because the second argument of substring() is the start position of the returned string. 1 div (value < 0) = 1 if (value < 0) is true since true = 1. If (value>=0) is false, then the start position is 1 div 0 which is infinity. In this case, there is no start position of the string and an empty string is returned, which means no modification on the color property.
substring(’RGB(255,0,0)’, 1 div (value < 0))
 
OpenText StreamServe 5.6 Updated: 2013-03-01