write result to file?

Tuesday, 15 December 2020 · 6 messages · last reply 16 Dec 2020
CG
Christian Grünin reply to Nicholas, 15 Dec 2020, 19:1515 Dec 2020 18:17 #
There are numerous ways to do so. Did you already check our documentation ( docs.basex.org)?
Quoted text · Nicholas · 10 lines
Nicholas <saunders.nicholas at gmail.com> schrieb am Di., 15. Dez. 2020, 18:15: > how is the return result from a query written to a file? > > > thanks, > > > Nick > >
N
Nicholas15 Dec 2020 19:15 #
how is the return result from a query written to a file? thanks, Nick
N
Nicholas15 Dec 2020 19:17 #
ah, I see, it's using expath?
|file:write|($file as|xs:string|,
            $items as|item()*|) as|empty-sequence()|
|file:write|($file as|xs:string|,
            $items as|item()*|,
            $params as|element(output:serialization-parameters)|) as|empty-sequence() something like that? |
Quoted text · Nicholas · 9 lines
On 12/15/20 9:15 AM, Nicholas wrote: > how is the return result from a query written to a file? > > > thanks, > > > Nick >
N
Nicholasin reply to Nicholas, 15 Dec 2020, 19:1515 Dec 2020 19:19 #
pardon, forgot to include: https://tech.forums.softwareag.com/t/writing-to-file-using-xquery/67224 where michael kay says that's just not going to work. similarly, I'd want to feed the result into an xslt.
Quoted text · Nicholas · 9 lines
On 12/15/20 9:15 AM, Nicholas wrote: > how is the return result from a query written to a file? > > > thanks, > > > Nick >
LQ
Liam R. E. Quin15 Dec 2020 21:38 #
Quoted text · Nicholas · 7 lines
On Tue, 2020-12-15 at 09:19 -0800, Nicholas wrote: > pardon, forgot to include: > > https://tech.forums.softwareag.com/t/writing-to-file-using-xquery/67224 > > > where michael kay says that's just not going to work.
That's not exactly what he says - Mike words himself very carefully most of the time. If you want to run XSLT on the result of a query you can use fn:transform() to do that from within XQuery, and you can write the result with file:write(), yes. Using xsl:resut-document from XSLT won't write anything out in that situation but will put the results into a map that your XQuery expression can save to a file. You could also use an XProc pipeline, of course. But it depends on your situation and needs. Liam
-- Liam Quin, https://www.delightfulcomputing.com/ Available for XML/Document/Information Architecture/XSLT/ XSL/XQuery/Web/Text Processing/A11Y training, work & consulting. Barefoot Web-slave, antique illustrations: http://www.fromoldbooks.org
N
Nicholas16 Dec 2020 15:25 #
Quoted text · Nicholas · 22 lines
On 12/15/20 11:38 AM, Liam R. E. Quin wrote: > On Tue, 2020-12-15 at 09:19 -0800, Nicholas wrote: >> pardon, forgot to include: >> >> https://tech.forums.softwareag.com/t/writing-to-file-using-xquery/67224 >> >> >> where michael kay says that's just not going to work. > That's not exactly what he says - Mike words himself very carefully > most of the time. > > If you want to run XSLT on the result of a query you can use > fn:transform() to do that from within XQuery, and you can write the > result with file:write(), yes. Using xsl:resut-document from XSLT won't > write anything out in that situation but will put the results into a > map that your XQuery expression can save to a file. > > You could also use an XProc pipeline, of course. But it depends on your > situation and needs. > > Liam >
Fair enough, that was at least my takeaway. For the post-processing he mentions, this might be with xsl:result-document as suggested? thanks, Nick

⚡Generated with XQuery