Hi Christian,
thanks a lot for your advice, but sorry, but I don't really get it so far.
Your code
let $query := "Paris" for $city in doc('factbook')//city/name[text() contains text {$query}] return ft:mark($city)
doesn't return the 'mark'-tags, which are important for me and where are you applying the search condition twice? Also I'm depending on information about the ancestor-node (country). Perhaps, I got it totally wrong.
About your one more thing ;-)
And one more thing:
{ if ($ele/ancestor::tei:TEI//tei:titleStmt/tei:title[@type="short"]) then $ele/ancestor::tei:TEI//tei:titleStmt/tei:title[@type="short"]/string() else if ($ele/ancestor::tei:TEI//tei:titleStmt/tei:title[@type="article"]) then $ele/ancestor::tei:TEI//tei:titleStmt/tei:title[@type="article"]/string() else if ($ele/ancestor::tei:TEI//tei:titleStmt/tei:title[@type="main"]) then $ele/ancestor::tei:TEI//tei:titleStmt/tei:title[@type="main"]/string()
This code will most probably be executed faster if you only do the path traveral once, e.g. as follows:
let $title := $ele/ancestor::tei:TEI//tei:titleStmt/tei:title [@type = ('short', 'article', 'main')]/string() ... return $title
I tried it and it's reducing the evaluation-time by half (ca. 16000ms). But if I don't use the let clause and return your code directly, the evaluation time goes down to 588ms!!
Best, Günter