Thanks for your quick response, Christian. I'm running BaseX 9.2.4. 

I'm getting the comments in the browser (web console). When I dereference the endpoint with curl, the processing instructions are correct.

In the browser, the XForms instructions are not being processed. I don't think XSLTForms would be the culprit, because the stylesheet is not being called.

--
Tim A. Thompson
Discovery Metadata Librarian
Yale University Library

On Thu, Aug 22, 2019 at 10:37 AM Christian Grün <christian.gruen@gmail.com> wrote:
Hi Tim,

I have just tested your endpoint code (with the latest version of
BaseX), and I receive processing instructions as expected:

<?xml-stylesheet type="text/xsl"
href="static/xphoneforms/build/xsl/xsltforms.xsl"?>
...

Which version of BaseX are you using? Are you also getting comments in
your response when calling the function from the browser or via other
tools (such as curl), and could it have to do with the way how
XSLTForms processes the result?

Best,
Christian


On Thu, Aug 22, 2019 at 4:31 PM Tim Thompson <timathom@gmail.com> wrote:
>
> Hello,
>
> I'm trying to output an XForms (XSLTForms) document from a RESTXQ endpoint, but the necessary processing instructions are being serialized in XML comments in the output, e.g.:
>
> <!--?xml-stylesheet type="text/xsl" href="static/xphoneforms/build/xsl/xsltforms.xsl"?-->
>
>  Am I missing something?
>
> XQuery:
>
> xquery version "3.1";
>
> module namespace test = "test";
>
> declare
>   %rest:path("/test")
>   %rest:GET
>   %output:method("xhtml")
> function test:home() as document-node() {
>
>   document {
>     processing-instruction { "xml-stylesheet" } {
>         'type="text/xsl" href="static/xphoneforms/build/xsl/xsltforms.xsl"'
>     },
>     processing-instruction { "xsltforms-options" } { 'debug="no"' },
>     processing-instruction { "css-conversion" } { 'no' }
>     ,
>     <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms"
>           xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:my="test"
>           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>
>       <head>
>         <title>Test</title>
>       </head>
>       <body>
>         <h1>Placeholder</h1>
>       </body>
>     </html>
>   }
> };
>
>
> --
> Tim A. Thompson
> Discovery Metadata Librarian
> Yale University Library
>