Hi Jack, Thanks for your observation.
> The first result of this query is the entry for Austria. I would expect > both of the instances of the word 'German' in that entry to be surrounded > by <mark> tags. However only the first instance is. > I couldn’t reproduce this yet. Here’s a command script that returns 14 <mark>German</mark> elements: <commands> <set option='ftindex'>true</set> <create-db name='factbook'>https://files.basex.org/xml/factbook.xml </create-db> <xquery><![CDATA[ let $groups := ('ethnicgroups', 'languages') let $database := 'factbook' let $query := 'German' let $search := ft:search($database, $query)/parent::* [name() = $groups]/ancestor::country let $marked := ft:mark( $search[.//*[name() = $groups][text() contains text { $query }]] ) return $marked//*[text() = 'German'] ]]></xquery> </commands> Could you check if you get the same result? Thanks in advance Christian