1
votes

I get this error from Saxon,

Engine name: Saxon-PE XQuery 9.2.1.2 Severity: fatal Description: XQuery syntax error in #... (:return :) let $#: expected "return", found "let" Start location: 776:0

on this function

declare function local:set-internet-type($req1 as element(ns0:req), $cate as element()) as xs:string {
  if(count(   for $itm in $req/*:cust/*:inter/*:itm
      where $789/*:product/*:030/*:specs/*:name/text()= data($11/INTERNET)
      and $22/*:action/text()="CHANGE"
      return $33)>0) then
  (
  for $44 in $55
      where $tt/*:name/text()= data($t/INTERNET)
   and $u/*:action/text()="CHANGE"
   (:return <fake/>:)

    let $z:= $a/*:product/*:c/*:e[1]

        return concat($x,'>',$y)
  ) else ("")
};

I am new with xquery and I spent a lot on this error without getting a solution. Vars were masked intentionally but from the error message seems something related to the function flow.

Any help is appreciated.

Thanks in advance Alessandro

1

1 Answers

1
votes

Saxon only declares to have "partial support of XQuery 1.1". Therefore, I guess, it supports the old FLWOR format in which you cannot use let after where. Just try to swap these clauses:

for $44 in $55
let $z:= $a/*:product/*:c/*:e[1]
where $tt/*:name/text()= data($t/INTERNET)
   and $u/*:action/text()="CHANGE"
return concat($x,'>',$y)