Thanks for the response John.
After introducing a space, the compilation error was gone.

Thanks again,
Vedavalli Radhika

Hi Vedavalli,

Older versions of MarkLogic had trouble distinguishing a return clause
from a function call without a space between the "return" and a
following open parenthesis. You should try adding a space, like this:

return (xdmp:node-replace

John

On 04/05/11 12:41, Vedavalli Radhika wrote:
> I'm getting an unusual error in one of my codes. The below code
> snippet tries to evaluate the response of a xdmp:http-post() call and
> do some operations based on the outcome of the call.
>
> declare variable $uri as xs:string external;
> declare variable $locator-response as node() external;
>
> let $locator-response := $locator-response/child::*
>
> let $doc := fn:doc($uri)
> let $new-docid := fn:tokenize(fn:tokenize($uri,"/")[last()],"\.")[1]
> return if($locator-response[1]/*:code/text() = '200') then
>              if($locator-response[2]/*:status/*:code/text() = 'success') then
>                  let $selfids :=
> fn:data($locator-response[2]//*:locationid/*:linktemplate[@rel="self"]/@href)
>
>                  let $replace := for $id in $selfids
>                              let $destinationid :=
> fn:tokenize(fn:data($locator-response//*:locationid[*:linktemplate/@rel="self"
> and *:linktemplate/@href=$id]/*:linktemplate[@rel="destination"]/@href),
> "/")[fn:last()]
>                              let $locationid := fn:tokenize($id, 
> "/")[fn:last()]
>                              let $locationidelement :=
> $doc/*:workfolderitem/*:metadata/*:dataitemmetadata/*:annotationlist/*:annotation/*:id[.
> = $locationid]
>                              let $linktemplate :=
> $doc/*:workfolderitem/*:metadata/*:dataitemmetadata/*:annotationlist/*:annotation[*:id=
> $locationid]/*:linktemplate
>                              return(
>                              xdmp:node-replace($locationidelement,
> element *:id {$destinationid})
>                              ,
>                              xdmp:node-replace($linktemplate/@href,
> attribute href 
> {fn:concat("/shared/folder/",$new-docid,"/annotation/",$destinationid)})
>
>                  return xdmp:document-set-collections($uri, "online")
>              else
>                  xdmp:document-delete($uri)
>
>        else
>              xdmp:document-delete($uri)
>
> This code works fine in my machine which runs MarkLogic server version
> 4.2-3.2. When I'm trying to run the same code in another unix box
> running a server 4.1-5 I'm getting the following error:
>
> 2011-05-03 08:30:10.867 Notice: TaskServer: XDMP-UNEXPECTED:
> (err:XPST0003) Unexpected token syntax error, unexpected QName_
> 2011-05-03 08:30:10.867 Notice: TaskServer: in /copy-annotations.xqy,
> on line 23,
>
> The said line points to the line -  return(xdmp:node-replace. I'm
> unable to find any reason for this particular error. Please help me
> solve this problem.
>
> I even tried to move the code to a Marklogic server 4.1-5 on a windows
> box. I am not able to reproduce the issue.
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to