Hi,
when displaying search results, I would like to show more or less following and preceding nodes depending on the fond node name. This works fine in the GUI using this XQuery:
for $i at $p in //*[text() contains text ('Kopf' ftand 'Sand' ftand 'stecken')][self::*:p or self::*:l]
let $pre := $i/preceding-sibling::*[position()<8] let $suc := $i/following-sibling::*[position()<8]
return <div> {if (string(fn:node-name($i)) = "l") then $pre else "P"} {ft:mark($i [text() contains text ('Kopf' ftand 'Sand' ftand 'stecken')]) } {if (string(fn:node-name($i)) = "l") then $suc else "P"} </div>
For "l"-nodes I get preceding and following nodes, for "p" nodes the "P" will be printed.
However, when running the same on the server using a perl client (applying quoting for variables), I get the "P" for p-nodes but nothing for "l"-nodes. The conditional expression is correct, if I replace
then $pre
with
then <p>LLL</p>
everything works fine, "<p>LLL</p>" will be printed.
If I skip the condition and allow preceding and following nodes for every $i, I get preceding and following nodes for "p"-nodes only, but not for "l"-nodes -- there is simple nothing.
Is there any difference between GUI and Server? I use BaseX 7.1 beta, but I got the same effect with the BaseX 7.1 stable.
Best regards
Cerstin
OK, I got it, I somehow managed to confuse ">" and "<".
Everything is running smoothly :)
basex-talk@mailman.uni-konstanz.de