Hi Kristian,
I send you the complete RESTXQ code. I use the latest XSLTForms code from here: http://sourceforge.net/projects/xsltforms/files/xsltforms/1.0RC2/xsltforms-1...
Thanks. As the xsltforms.xsl script returns the result as html...
Line 33: <xsl:output method="html" ...
...the result cannot be converted back to XML by the xslt:transform function. Instead, you'll have to use xslt:transform-text [1].
It could be tricky to return that string result as XML or HTML. But maybe – I haven't tried – it work if you only specify the media type, and omit the output method (or use "text"):
%output:media-type("text/html")
Hope this helps, Christian
[1] http://docs.basex.org/wiki/XSLT_Module#xslt:transform-text
(: CODE BEGIN :) xquery version "3.0" encoding "UTF-8"; module namespace hans = "http://some.hans.here/"; declare namespace vka = "http://some.vka.here/"; declare default element namespace "http://some.vka.here/";
import module namespace rest = "http://exquery.org/ns/restxq"; import module namespace request = "http://exquery.org/ns/request";
(: Trying server-side XSLTforms transformation :) declare %rest:path("hans/xforms") %rest:GET %output:method("html") function hans:xforms() {
let $page := <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms">
<head> <title>Hello World in XForms</title> <xf:model> <xf:instance> <data xmlns=""> <PersonGivenName/> </data> </xf:instance> </xf:model> </head> <body> <p>Type your first name in the input box. <br/> If you are running XForms, the output should be displayed in the output area.</p> <xf:input ref="PersonGivenName" incremental="true"> <xf:label>Please enter your first name: </xf:label> </xf:input> <br /> <xf:output value="concat('Hello ', PersonGivenName, '. We hope you like XForms!')"> <xf:label>Output: </xf:label> </xf:output> </body> </html>
return xslt:transform($page, 'static/xsltforms/xsltforms/xsltforms.xsl')
};
(: CODE END :)
Thank *you* in advance! Kristian
04.03.2015 20:38, Christian Grün kirjutas:
Hi Kristian,
could you please provide us with some self-contained example code?
Thanks in advance, Christian
On Tue, Mar 3, 2015 at 11:44 AM, Kristian Kankainen kristian@keeleleek.ee wrote:
Hello!
I try to transform XForms with XSLTforms with the xslt module in BaseX but fail. I use the examples given by XSLTForms which work in the browser.
My xslt:processor() gives 'Java' and xslt:version() gives '1.0'.
The error message I get is:
type Status report
message Stopped at /usr/share/tomcat/webapps/BaseX80-20150207.113013/hans.xq, 242/23: [bxerr:BXSL0001] ERROR: 'Could not compile stylesheet' FATAL ERROR: 'Error checking type of the expression 'FilterParentPath(variable-ref(profiler0/result-tree), step("child", 1))'.' :Error checking type of the expression 'FilterParentPath(variable-ref(profiler0/result-tree), step("child", 1))'. Stack Trace: - /usr/share/tomcat/webapps/BaseX80-20150207.113013/hans.xq, 165/10
description The request sent by the client was syntactically incorrect.
My XQuery looks like this: declare %rest:path("hans/xforms") %rest:GET %output:method("text") function hans:xforms() {
let $page := <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"
<head> <title>Many to one</title> <xf:model> ... snip ... </html>
return xslt:transform($page, 'static/xsltforms/xsltforms/xsltforms.xsl') };
The only difference between the input given in the function and the one given at http://www.agencexml.com/xsltforms/incremental.xml is the removal of two processing instruments:
<?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?>
<?xsltforms-options debug="yes"?>
What could be the source of this error? How should I continue debugging this?
Best wishes Kristian Kankainen