How is the result of an XQuery prepended with an xml declaration, and a line linking it to an xslt?
error:
Stopped at /home/nicholas/git/xml/labs.xq, 8/6:
[XPST0003] Processing instruction has illegal name: xml.
query:
xquery version "3.1";
for $doc in db:open("covid")
return
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="labs.xsl"?>
$doc
so that the result is ready to be used with an xslt. Perhaps placing the declaration and "linking" line of xml outside of the query?
see also:
The XML declaration can only be output by a serialization option you can declare with e.g.
there is no XML declaration as a node in the XQuery data model.
A processing instruction is a node and can be constructed and prepended for instance with
or perhaps cleaner or more explicitly with