Reputation: 873
I'm trying to create a custom component that when instantiated in form builder it would have in fr-form-instance a node containing child nodes and not only a single node as shown in the tutorial: http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components-guide#TOC-Event-handling.
For example if I instantiate the tutorial input component in form-builder :
.....
<fb:metadata>
<fb:display-name lang="en">Custom Component</fb:display-name>
<fb:datatype>xforms:string</fb:datatype>
<fb:template>
<cc:test ref=""/>
</fb:template>
</fb:metadata>
<xbl:binding element="fr|tutorial-input" id="fr-tutorial-input">
<xbl:template>
<xforms:group xbl:attr="model context ref bind" xxbl:scope="outer">
<xbl:content includes="xforms|label,xforms|help,xforms|hint,xforms|alert"/>
<xforms:group xxbl:scope="inner">
<xxforms:variable name="binding" as="node()?">
<xxforms:sequence select="." xxbl:scope="outer"/>
</xxforms:variable>
<xforms:input ref="$binding"/>
</xforms:group>
</xforms:group>
</xbl:template>
</xbl:binding>
.....
Form builder will only have one node in fr-form-instance:
.....
<xforms:instance id="fr-form-instance">
<form>
<section>
<contorl-x/> //only one node
.....
What I would like to do is have:
.....
<xforms:instance id="fr-form-instance">
<form>
<section>
<contorl-x>// x child nodes
<contorl-x-child-one>
<contorl-x-child-two>
.....
</contorl-x>
.....
Is it possible to do this? Are there in other components/examples that behave similar to this?
Upvotes: 0
Views: 905
Reputation: 7857
Section templates do something similar:
You can see how this is done in form-to-xbl.xsl
.
Similarly, here is a prototype for an XBL component creating an element if missing.
Now the devil is in the details. You have to determine in particular:
Also, one thing to keep in mind is that the XBL component itself cannot, at this time, validate nested elements. Only the top-level elements, with binds generated by Form Builder, can validate the data.
Section templates work around this by validating a sub-instance within the XBL component itself.
Upvotes: 1