Hi Tim - A quick test and this is working correctly(?) for me; 1. I cloned Alain's repo to `.../webapp/static/` 2. I copy-pasta'd your example into `.../webapp/test.xqm` 3. After starting the BaseX HTTP server, I hit `localhost:8984` and `localhost:8984/test` and had good responses from both; i.e. at `/test`, I'm seeing a "Test", a "Placeholder", and a fun little gray-ish ball (but no "3" in either browser).
This was with Firefox 60.8.0esr and Chromium 76.0.3809.87.
Is there anything specific I can try to tell you? I'm not very familiar with XSLTforms. Best, Bridger
On Thu, Aug 22, 2019 at 11:16 AM Christian Grün christian.gruen@gmail.com wrote:
I can’t promise if I can further dive into this. Maybe Alain has some hints?
On Thu, Aug 22, 2019 at 5:09 PM Tim Thompson timathom@gmail.com wrote:
Okay, so the response panel shows the correct output, but for some
reason the stylesheet is not being called. If it's not too much trouble, would you be able to try this with XSLTForms ( https://github.com/AlainCouthures/xphoneforms.git) placed in the BaseX webapp static dir?
Here is an expanded demo query:
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:xf="
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%22%3E
<head> <title>TALLER BIBFRAME</title> <model xmlns="http://www.w3.org/2002/xforms" id="main"> <instance id="init"> <data xmlns=""> <test>Test</test> </data> </instance> </model> </head> <body> <h1>Placeholder</h1> <img src="/static/xphoneforms/build/img/ball.png"/> <h2> <xf:output value="1 + 2"/> </h2> </body> </html>
}
};
-- Tim A. Thompson Discovery Metadata Librarian Yale University Library
On Thu, Aug 22, 2019 at 10:57 AM Christian Grün <
christian.gruen@gmail.com> wrote:
Hm… You could check the Response panel in the Network View of your browser. The latest version of Chrome, Firefox, Opera, Edge and IE should give you the correct result (those are the ones that I have tried).
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%22%3E
<head> <title>Test</title> </head> <body> <h1>Placeholder</h1> </body> </html>
} };
-- Tim A. Thompson Discovery Metadata Librarian Yale University Library