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">
<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 <[email protected]>
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 <
> [email protected]> 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 <[email protected]>
> 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
> >> >
>