Hi Florent,
Thanks for your clarification. But the error seems to persist ...
I did change the code as per your guidelines ...
return (
let $searchRes := cts:search($lines, cts:word-query("with flowers"))
if ( $searchRes ) then (
<h3>{ $speaker/text() }</h3>,
<p>{ $searchRes }</p>
)
else
()
)
This is what I see ... The same error is again being pointed to line 12.
cts:search does return a sequence and if returns false for empty sequence.
Please help me understand what does "QName_" mean?
query evaluated in Shakespeare at file::C:\Users\ashekhar\Desktop\Mark
Logic\Root as 1.0-ml (cq v4.1-1)[1.0-ml] XDMP-UNEXPECTED: (err:XPST0003)
Unexpected token syntax error, unexpected QName_Stack trace:
line 12: 10: return (
11: let $searchRes := cts:search($lines, cts:word-query("with
flowers"))
12: if ( $searchRes ) then (
13: <h3>{ $speaker/text() }</h3>,
14: <p>{ $searchRes }</p>
xdmp:eval("declare
function local:handle-doc( $doc as ...", (),
<options
xmlns="xdmp:eval"><root>C:\Users\ashekhar\Desktop\Mark
Logic\Root</root><isolation...</options>)
in /cq/eval.xqy line 111:
> Date: Fri, 2 Oct 2009 06:52:38 +0000
> From: [email protected]
> Subject: Re : FW: [MarkLogic Dev General] FLWOR clarification ...
> To: [email protected]
>
> Anil Shekhar wrote:
>
> Hi Anil,
>
> > if ($searchRes) then
> > <h3>{ $speaker/text() }</h3>
> > <p>$searchRes</p>
> > else ""
>
> The production rule for the if expression is:
>
> [45] IfExpr ::= "if" "(" Expr ")" "then" ExprSingle "else" ExprSingle
>
> Here, you have:
>
> "if" "(" Expr ")" "then" ExprSingle ExprSingle "else" ExprSingle
>
> with 2 single expressions after the "then" keyword. Use
> parentheses and a coma to make a single expression from two
> expressions:
>
> if ($searchRes) then (
> <h3>{ $speaker/text() }</h3>,
> <p>$searchRes</p>
> )
> else
> ""
>
> BTW, I guess you want to evaluate $searchRes so you have to use
> curly braces in the element ctor: <p>{ $searchRes }</p>. I am
> not sure because I don't know the exact business logic, but it
> seems you don't have to return an empty string in the else
> clause, but instead an empty sequence:
>
> if ( $searchRes ) then (
> <h3>{ $speaker/text() }</h3>,
> <p>{ $searchRes }</p>
> )
> else
> ()
>
> Regards,
>
> --
> Florent Georges
> http://www.fgeorges.org/
_________________________________________________________________
Insert movie times and more without leaving HotmailĀ®.
http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd_062009_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general