Thanks Florent.
Now I am trying to search for a string and then only print the LINE item along
with the speaker.
Here is my code.
declare function local:handle-doc(
$doc as document-node(),
$speeches as element(SPEECH)+
)
{
<h1>{ document-uri($doc) }</h1>,
for $speech in $speeches
let $speaker := $speech/SPEAKER
let $lines := $speech/LINE
return (
let $searchRes := cts:search($lines, cts:word-query("with flowers"))
if ($searchRes) then
<h3>{ $speaker/text() }</h3>
<p>$searchRes</p>
else ""
)
};
for $d in doc("/C/Users/ashekhar/Desktop/Mark Logic/Shakespeare/dream.xml")
order by $d ascending
return local:handle-doc($d, $d//SPEECH)
The error I am getting is ...
What is QName_?
[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:
Thanks
Anil
> Date: Wed, 23 Sep 2009 21:41:00 +0000
> From: [email protected]
> Subject: Re: [MarkLogic Dev General] FLWOR clarification ...
> To: [email protected]
>
> Anil Shekhar wrote:
>
> > Can there be more than 1 return from 1 FLWOR expression?
>
> No, but the return expression can contains FLOWR expressions
> itself:
>
> for $i in $is
> return (
> <h1>{ $i }</h1>,
> $ks/<p>{ . }</p>
> )
>
> You can also make things easier and clearer by using a function:
>
> declare function local:handle-doc(
> $doc as document-node(),
> $speeches as element(SPEECH)+
> )
> {
> <h1>{ document-uri($doc) }</h1>,
> for $speech in $speeches
> let $speaker := $speech/SPEAKER
> let $lines := $speech/LINE
> return (
> <h3>{ $speaker/text() }</h3>,
> <p>{ $lines/text() }</p>
> )
> };
>
> for $d in doc()
> return local:handle-doc($d, $d//SPEECH)
>
> Regards,
>
> --
> Florent Georges
> http://www.fgeorges.org/
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
_________________________________________________________________
Microsoft brings you a new way to search the web. Try Bing™ now
http://www.bing.com?form=MFEHPG&publ=WLHMTAG&crea=TEXT_MFEHPG_Core_tagline_try
bing_1x1_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general