Thanks Mark,

yes, in the meantime I was able to progress a little bit.  Now I have
my two modules, one with the for clause which is supposed to spawn the
other module.  This seems to work as far as the spawning is concerned,
however, the spawned module now throws this error message

"Invalid options node"

for each time it is spawned.  Here are the two modules for your kind
consideration:

----- module 1 ------
xquery version "1.0-ml";
declare namespace xh = "http://www.w3.org/1999/xhtml";;
declare variable $doi-dir := "/data/2009/07/05/";

(: cycle over all DOI values using cts:element-values() and xdmp:spawn
a "thread" for each :)
for $doi in cts:element-values(xs:QName("DOI"))
    return
    <div>
    {
        try {
            xdmp:spawn(
                "/app/backend/query-doi.xqy",
                (xs:QName("doi"), $doi, xs:QName("dir"), $dir),
                <b>tested {$doi} ...</b>
            )
        } catch( $e) {
             <span>
              Problem while checking {$doi}:
              <i
xmlns:e="http://marklogic.com/xdmp/error";>{$e/e:message/text()}</i>
            </span>
        }
    }
    </div>

----- module 2 ------
declare variable $doi as xs:string external;
declare variable $dir as xs:string external;
(: declare variable $doi := "abc"; :)
(: declare variable $dir := "/data/2009/07/05/"; :)

declare variable $doi-prefix := "10.1787";
declare variable $open-url :=
"http://www.crossref.org/openurl/?pid=YY:XX&amp;noredirect=true";;
declare variable $doi-url := fn:concat($open-url, "&amp;id=doi:",
$doi-prefix, "/", $doi);
declare variable $uri := fn:concat($dir, $doi, ".xml");

xdmp:document-load(
  $doi-url,
  <options xmlns="xdmp:document-load">
    <uri>{$uri}</uri>
  </options>
)

The weird thing is that this works when module 2 is run on its own,
but not when it's spawned from module 1.  In the latter case I always
get the above error message.  It's starting to drive me insane ...

Thanks anyway for your help!


Jakob.



On Mon, Jul 6, 2009 at 21:04, Mark
Helmstetter<mark.helmstet...@marklogic.com> wrote:
> Jakob,
>
> Looking at your code snippet, assuming that's the whole query, it looks like 
> you're missing the return clause:
>
> let $all-dois := cts:element-values(xs:QName("DOI"))
> return $all-dois
>
>
> --Mark
>
_______________________________________________
General mailing list
General@developer.marklogic.com
http://xqzone.com/mailman/listinfo/general

Reply via email to