Trying to do the following:
curl --anyauth --user id:pass -X PUT -d@"./createPDF.xqy" -H "Content-type: 
application/xquery" 'http://ilabsmltest:8011/v1/config/transforms/createPDF'

And getting the error:
<rapi:error xmlns:rapi="http://marklogic.com/rest-api";>
<rapi:status-code>500</rapi:status-code>
<rapi:status>INTERNAL ERROR</rapi:status>
<rapi:message-code/>
<rapi:message>500 Internal Server Error internal error</rapi:message>
</rapi:error>

The following works from QConsole:
xquery version "1.0-ml";
import module namespace jam = "http://xqdev.com/jam"; at "jam.xqy";
import module namespace jamu = "http://xqdev.com/jam-utils"; at "jam-utils.xqy";

let $xslfoDoc :=  [xsl-fo deleted]
return
(jam:start("http://ilabsmltest:8080/mljam/mljam";, "mljam", "secret"),
jamu:fop($xslfoDoc),
jam:end())

So, I'm trying to make a XQuery transformation module out of it :
xquery version "1.0-ml";

module namespace cpdf = "http://marklogic.com/rest-api/transform/createPDF";;

import module namespace jam = "http://xqdev.com/jam"; at "jam.xqy";
import module namespace jamu = "http://xqdev.com/jam-utils"; at "jam-utils.xqy";

declare function cpdf:transform(
  $context as map:map,
  $params as map:map,
  $content as document-node()
) as binary()
{
  if (fn:empty($content/*)) then $content
  else
(jam:start("http://ilabsmltest:8080/mljam/mljam";, "mljam", "secret"),
jamu:fop($content),
jam:end())
};


I'm assuming that there's just something wrong with the imports... and/or 
namespacing...
And not that I can't return a binary() instead of a document-node().


Thanks,
David

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to