Orbeons XForms Conformity

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Orbeons XForms Conformity

BitByter
Hi folks,

I'd like to realise a dynamic questionary using XForms within a JSF
application. Thus I'm currently evaluating the different XForms
implementations that do not require any installations (plugins, extension,
etc.) on client side. Orbeon's OPS and FormFaces from Progeny Systems seem
to be the only solutions that meet this requirement.

Going  through  Orbeons  tutorial,  the "XForms Hello" sample application is
mentioned.  This sample seems to run perfectly with Orbeon's OPS:


<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xforms="http://www.w3.org/2002/xforms">
    <head>
        <title>XForms Hello</title>
        <xforms:model>
            <xforms:instance>
                <first-name xmlns=""/>
            </xforms:instance>
        </xforms:model>
    </head>
    <body>
        <p>
            <i>This example is described in details in the <a href="/doc/intro-tutorial">Orbeon Forms Tutorial</a>.</i>
        </p>
        <p>
            Please enter your first name:
            <xforms:input ref="/first-name" incremental="true"/>
        </p>
        <p>
            <xforms:output value="if (normalize-space(/first-name) = '') then '' else concat('Hello, ', /first-name, '!')"/>
        </p>
    </body>
</html>



But when I try to run this simple sample with FormFaces, it first complains
that the element <xforms:input> is missing the child element <xforms:label>,
which according to W3C (http://www.w3.org/MarkUp/Forms/2006/xforms-qr.html)
is mandatory.

After  fixing  this  error  by  addig  an  <xforms:label> element, FormFaces
complains about an invalid XPath expression:

@value attribute on <xforms:output/> element is not a valid XPath: if (normalize-space(/first-name) = '') then '' else concat('Hello, ', /first-name, '!').
Syntax error at character 40 't': if (normalize-space(/first-name) = '') then '' else concat('Hello, ', /first-name, '!')


As I'm currently not that familiar with XPath, thus I actually can't say
anything about it, nor fix it.

So currently I'm wondering how Orbeon's OPS is handling XForms? Aren't the
XForms instances validated against the XForms XML Schema? Does OPS support
some extension to XForms, which make the XForms applications incompatible
for other XForms engines like FormFaces?

And by the way: I'm interested in the experiences concerning the seperation
of concerns. To me, XForms seems to be a step back concerning the seperation
between  web design and web application development - compared with JSF. Are
there  any  "best  practices" on how to seperate web design from application
development?

Cheers,
bitbyter





--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Orbeons XForms Conformity

Erik Bruchez
Administrator
BitByter,

 > I'd like to realise a dynamic questionary using XForms within a JSF
 > application. Thus I'm currently evaluating the different XForms
 > implementations that do not require any installations (plugins,
 > extension, etc.) on client side. Orbeon's OPS and FormFaces from
 > Progeny Systems seem to be the only solutions that meet this
 > requirement.

 > But when I try to run this simple sample with FormFaces, it first
complains
 > that the element <xforms:input> is missing the child element
<xforms:label>,
 > which according to W3C
(http://www.w3.org/MarkUp/Forms/2006/xforms-qr.html)
 > is mandatory.

That's right! This example is incorrect, and I wonder how this slipped
through the cracks (especially in a tutorial...)! I fixed this in our
CVS.

But you are right to notice that Orbeon Forms did not complain about
the missing label, when it should have. I entered a bug to track this:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=306854&group_id=168&atid=350207

 > After fixing this error by addig an <xforms:label> element,
 > FormFaces complains about an invalid XPath expression:
 >
 > @value attribute on <xforms:output/> element is not a valid XPath: if
(normalize-space(/first-name) = '') then '' else concat('Hello, ',
/first-name, '!').
 > Syntax error at character 40 't': if (normalize-space(/first-name) =
'') then '' else concat('Hello, ', /first-name, '!')
 >
 > As I'm currently not that familiar with XPath, thus I actually can't
 > say anything about it, nor fix it.

Orbeon Forms uses XPath 2.0 instead of XPath 1.0. You just hit the
main incompatibility introduced with the use of XPath 2.0: the fact
that 2.0 provides a built-in if() construct, while XForms 1.0
introduced an if() function. The two are not compatible, hence your
error. The workaround is to either change the expression to the
following in FormFaces:

   if (normalize-space(/first-name) = '', '', concat('Hello, ',
/first-name, '!'))

or to use our extension function, xxforms:if, in Orbeon Forms:

   xxforms:if (normalize-space(/first-name) = '', '', concat('Hello, ',
/first-name, '!'))

I have added a FAQ entry on this topic. I will be online soon here:

   http://www.orbeon.com/ops/doc/home-faq#xforms-xpath20

 > So currently I'm wondering how Orbeon's OPS is handling XForms?

Orbeon Forms supports most of XForms 1.0, and quite a bit of XForms
1.1 already. We have been planning to complete our compatibility
matrix for Orbeon Forms 3.5, but we haven't done so yet. This is the
place where the information will be once it is completed:

   http://www.orbeon.com/ops/doc/reference-xforms-compliance

 > Aren't the XForms instances validated against the XForms XML Schema?

XForms pages are not validated through the XForms schema. It would be
a good option to have, although you can always validate your page with
an external validator.

 > Does OPS support some extension to XForms, which make the XForms
 > applications incompatible for other XForms engines like FormFaces?

Yes, Orbeon Form supports lots of extensions, some of which are
described in the documentation here:

   http://www.orbeon.com/ops/doc/reference-xforms-ng#extensions

While these extensions were introduced for a reason, you don't have to
use them though. The main incompatiblities, I think, will relate to:

* The use of extensions, including XPath 2.0.

* The different use of if() in XPath expressions.

* Use of XForms 1.1 features that are not yet supported in other
   implementations.

* CSS styling.

As far as features from XForms 1.0 and 1.1 that we don't yet
implement, we want to hear from you if you hit some, as we aim for
XForms 1.1 compliance.

 > And by the way: I'm interested in the experiences concerning the
 > seperation of concerns. To me, XForms seems to be a step back
 > concerning the seperation between web design and web application
 > development - compared with JSF. Are there any "best practices" on
 > how to seperate web design from application development?

A couple of things that come to mind:

* XForms itself follows an MVC approach: it clearly separates controls
   from models.

* XForms allows easily talking to external services through the use of
   XForms submissions, especially with XForms 1.1 which has full
   support for REST. This allows you to nicely separate your user
   interface logic (in an XForms page) from other services.

I hope this helps,

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws