The second arg to save is a node, not a string. Try making $r into a text node:
xdmp:save('c:\export.csv', text{$r}, <options
xmlns="xdmp:save"><method>text</method></options>)
-Danny
From: [email protected]
[mailto:[email protected]] On Behalf Of Gary Larsen
Sent: Wednesday, April 24, 2013 10:52 AM
To: General MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] save text results to file
Hi, probably something simple again..
I'm using string-join() to apply a header to some results in csv format:
string-join(($hdr, $body), '')
Now I want to save the results to a file so tried this:
let $r := string-join(($hdr, $body), '')
return
xdmp:save('c:\export.csv', $r, <options
xmlns="xdmp:save"><method>text</method></options>)
but $r is not a node: XDMP-ARGTYPE: (err:XPTY0004) xdmp:save("c:\export.csv",
"Package	Report Location	Report Name	Report Desc	Repo...", <options
xmlns="xdmp:save"><method>text</method></options>) -- arg2 is not of type node()
xdmp:unquote() didn't work. Thanks in advance.
Gary
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general