Hi Alain,

Le lundi 20 mai 2013 à 23:11 +0200, Alain Couthures a écrit :
> Hello Eric,
> 
> > I am testing the subforms feature and I have a couple of questions.
> >
> > 1) I'd like to include the same subform twice in form (to handle two
> > different instance nodes) and that doesn't seem to be working (the
> > second subform isn't displayed). Is that a known limitation or have I
> > missed something?
> This is possible with XSLTForms only when there is no id conflict which 
> means no id in the subform. There is an example of this at 
> http://www.agencexml.com/xsltforms/books.xml for 
> http://www.agencexml.com/xsltforms/writers.xml.

Yes, I had seen this example but I had thought that the reason why we
had no conflict was because the form was called multiple times but from
within a repeat! 

> > 2) My subform has a local instance and I need to move data between the
> > current node in the main form and the subform local instance. The
> > context node appears to be available in the XForms controls (I can write
> > <xf:output ref="."/> and the current node in the main form is displayed)
> > but I don't know how to access this node in actions in the subform. Is
> > there a function I can use for that?
> >
> >
> I have to modify XSLTForms so that a local instance without an id will 
> be distinct for each subform. One extra function to access this instance 
> is to be added and probably another one to allow access to the current 
> context in bindings.
> 
> Instead of having to launch a load action for each subform, it would be 
> more convenient to add another control type, such as xf:component with a 
> @ref attribute and a @resource attribute.
> 
> This does not seem difficult to do so I will tell you more soon!
> 
> What do you think?

For this use case we need:

      * A way to access the context node to which the "component" is
        bound in the caller form. An extension function would be fine
        for that.
      * A way to define and access a local instance "private" to the
        component. In this specific case the component needs only one
        instance but I am sure we can find more complex cases where
        several instances would be more convenient in which case
        anonymous instances wouldn't work.
      * We also need to receive events such as xforms-ready in the
        component.

In don't know if you're familiar with Orbeon's XBL implementation [1]
but this component would be defined as:

[1]
http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components-guide

<xbl:xbl script-type="application/xhtml+xml">
   <xbl:binding id="my-dimension" element="my|dimension" xxbl:mode="lhha
binding value">
      <xbl:handlers>
         <xbl:handler event="xforms-enabled xforms-value-changed">
            <xf:setvalue ref="instance('my-dimension-instance')/value"
value="translate(xxf:binding('my-dimension'), '%incmptxe', '')"/>
            <xf:setvalue ref="instance('my-dimension-instance')/unit"
value="translate(xxf:binding('my-dimension'), '0123456789', '')"/>
         </xbl:handler>
      </xbl:handlers>
      <xbl:implementation>
         <xf:model id="my-dimension-model">
            <xf:instance id="my-dimension-instance">
               <dimension>
                  <value/>
                  <unit/>
               </dimension>
            </xf:instance>
            <xf:setvalue ev:event="xforms-value-changed"
ev:observer="my-dimension-value-control"
ref="xxf:binding('my-dimension')"
value="concat(instance('my-dimension-instance')/value,
instance('my-dimension-instance')/unit)"/>
            <xf:setvalue ev:event="xforms-value-changed"
ev:observer="my-dimension-unit-control"
ref="xxf:binding('my-dimension')"
value="concat(instance('my-dimension-instance')/value,
instance('my-dimension-instance')/unit)"/>
         </xf:model>
      </xbl:implementation>
      <xbl:template>
         <xf:input ref="value" id="my-dimension-value-control"/>
         <xf:select1 ref="unit" id="my-dimension-unit-control">
            <xf:label/>
            <xf:item>
               <xf:label>pixels</xf:label>
               <xf:value>px</xf:value>
            </xf:item>
            .../...
         </xf:select1>
      </xbl:template>
   </xbl:binding>
</xbl:xbl>

I won't go into the details, but see how:

      * The bound node in the caller form instance is accessed through
        "xxf:binding('my-dimension')" (where "my-dimension" is the
        component's id)
      * Local (private) instances can have ids and are accessed through
        the standard instance() function
        ("instance('my-dimension-instance')" in our case)
      * A handler section is used to define event handlers for events
        coming "from the external".

Thanks,

Eric

> -Alain
> 



------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support

Reply via email to