let $test := function($node) { $node/text() contains text { $term } }
for $ft in (db:get('DB')//*[$test(.)])[position() = $start to $end]
return element hit { ft:mark($ft[$test(.)])}
</syntaxhighlight>
'''Example 3''': The following expression returns <code><xml>hello <b>word</b></xml></code>: