Re: Re: Re: Custom XBL component

Posted by marek2608 on
URL: https://discuss.orbeon.com/Custom-XBL-component-tp4196663p4197119.html

Almost there I guess...
yes I amble to refer to $form-resources variable... from there I should be able to reach my control's label value.

My XBL that seems to work is:

<xbl:xbl xmlns:xhtml="http://www.w3.org/1999/xhtml"
         xmlns:xforms="http://www.w3.org/2002/xforms"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:ev="http://www.w3.org/2001/xml-events"
         xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
         xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
         xmlns:xbl="http://www.w3.org/ns/xbl"
         xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
         xmlns:oxf="http://www.orbeon.com/oxf/processors"
         xmlns:exf="http://www.exforms.org/exf/1-0" >
         

    <xbl:binding element="fr|hyperlink">
        <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 appearance="xxforms:internal" xxbl:scope="inner"> 
                     <xxforms:variable name="binding"> 
                         <xxforms:sequence select="." xxbl:scope="outer" /> 
                     </xxforms:variable> 
                     <xxforms:variable name="form-resources"> 
                         <xxforms:sequence select="$form-resources" xxbl:scope="outer" /> 
      </xxforms:variable> 

                        <xforms:trigger ref="$binding" appearance="minimal" >
                            <xforms:label ref="$form-resources/control-1/label"/>
                            <xforms:action ev:event="DOMActivate">
                                <xforms:load ref="$form-resources/control-1/label" show="new"/>
                            </xforms:action>
                        </xforms:trigger>
            </xforms:group>
          </xforms:group>
        </xbl:template>
    </xbl:binding>
</xbl:xbl>

But it's not fullly dynamic.
Now, my question is concerning the ref: $form-resources/control-1/label

How can I dynamically retrieve the "control-1" name... the control name is provided by the user and set in the bind element.

            <xforms:bind id="fr-form-binds" nodeset="instance('fr-form-instance')">
                <xforms:bind id="section-1-bind" nodeset="section-1">
                    <xforms:bind id="control-1-bind" nodeset="control-1" name="control-1"/>
                   
                </xforms:bind>
            </xforms:bind>

Thanks again and again