node refering in xforms:itemset within xforms:repeat

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

node refering in xforms:itemset within xforms:repeat

venkata subrahmanyam
Hi ,
I have the sample code as below where the dropdowns are not displaying. We are getting displayed of dropdown values even we refer optionid=id OR optionsid=../id

as the repeat is about 60+ records the performance also very less if I use xforms:repeat index.

What is the correct way of refering a node in xforms:itemset?

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:ev="http://www.w3.org/2001/xml-events"
   xmlns:xforms="http://www.w3.org/2002/xforms">
    <head>
    <title>Employee Details</title>
        <xforms:model>
            <xforms:instance id="main-instance">
                <request xmlns="">
                <commondata>
                <record>
                        <no>1</no>
                        <name>name1</name>
                        <id>id1</id>
                        <message/>
                        <rownum>1</rownum>
                </record>
                <record>
                        <no>2</no>
                        <name>name2</name>
                        <id>id2</id>
                        <message/>
                        <rownum>2</rownum>
                </record>
                <record>
                        <no>3</no>
                        <name>name3</name>
                        <id>id3</id>
                        <message/>
                        <rownum>3</rownum>
                </record>
                </commondata>               
                </request>
        </xforms:instance>
       
           <xforms:instance id="options">
                <request xmlns="">
                <options>
                <action_options>
                        <action_label>Development</action_label>
                        <action_value>Development</action_value>
                        <optionid>id1</optionid>
                </action_options>
                <action_options>
                        <action_label>Testing</action_label>
                        <action_value>Testing</action_value>
                        <optionid>id1</optionid>
                </action_options>
                <action_options>
                        <action_label>SupportSofware</action_label>
                        <action_value>SupportSofware</action_value>
                        <optionid>id2</optionid>
                </action_options>
                <action_options>
                        <action_label>SupportHardware</action_label>
                        <action_value>SupportHardware</action_value>
                        <optionid>id2</optionid>
                </action_options>
                </options>
                </request>

     </xforms:instance>

        </xforms:model>
    </head>

    <body>
       
        <xforms:repeat nodeset="instance('main-instance')//commondata/record">
                                                                                        </xforms:repeat>
       
id<xforms:input ref="id"/>name<xforms:input ref="name"/>dept                        <xforms:select1 ref="name">
                        <xforms:itemset ref="instance('options')//action_options[optionid=../id]">
                                        <xforms:label ref="action_label"/>
                                        <xforms:value ref="action_value"/>
                                </xforms:itemset>
                        </xforms:select1>
               

    </body>
</html>

Reply | Threaded
Open this post in threaded view
|

Re: node refering in xforms:itemset within xforms:repeat

Erik Bruchez
Administrator
An easy one. Try:

<xforms:itemset nodeset="instance('options')//action_options[optionid
= context()/../id]">

The trick is the context() functions which points to the XPath context
just outside <xforms:itemset>. In this case, it points on the
<xforms:select1> 's binding, that is the "name" element.

For clarity, you could also use a variable:

<xforms:repeat nodeset="instance('main-instance')//commondata/record">
  <xxforms:variable name="record" select="." as="element(record)"/>
  ...
  <xforms:itemset
nodeset="instance('options')//action_options[optionid = $record/id]">

-Erik

On Fri, Oct 30, 2009 at 4:03 AM, venkata subrahmanyam
<[hidden email]> wrote:

>
> Hi ,
> I have the sample code as below where the dropdowns are not displaying. We
> are getting displayed of dropdown values even we refer optionid=id OR
> optionsid=../id
>
> as the repeat is about 60+ records the performance also very less if I use
> xforms:repeat index.
>
> What is the correct way of refering a node in xforms:itemset?
>
> <html xmlns="http://www.w3.org/1999/xhtml"
>    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>    xmlns:ev="http://www.w3.org/2001/xml-events"
>   xmlns:xforms="http://www.w3.org/2002/xforms">
>    <head>
>    <title>Employee Details</title>
>        <xforms:model>
>            <xforms:instance id="main-instance">
>                <request xmlns="">
>                <commondata>
>                <record>
>                        <no>1</no>
>                        <name>name1</name>
>                        <id>id1</id>
>                        <message/>
>                        <rownum>1</rownum>
>                </record>
>                <record>
>                        <no>2</no>
>                        <name>name2</name>
>                        <id>id2</id>
>                        <message/>
>                        <rownum>2</rownum>
>                </record>
>                <record>
>                        <no>3</no>
>                        <name>name3</name>
>                        <id>id3</id>
>                        <message/>
>                        <rownum>3</rownum>
>                </record>
>                </commondata>
>                </request>
>        </xforms:instance>
>
>           <xforms:instance id="options">
>                <request xmlns="">
>                <options>
>                <action_options>
>                        <action_label>Development</action_label>
>                        <action_value>Development</action_value>
>                        <optionid>id1</optionid>
>                </action_options>
>                <action_options>
>                        <action_label>Testing</action_label>
>                        <action_value>Testing</action_value>
>                        <optionid>id1</optionid>
>                </action_options>
>                <action_options>
>                        <action_label>SupportSofware</action_label>
>                        <action_value>SupportSofware</action_value>
>                        <optionid>id2</optionid>
>                </action_options>
>                <action_options>
>                        <action_label>SupportHardware</action_label>
>                        <action_value>SupportHardware</action_value>
>                        <optionid>id2</optionid>
>                </action_options>
>                </options>
>                </request>
>
>     </xforms:instance>
>
>        </xforms:model>
>    </head>
>
>    <body>
>        <table border="1">
>
>        <xforms:repeat nodeset="instance('main-instance')//commondata/record">
>        <tr>
>        <td>id</td>     <td><xforms:input ref="id"/></td>
>        <td>name</td>   <td><xforms:input ref="name"/></td>
>        <td>dept</td>
>                <td>
>                        <xforms:select1 ref="name">
>                        <xforms:itemset
> ref="instance('options')//action_options[optionid=../id]">
>                                        <xforms:label ref="action_label"/>
>                                        <xforms:value ref="action_value"/>
>                                </xforms:itemset>
>                        </xforms:select1>
>                </td>
>        </tr>
>        </xforms:repeat>
>        </table>
>
>    </body>
> </html>
>
>
> --
> View this message in context: http://n4.nabble.com/node-refering-in-xforms-itemset-within-xforms-repeat-tp278163p278163.html
> Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Thanks . My problem solved

venkata subrahmanyam
Thanks Erik,

It is working.

Subrahmanyam.