Custom xbl component dynamic data type

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

Custom xbl component dynamic data type

vbr
Hello, I wrote a simple XBL component that allows to retrieve different values by calling a web service.

Currently the type of my component is String. I wanted to know if is it possible to set the the type of the node dynamically? For example I received string and date data from my web service and I wanted to set dynamically the type of the node depending on the data retrieved.

Thank you for your help
Reply | Threaded
Open this post in threaded view
|

Re: Custom xbl component dynamic data type

Alessandro  Vernet
Administrator
Hi,

How are you setting the type of the node? If you're using, inside the model of your XBL control, an <xf:bind type="…"/>, then you can have the type change dynamically with something like:

<xf:bind ref="instance('my-instance')/root/value[@type = 'date']" type="xs:date"/>

I.e., the type will be set to date if the element also has an attribute type="date". But of course, in that test you could use any other value from that instance, or another instance, and support multiple types this way.

Is this something that could work in your scenario?

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

Re: Custom xbl component dynamic data type

vbr
Thank you for your help.

I finally managed it with this kind of binding :

               
                                <xf:bind id="wvn-profile-perso-bind-date" ref="xxf:binding('wvn-profile-perso-binding')[$dataTmp = 'birthdate']" type="xs:date"/>
                                <xf:bind id="wvn-profile-perso-bind-string" ref="xxf:binding('wvn-profile-perso-binding')[$dataTmp != 'birthdate']" type="xs:string"/>
                               
                               
                                <xf:bind id="wvn-profile-perso-bind-readonly" ref="xxf:binding('wvn-profile-perso-binding')[$dataTmp = 'firstname' or $dataTmp = 'lastname' or $dataTmp = 'niss']" readonly="1"/>
                                <xf:bind id="wvn-profile-perso-bind-editable" ref="xxf:binding('wvn-profile-perso-binding')[$dataTmp != 'firstname' and $dataTmp != 'lastname' and $dataTmp != 'niss']" readonly="0"/>
Reply | Threaded
Open this post in threaded view
|

Re: Custom xbl component dynamic data type

Alessandro  Vernet
Administrator
Great, I'm glad that worked, and thanks for the update.

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