The test checks the opt:selector attribute.
>>>>templates/test.tpl
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<opt:root>
<div opt:selector="sect">
<opt:foo>FOO: {$sect.val1},{$sect.val2}</opt:foo>
<opt:bar>BAR: {$sect.val1},{$sect.val2}</opt:bar>
</div>
</opt:root>
>>>>expected.txt
OUTPUT
>>>>result.txt
<div>FOO: A,B</div>
<div>BAR: C,D</div>
<div>FOO: E,F</div>
<div>BAR: G,H</div>
>>>>data.php
$view->sect = array(
array('val1' => 'A', 'val2' => 'B', 'item' => 'foo'),
array('val1' => 'C', 'val2' => 'D', 'item' => 'bar'),
array('val1' => 'E', 'val2' => 'F', 'item' => 'foo'),
array('val1' => 'G', 'val2' => 'H', 'item' => 'bar'),
);