An XPath recipe list. See also Bibliographic XPath Queries and BaseX Adventures.
@ana if necessary):
@ana[ends-with(.,”exempla”)]
seg[ancestor-or-self::seg[@xml:id[. eq 'E6.9.4']]]
@ana[contains(.,”MARK”)]
seg[@ana[. eq 'MARK']][preceding-sibling::seg[@ana[. eq 'NORMAL']]]
seg elements with attribute @ana whose value equals “PLANA”, immediately preceded by a seg element sibling with attribute @ana whose value contains “tekst”seg as needed):
seg[@ana[. eq 'PLANA']][preceding-sibling::seg[1][@ana[contains(.,'tekst')]]]
anchor elements with attribute @n whose value is an odd numberseg as needed):
anchor[number(@n) mod 2 = 1]