gui vs. server
Monday, 13 February 2012 · 2 messages
CM
Cerstin Mahlow13 Feb 2012 17:56 #
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
--
Dr. phil. Cerstin Mahlow
Universität Basel
Deutsches Seminar
Nadelberg 4
4051 Basel
Schweiz
Tel: +41 61 267 07 65
Fax: +41 61 267 34 40
Mail: cerstin.mahlow at unibas.ch
Web: http://www.oldphras.net
CM
Cerstin Mahlow13 Feb 2012 22:12 #
OK, I got it, I somehow managed to confuse ">" and "<".
Everything is running smoothly :)
--
Dr. phil. Cerstin Mahlow
Universität Basel
Deutsches Seminar
Nadelberg 4
4051 Basel
Schweiz
Tel: +41 61 267 07 65
Fax: +41 61 267 34 40
Mail: cerstin.mahlow at unibas.ch
Web: http://www.oldphras.net
---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.
Written for BaseX 7.0. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery