XSLT transformations in BaseX with XSLTforms fails

Tuesday, 3 March 2015 · 5 messages · last reply 5 Mar 2015
KK
Kristian Kankainen3 Mar 2015 11:44 #
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"
Quoted text · 1 line
>
   <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
CG
Christian Grün4 Mar 2015 19:38 #
Hi Kristian, could you please provide us with some self-contained example code? Thanks in advance, Christian
Quoted text · Kristian Kankainen · 60 lines
On Tue, Mar 3, 2015 at 11:44 AM, Kristian Kankainen <kristian at 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
KK
Kristian Kankainen5 Mar 2015 10:07 #
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.0RC2.zip/download
(: 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:
Quoted text · Christian Grün · 69 lines
> 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 at 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
CG
Christian Grün5 Mar 2015 14:11 #
Hi Kristian,
Quoted text · Kristian Kankainen · 3 lines
> 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.0RC2.zip/download
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
Quoted text · Kristian Kankainen · 131 lines
> > (: 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 at 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 > >
CG
Christian Grün5 Mar 2015 14:23 #
A little update: I just noticed that I used Saxon for transforming the stylesheet. Without Saxon, I get the same error as you get, so I assume the stylesheet cannot be compiled with Java's XSLT implementation. Maybe you can direct this question to the xsltforms mailing list and see how Alain comments on the error message?
Quoted text · Christian Grün · 159 lines
On Thu, Mar 5, 2015 at 2:11 PM, Christian Grün <christian.gruen at gmail.com> wrote: > 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.0RC2.zip/download > > 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 at 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 >> >>

⚡Generated with XQuery