Both following queries run fine on eXist-db but produce the following errors on MarkLogic server. Any help appreciated.
Query:
for $cust in //Customer[@id=1011] 
for $ord in //Order[@Acct = $cust//Accounts//Account/@id/fn:string(.)]
return $ord/OrdQty/@Cash 
return max($orderprice)
Error:
[1.0-ml] XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected Return_, expecting $end or SemiColon_ Stack Trace
At line 10 column 0: In xdmp:eval("xquery version "1.0-ml"; declare namespace html = ...", (), 13899855847338100900different-tr...) 8. 9. return $ord/OrdQty/@Cash 10. return max($orderprice)
Query:
for $cust in //Customer
return <Customer> 
{$cust/@id}
{$cust/Name} 
<Customer_Securities>
{for $account in $cust/Accounts/Account
return <Account BALANCE="{$account/Balance/OnlineActualBal}"
ACCOUNT_ID="{$account/@id}">
<Securities> 
{$account/Holdings/Position/Name} 
</Securities> 
 </Account>  } 
</Customer_Securities> 
</Customer> 
Error:
[1.0-ml] XDMP-EXPNTREECACHEFULL: for $cust in fn:collection()/descendant::Customer return { $cust/@id }{ $cust/Name }{ for $account in $cust/Accounts/Account return { $account/Holdings/Position/Name } } -- Expanded tree cache full on host gkomninos-pc.studentcom.co.uk Stack Trace
At line 3 column 0: In xdmp:eval("xquery version "1.0-ml"; declare namespace html = ...", (), 13899855847338100900different-tr...) 1. xquery version "1.0-ml"; 2. declare namespace html = "http://www.w3.org/1999/xhtml"; 3. for $cust in //Customer 4. 5. return
 
    