0
votes

I started working with eXide for my job, and i have to say that the documentation is very poor... I couldn't find a solution to this problem:

err:XPTY0004 checking function parameter 1 in call file:move($position, $destination): XPTY0004: The actual cardinality for parameter 1 does not match the cardinality declared in the function's signature: file:move($original as item(), $destination as item()) xs:boolean. Expected cardinality: exactly one, got 0. [at line 8, column 24, source: xquery version "3.1"; import module namespace file = "http://exist-db.org/xquery/file"; let $log-in := xmldb:login('/db', 'admin', '') for $doc in collection('/db/lime-fao/[email protected]') let $position := document-uri($doc)[contains(., 'main.xml')] let $destination := replace($position, 'main.xml', 'main') return file:move($position,$destination)]

What am i doing wrong? Here's the query:

xquery version "3.1";
import module namespace file = "http://exist-db.org/xquery/file"; 

let $log-in := xmldb:login('/db', '*********', '*********')
for $doc in collection('/db/******/******@*****.****')
     let $position := document-uri($doc)[contains(., 'main.xml')]
     let $destination := replace($position, 'main.xml', 'main')
     return file:move($position,$destination)

Thank you.

1
You need to check what value is assigned to the $position variable. - Yitzhak Khabinsky

1 Answers

0
votes

You can try the following.

XQuery

...
let $position := base-uri($doc)[ends-with(., 'main.xml')]