Hi, Harald thanks for your help and for being so patient. I am just a beginner with XQuery.
I’ve tried the following query:
declare function local:filter ($in as node()) as node() {
if (starts-with(local-name($in),“D”) and not ($in[F=123 and /H=6 and //N=17])
or starts-with(local-name($in),“G”) and not ($in[H=6 and /N=17])
or starts-with(local-name($in),“J”) and not ($in[N=17])
) then ()
else
element {local-name($in)} {$in/@,
for $node in $in/ return if ($node/) then local:filter($node) else $node}
}
for $doc in input()/A
let $d:=$doc/[starts-with(local-name(.),“D”) and F=123 and */H=6 and //N=17]
where $d
return local:filter($doc)
Returned error :
<ino:messagetext ino:code=“INOXQE6352”>XQuery parsing error</ino:messagetext>
ino:messageline
Syntax Error at line 1, column 9: found “function” when expecting any of: “or”, “and”, “div”, “mod”, " *", “intersect”, “union”, “except”, “/”, “//”, “=”, “!=”, “<=”, “>=”, “eq”, “ne”, “gt”, “ge”, “lt”, “le”, "< ", “>”, “-”, “+”, “=>”, “|”, “(”, “[”, “,”, “sort”, “stable”
</ino:messageline>
</ino:message>
Seems to fail on method starts-with used in function local:filter.
I’ve executed the following xquery:
for $doc in input()/A
let $d:=$doc/*[starts-with(local-name(.),“D”) and F=123 and */H=6 and //N=17]
where $d
return $doc
And this worked fine. Any idea about this?
Thanks in advance