How to pass an xpath into an xquery function declaration

Posted by topmulch on Stack Overflow See other posts from Stack Overflow or by topmulch
Published on 2010-05-18T14:35:53Z Indexed on 2010/05/18 14:40 UTC
Read the original article Hit count: 265

Filed under:
|
|
|

Hi all, I use Apache Tomcat's Exist DB as an XML database and am trying to construct a sequence by passing the following xpath, defined in FLWOR's 'let' clause:

$xpath := $root/second/third

into a locally defined function declaration, like so:

declare function local:someFunction($uuid as xs:string?, $xpath as xs:anyAtomicType?)
{
  let $varOne := $xpath/fourth[@uuid = $uuid]/fifthRight
  let $varTwo := $xpath/fourth[@uuid = $uuid]/fifthLeft
  let $combined := ($varOne,$varTwo)
  return $combined
};

Of course, when entering this in the exist xquery sandbox, I get Type: xs:anyAtomicType is not defined. What should I use in place of it, or should I do this a different way?

Thanks in advance for any suggestions.

© Stack Overflow or respective owner

Related posts about Xml

Related posts about exist