XInclude the binds in XForms?

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

XInclude the binds in XForms?

Vedha
This post was updated on .
We are able to get the XInclude working in samples. But, still XInclude of <bind> statements inside XForms is nor working.

<xhtml>
<head>
<model>
<instance>
</instance>

I need to XInclude <bind> from multiple files

</model>
</head>
<body>
<UI code>
</body>
</xhtml>

XInclude works fine when i link UI section from external file. But linking bind (validations) is not working.

Any thoughts about this?
Reply | Threaded
Open this post in threaded view
|

Re: XInclude the binds in XForms?

Alessandro  Vernet
Administrator
Hi Vedha,

You should be able to "xinclude" <xf:bind> elements, just like other elements. Keep in mind that you need a single root element in the document you're xincluding, and that all namespaces you sue there need to be declared in that document as well, including those used in XPath expressions. If your case matches those constraints and things still aren't working for you, could you create and share with us a small example we can run to reproduce the problem?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: XInclude the binds in XForms?

Vedha
Below is the example,

I have just replace the content of

orbeon\WebContent\WEB-INF\resources\apps\xforms-espresso\espresso-order.xhtml file with,

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ev="http://www.w3.org/2001/xml-events" 
      xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:xxi="http://orbeon.org/oxf/xml/xinclude">
  <head>
   
    <style type="text/css"> h1 {font-size: 12pt } xf|input.itemClass { width:100px } xf|input.custNumClass { width:100px } xf|input.dateClass { width:80px } </style>    <title>Enter Order(s)</title>

    <xf:model id="model1">

      <xf:instance id="mdl">
        <orders xmlns="">
          <order itemNum="">
            <quantity>1</quantity>
            <custNum/>
            <orderDate/>
          </order>
        </orders>
      </xf:instance>
     
      <xi:include href="oxf:/sample.xml"/>
     
    </xf:model>
  </head>

  <body>

   

Enter Order(s)


    <p>Enter data for orders below.</p>

    <xf:group>

      <xf:input ref="instance('mdl')/order/quantity">
        <xf:label>Quantity</xf:label>
        <xf:alert>This should be one</xf:alert>
      </xf:input>

    </xf:group>

    <p>Click "Save" to store entered orders.</p>

  </body>
</html>


And i have placed the sample.xml under resources folder "orbeon\WebContent\WEB-INF\resources"


<root xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ev="http://www.w3.org/2001/xml-events" 
      xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:xxi="http://orbeon.org/oxf/xml/xinclude">
<xf:bind ref="instance('mdl')/order/quantity" constraint="number(.) eq 1"></xf:bind>
</root>


Note: The same setup works, if i just have the UI code inside the sample.xml and XInclude it.
Reply | Threaded
Open this post in threaded view
|

Re: XInclude the binds in XForms?

Alessandro  Vernet
Administrator
Hi Vedha,

Got it, and thank you for the example. In the included file, replace <root> by <xf:bind>, and things will work out. Otherwise the XForms engine finds a <root> element inside <xf:model>, and since it doesn't know about it just ignores it. You'll let me know if this works for you,

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: XInclude the binds in XForms?

Vedha
This post was updated on .
It is working great. Super Helpful. Cheers.
Reply | Threaded
Open this post in threaded view
|

Re: XInclude the binds in XForms?

Alessandro  Vernet
Administrator
Hi Vedha, I'm glad this worked, and thanks for the update.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet