I am relatively new to XQuery. However, I have done a decent amount of research on my issue and do not understand what I am doing wrong. Here is my code:
(: XQuery main module :)
xquery version "3.0" encoding "utf-8";
import schema namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
import module namespace http = "http://expath.org/ns/http-client";
import module namespace rand = "http://www.zorba-xquery.com/modules/random";
declare variable $URL as xs:string := ();
declare variable $AF_Tok as xs:integer := rand:seeded-random-between(23 (:This is the seed, needs to be randomized too, will fix later.:),
0 (:This is the lower bound for every number in the sequence.:),
9 (:This is the higher bound for every number in the sequence.:),
32 (:This is the number of random numbers in the returned sequence:)
);
declare variable $Client_ID as xs:string := ("XXXXX");
declare variable $Client_Secret as xs:string := ("XXXXX");
<test>
<random_number>{$AF_Tok}</random_number>
</test>
I get the same error in both eXist and Sausalito Tools for Eclipse. Could anyone test this out and let me know if you also get the error? I'm stumped, any help would be appreciated.
:6,1: static error [err:XQST0059]: "http://www.zorba-xquery.com/modules/random": target namespace not found for schema/module http://www.zorba-xquery.com/modules/random
I thought that it could be a zorba issue but I get the same errors for the w3 and expath namespaces as well.
UPDATE: I'm using Mac OS X 10.8 btw
You can not simply use a Zorba module with eXist. I also don't think that the HTTP client EXPath module is supported by eXist. Take a look at the documentation of your processor (eXist or Sausalito) and only use the modules they support. If they are built-in, a simple import module namespace
as you used it should be sufficient, however, if you want to include a generic module you also have to provide the module sources at some processor-dependent directory.
For eXist, take a look at http://exist-db.org/exist/apps/doc/extensions.xml to understand how you can include your modules. eXist also has random functions, but they are built in the math module.