<persons>
<person> <id>p1</id> </person> <person> <id>p2</id> </person> <person> <id>p3</id> </person> <person> <id>p4</id> </person> </persons> <xforms:repeat nodeset="exf:sort(/persons/person, 'id', 'text')"> I am trying to sort this xml. There are only primary keys in xml data and the names are stored in another xml instance. Can I sort by name (not id) in this function? Any suggestions will be appreciated. <Person key="p1"> <PersonName> <FullName>Tom</FullName> </PersonName> </Person> <Person key="p2"> <PersonName> <FullName>Jack</FullName> </PersonName> </Person> <Person key="p3"> <PersonName> <FullName>Clark</FullName> </PersonName> </Person> <Person key="p4"> <PersonName> <FullName>Mike</FullName> </PersonName> </Person> |
Administrator
|
I am not sure what the two XML fragments below are. Could you provide
more information? -Erik On Jun 16, 2008, at 8:35 AM, James Gu wrote: > > <persons> > <person> > <id>p1</id> > </person> > <person> > <id>p2</id> > </person> > <person> > <id>p3</id> > </person> > <person> > <id>p4</id> > </person> > </persons> > > <xforms:repeat nodeset="exf:sort(/persons/person, 'id', 'text')"> > > I am trying to sort this xml. There are only primary keys in xml > data and > the names are stored in another xml instance. Can I sort by name > (not id) in > this function? Any suggestions will be appreciated. > > <Person key="p1"> > <PersonName> > <FullName>Tom</FullName> > </PersonName> > </Person> > <Person key="p2"> > <PersonName> > <FullName>Jack</FullName> > </PersonName> > </Person> > <Person key="p3"> > <PersonName> > <FullName>Clark</FullName> > </PersonName> > </Person> > <Person key="p4"> > <PersonName> > <FullName>Mike</FullName> > </PersonName> > </Person> > -- > View this message in context: http://www.nabble.com/Can-I-sort-by-the-label-%28ref-by-the-value-in-xml%29-in-exf%3Asort-function-tp17867017p17867017.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 Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.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 |
These are the instances.
<xforms:instance id="scorelist"> <department> <employee> <personfk>p3</personfk> <score>80</score> </employee> <employee> <personfk>p4</personfk> <score>70</score> </employee> <employee> <personfk>p1</personfk> <score>90</score> </employee> <employee> <personfk>p2</personfk> <score>100</score> </employee> </department> </xforms:instance> <xforms:instance id="personlist"> <persons> <Person key="p1"> <PersonName> <FullName>Tom</FullName> </PersonName> </Person> <Person key="p2"> <PersonName> <FullName>Jack</FullName> </PersonName> </Person> <Person key="p3"> <PersonName> <FullName>Clark</FullName> </PersonName> </Person> <Person key="p4"> <PersonName> <FullName>Mike</FullName> </PersonName> </Person> </persons> </xforms:instance> This is the code to generate a table for instance list. <xhtml:table> <xforms:repeat nodeset="exf:sort(xxforms:instance('scorelist')/employee,'personfk','text')"> <xhtml:tr> <xhtml:td> <xforms:output value="personfk"></xforms:output> </xhtml:td> <xhtml:td> <xxforms:variable name="current-value" select="personfk"></xxforms:variable> <xforms:output value="saxon:evaluate(replace('xxforms:instance(''personlist'')/Person[@key=''%current-value%'']/PersonName/FullName', '%current-value%', $current-value))"></xforms:output> </xhtml:td> <xhtml:td> <xforms:output value="score"></xforms:output> </xhtml:td> </xhtml:tr> </xforms:repeat> </xhtml:table> This is the result I got. My question is how can I sort by the second column (name). This column doesn't exist in the repeat nodeset, but I can get it from other instance because there is fk in nodeset. It is a lookup. Does exf:sort provide solution of this situation? Could you check it? fk name score p1 Tom 90 p2 Jack 100 p3 Clark 80 p4 Mike 70 Thank you very much! |
James,
What about <xhtml:table> <xforms:repeat nodeset="exf:sort(xxforms:instance('personlist')/Person,'PersonName/FullName','text')"> <xhtml:tr> <xhtml:td> <xforms:output value="@key"></xforms:output> </xhtml:td> <xhtml:td> <xforms:output value="PersonName/Fullname"></xforms:output> </xhtml:td> <xhtml:td> <xforms:output value="xxforms:instance('scorelist')/employee[personfk = current()/@key]/score"></xforms:output> </xhtml:td> </xhtml:tr> </xforms:repeat> </xhtml:table> Ryan ----------------------------------------------- Ryan Puddephatt FIX Developer Fidessa LatentZero 1 Alfred Place London WC1E 7EB Office: +44 (0) 20 7462 4200 Direct: +44 (0) 20 7323 6112 Blackberry: +44 (0) 79 8539 2458 Fax: +44 (0) 20 7462 4242 Email: [hidden email] Web: http://www.latentzero.com -----Original Message----- From: JamesGu [mailto:[hidden email]] Sent: 20 June 2008 22:52 To: [hidden email] Subject: [ops-users] Re: Can I sort by the label (ref by the value in xml) in exf:sort function These are the instances. <xforms:instance id="scorelist"> <department> <employee> <personfk>p3</personfk> <score>80</score> </employee> <employee> <personfk>p4</personfk> <score>70</score> </employee> <employee> <personfk>p1</personfk> <score>90</score> </employee> <employee> <personfk>p2</personfk> <score>100</score> </employee> </department> </xforms:instance> <xforms:instance id="personlist"> <persons> <Person key="p1"> <PersonName> <FullName>Tom</FullName> </PersonName> </Person> <Person key="p2"> <PersonName> <FullName>Jack</FullName> </PersonName> </Person> <Person key="p3"> <PersonName> <FullName>Clark</FullName> </PersonName> </Person> <Person key="p4"> <PersonName> <FullName>Mike</FullName> </PersonName> </Person> </persons> </xforms:instance> This is the code to generate a table for instance list. <xhtml:table> <xforms:repeat nodeset="exf:sort(xxforms:instance('scorelist')/employee,'personfk','text')"> <xhtml:tr> <xhtml:td> <xforms:output value="personfk"></xforms:output> </xhtml:td> <xhtml:td> <xxforms:variable name="current-value" select="personfk"></xxforms:variable> <xforms:output value="saxon:evaluate(replace('xxforms:instance(''personlist'')/Person[@key=''%current-value%'']/PersonName/FullName', '%current-value%', $current-value))"></xforms:output> </xhtml:td> <xhtml:td> <xforms:output value="score"></xforms:output> </xhtml:td> </xhtml:tr> </xforms:repeat> </xhtml:table> This is the result I got. My question is how can I sort by the second column (name). This column doesn't exist in the repeat nodeset, but I can get it from other instance because there is fk in nodeset. It is a lookup. Does exf:sort provide solution of this situation? Could you check it? fk name score p1 Tom 90 p2 Jack 100 p3 Clark 80 p4 Mike 70 Thank you very much! -- View this message in context: http://www.nabble.com/Can-I-sort-by-the-label-%28ref-by-the-value-in-xml%29-in-exf%3Asort-function-tp17867017p18037995.html Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ _______________________________________________________________________ The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. _____________________________________________________________________ This e-mail has been scanned for viruses by Verizon Business Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.mci.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 solution can solve the problem in this example. You changed the nodeset from employee to persons, but in my real cases, there are multiple reference columns and I need to keep the employee as nodeset. What I want is to provide user the ability to sort by reference columns. What I want is something like this: <xforms:repeat nodeset="exf:sort(xxforms:instance('scorelist')/employee, 'xxforms:instance(''personlist'')/Person[@key=current()/personfk]/PersonName/FullName' ,'text')"> Unfortunately, current() function can not be used in xpath. <xhtml:table> <xforms:repeat nodeset="exf:sort(xxforms:instance('personlist')/Person,'PersonName/FullName','text')"> <xhtml:tr> <xhtml:td> <xforms:output value="@key"></xforms:output> </xhtml:td> <xhtml:td> <xforms:output value="PersonName/Fullname"></xforms:output> </xhtml:td> <xhtml:td> <xforms:output value="xxforms:instance('scorelist')/employee[personfk = current()/@key]/score"></xforms:output> </xhtml:td> </xhtml:tr> </xforms:repeat> </xhtml:table> Ryan ----------------------------------------------- Ryan Puddephatt FIX Developer Fidessa LatentZero 1 Alfred Place London WC1E 7EB Office: +44 (0) 20 7462 4200 Direct: +44 (0) 20 7323 6112 Blackberry: +44 (0) 79 8539 2458 Fax: +44 (0) 20 7462 4242 Email: rpuddephatt@latentzero.com Web: http://www.latentzero.com -----Original Message----- From: JamesGu [mailto:jxgu@cnsh.delphi-tech.com] Sent: 20 June 2008 22:52 To: ops-users@ow2.org Subject: [ops-users] Re: Can I sort by the label (ref by the value in xml) in exf:sort function These are the instances. <xforms:instance id="scorelist"> <department> <employee> <personfk>p3</personfk> <score>80</score> </employee> <employee> <personfk>p4</personfk> <score>70</score> </employee> <employee> <personfk>p1</personfk> <score>90</score> </employee> <employee> <personfk>p2</personfk> <score>100</score> </employee> </department> </xforms:instance> <xforms:instance id="personlist"> <persons> <Person key="p1"> <PersonName> <FullName>Tom</FullName> </PersonName> </Person> <Person key="p2"> <PersonName> <FullName>Jack</FullName> </PersonName> </Person> <Person key="p3"> <PersonName> <FullName>Clark</FullName> </PersonName> </Person> <Person key="p4"> <PersonName> <FullName>Mike</FullName> </PersonName> </Person> </persons> </xforms:instance> This is the code to generate a table for instance list. <xhtml:table> <xforms:repeat nodeset="exf:sort(xxforms:instance('scorelist')/employee,'personfk','text')"> <xhtml:tr> <xhtml:td> <xforms:output value="personfk"></xforms:output> </xhtml:td> <xhtml:td> <xxforms:variable name="current-value" select="personfk"></xxforms:variable> <xforms:output value="saxon:evaluate(replace('xxforms:instance(''personlist'')/Person[@key=''%current-value%'']/PersonName/FullName', '%current-value%', $current-value))"></xforms:output> </xhtml:td> <xhtml:td> <xforms:output value="score"></xforms:output> </xhtml:td> </xhtml:tr> </xforms:repeat> </xhtml:table> This is the result I got. My question is how can I sort by the second column (name). This column doesn't exist in the repeat nodeset, but I can get it from other instance because there is fk in nodeset. It is a lookup. Does exf:sort provide solution of this situation? Could you check it? fk name score p1 Tom 90 p2 Jack 100 p3 Clark 80 p4 Mike 70 Thank you very much! -- View this message in context: http://www.nabble.com/Can-I-sort-by-the-label-%28ref-by-the-value-in-xml%29-in-exf%3Asort-function-tp17867017p18037995.html Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ _______________________________________________________________________ The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. _____________________________________________________________________ This e-mail has been scanned for viruses by Verizon Business Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.mci.com -- You receive this message as a subscriber of the ops-users@ow2.org mailing list. To unsubscribe: mailto:ops-users-unsubscribe@ow2.org For general help: mailto:sympa@ow2.org?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Hi James,
What comes to my mind is to wrap triggers around each of the columns you want to be sortable, and pass it to a pipeline where you do xslt sorting, where in fact, you replace the data sorted. The page itself would remain simple as the data is sorted to start with. Maybe this approach is the hard way and it could be solved 'inline'... Just my few cents, Mike |
In reply to this post by James Gu
You could use a XPL to process the sort using XSLT
I think this is going to be the easiest way ------------------------ Ryan Puddephatt FIX Developer Fidessa LatentZero 1 Alfred Place London WC1E 7EB Office: +44 (0) 20 7462 4200 Direct: +44 (0) 20 7323 6112 Blackberry: +44 (0) 79 8539 2458 Fax: +44 (0) 20 7462 4242 Email: [hidden email] Web: http://www.latentzero.com Sent from my blackberry device ----- Original Message ----- From: JamesGu <[hidden email]> To: [hidden email] <[hidden email]> Sent: Mon Jun 23 20:07:37 2008 Subject: [ops-users] RE: Re: Can I sort by the label (ref by the value in xml) in exf:sort function You solution can solve the problem in this example. You changed the nodeset from employee to persons, but in my real cases, there are multiple reference columns and I need to keep the employee as nodeset. What I want is to provide user the ability to sort by reference columns. What I want is something like this: <xforms:repeat nodeset="exf:sort(xxforms:instance('scorelist')/employee, 'xxforms:instance(''personlist'')/Person[@key=current()/personfk]/PersonName/FullName' ,'text')"> Unfortunately, current() function can not be used in xpath. <xhtml:table> <xforms:repeat nodeset="exf:sort(xxforms:instance('personlist')/Person,'PersonName/FullName','text')"> <xhtml:tr> <xhtml:td> <xforms:output value="@key"></xforms:output> </xhtml:td> <xhtml:td> <xforms:output value="PersonName/Fullname"></xforms:output> </xhtml:td> <xhtml:td> <xforms:output value="xxforms:instance('scorelist')/employee[personfk = current()/@key]/score"></xforms:output> </xhtml:td> </xhtml:tr> </xforms:repeat> </xhtml:table> Ryan ----------------------------------------------- Ryan Puddephatt FIX Developer Fidessa LatentZero 1 Alfred Place London WC1E 7EB Office: +44 (0) 20 7462 4200 Direct: +44 (0) 20 7323 6112 Blackberry: +44 (0) 79 8539 2458 Fax: +44 (0) 20 7462 4242 Email: [hidden email] Web: http://www.latentzero.com -----Original Message----- From: JamesGu [mailto:[hidden email]] Sent: 20 June 2008 22:52 To: [hidden email] Subject: [ops-users] Re: Can I sort by the label (ref by the value in xml) in exf:sort function These are the instances. <xforms:instance id="scorelist"> <department> <employee> <personfk>p3</personfk> <score>80</score> </employee> <employee> <personfk>p4</personfk> <score>70</score> </employee> <employee> <personfk>p1</personfk> <score>90</score> </employee> <employee> <personfk>p2</personfk> <score>100</score> </employee> </department> </xforms:instance> <xforms:instance id="personlist"> <persons> <Person key="p1"> <PersonName> <FullName>Tom</FullName> </PersonName> </Person> <Person key="p2"> <PersonName> <FullName>Jack</FullName> </PersonName> </Person> <Person key="p3"> <PersonName> <FullName>Clark</FullName> </PersonName> </Person> <Person key="p4"> <PersonName> <FullName>Mike</FullName> </PersonName> </Person> </persons> </xforms:instance> This is the code to generate a table for instance list. <xhtml:table> <xforms:repeat nodeset="exf:sort(xxforms:instance('scorelist')/employee,'personfk','text')"> <xhtml:tr> <xhtml:td> <xforms:output value="personfk"></xforms:output> </xhtml:td> <xhtml:td> <xxforms:variable name="current-value" select="personfk"></xxforms:variable> <xforms:output value="saxon:evaluate(replace('xxforms:instance(''personlist'')/Person[@key=''%current-value%'']/PersonName/FullName', '%current-value%', $current-value))"></xforms:output> </xhtml:td> <xhtml:td> <xforms:output value="score"></xforms:output> </xhtml:td> </xhtml:tr> </xforms:repeat> </xhtml:table> This is the result I got. My question is how can I sort by the second column (name). This column doesn't exist in the repeat nodeset, but I can get it from other instance because there is fk in nodeset. It is a lookup. Does exf:sort provide solution of this situation? Could you check it? fk name score p1 Tom 90 p2 Jack 100 p3 Clark 80 p4 Mike 70 Thank you very much! -- View this message in context: http://www.nabble.com/Can-I-sort-by-the-label-%28ref-by-the-value-in-xml%29-in-exf%3Asort-function-tp17867017p18037995.html Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ _______________________________________________________________________ The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. _____________________________________________________________________ This e-mail has been scanned for viruses by Verizon Business Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.mci.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 -- View this message in context: http://www.nabble.com/Can-I-sort-by-the-label-%28ref-by-the-value-in-xml%29-in-exf%3Asort-function-tp17867017p18076107.html Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ _______________________________________________________________________ The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. _____________________________________________________________________ This e-mail has been scanned for viruses by Verizon Business Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.mci.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 |
In reply to this post by Mike Ahlers
Mike,
Thank you very much! This works but I am worried that it will slow down the server when users do many sorts actions or there are too many records. I am trying to find a way to do sorting on client side. Thanks, James
|
In reply to this post by Ryan Puddephatt-3
Ryan,
Seems you did some research on this. Thank you very much! This works but I am worried about the performance on server side. Is there some way to do this kind of sorting on client side? Even it is complicated. Thanks, James
|
Administrator
|
You could sort data on the client, but this raises an issue of keeping
client and server in sync. E.g. if you use xforms:repeat, the server assumes it knows in which order the data is on the client. If you change it on the client without telling the server, you risk confusing the server later and get unpredictable results. -Erik On Jun 24, 2008, at 1:37 PM, JamesGu wrote: > > Ryan, > > Seems you did some research on this. Thank you very much! This works > but I > am worried about the performance on server side. Is there some way > to do > this kind of sorting on client side? Even it is complicated. > > Thanks, > James > > > > Ryan Puddephatt-3 wrote: >> >> You could use a XPL to process the sort using XSLT >> >> I think this is going to be the easiest way >> ------------------------ >> Ryan Puddephatt >> FIX Developer >> Fidessa LatentZero >> 1 Alfred Place >> London WC1E 7EB >> Office: +44 (0) 20 7462 4200 >> Direct: +44 (0) 20 7323 6112 >> Blackberry: +44 (0) 79 8539 2458 >> Fax: +44 (0) 20 7462 4242 >> Email: [hidden email] >> Web: http://www.latentzero.com >> Sent from my blackberry device >> >> ----- Original Message ----- >> From: JamesGu <[hidden email]> >> To: [hidden email] <[hidden email]> >> Sent: Mon Jun 23 20:07:37 2008 >> Subject: [ops-users] RE: Re: Can I sort by the label (ref by the >> value in >> xml) in exf:sort function >> >> >> >> >> You solution can solve the problem in this example. You changed the >> nodeset >> from employee to persons, but in my real cases, there are multiple >> reference >> columns and I need to keep the employee as nodeset. What I want is to >> provide user the ability to sort by reference columns. >> >> What I want is something like this: >> >> <xforms:repeat nodeset="exf:sort(xxforms:instance('scorelist')/ >> employee, >> 'xxforms:instance(''personlist'')/Person[@key=current()/personfk]/ >> PersonName/FullName' >> ,'text')"> >> >> Unfortunately, current() function can not be used in xpath. >> >> >> <xhtml:table> >> <xforms:repeat >> nodeset="exf:sort(xxforms:instance('personlist')/Person,'PersonName/ >> FullName','text')"> >> <xhtml:tr> >> <xhtml:td> >> <xforms:output value="@key"></xforms:output> >> </xhtml:td> >> <xhtml:td> >> <xforms:output >> value="PersonName/Fullname"></xforms:output> >> </xhtml:td> >> <xhtml:td> >> <xforms:output >> value="xxforms:instance('scorelist')/employee[personfk = >> current()/@key]/score"></xforms:output> >> </xhtml:td> >> </xhtml:tr> >> </xforms:repeat> >> </xhtml:table> >> >> Ryan >> >> ----------------------------------------------- >> Ryan Puddephatt >> FIX Developer >> Fidessa LatentZero >> 1 Alfred Place >> London WC1E 7EB >> Office: +44 (0) 20 7462 4200 >> Direct: +44 (0) 20 7323 6112 >> Blackberry: +44 (0) 79 8539 2458 >> Fax: +44 (0) 20 7462 4242 >> Email: [hidden email] >> Web: http://www.latentzero.com >> >> >> -----Original Message----- >> From: JamesGu [mailto:[hidden email]] >> Sent: 20 June 2008 22:52 >> To: [hidden email] >> Subject: [ops-users] Re: Can I sort by the label (ref by the value >> in xml) >> in exf:sort function >> >> >> These are the instances. >> <xforms:instance id="scorelist"> >> <department> >> <employee> >> <personfk>p3</personfk> >> <score>80</score> >> </employee> >> <employee> >> <personfk>p4</personfk> >> <score>70</score> >> </employee> >> <employee> >> <personfk>p1</personfk> >> <score>90</score> >> </employee> >> <employee> >> <personfk>p2</personfk> >> <score>100</score> >> </employee> >> </department> >> </xforms:instance> >> >> <xforms:instance id="personlist"> >> <persons> >> <Person key="p1"> >> <PersonName> >> <FullName>Tom</FullName> >> </PersonName> >> </Person> >> <Person key="p2"> >> <PersonName> >> <FullName>Jack</FullName> >> </PersonName> >> </Person> >> <Person key="p3"> >> <PersonName> >> <FullName>Clark</FullName> >> </PersonName> >> </Person> >> <Person key="p4"> >> <PersonName> >> <FullName>Mike</FullName> >> </PersonName> >> </Person> >> </persons> >> </xforms:instance> >> >> >> This is the code to generate a table for instance list. >> >> <xhtml:table> >> <xforms:repeat >> nodeset="exf:sort(xxforms:instance('scorelist')/ >> employee,'personfk','text')"> >> <xhtml:tr> >> <xhtml:td> >> <xforms:output value="personfk"></ >> xforms:output> >> </xhtml:td> >> <xhtml:td> >> <xxforms:variable name="current-value" >> select="personfk"></xxforms:variable> >> <xforms:output >> >> value="saxon:evaluate(replace('xxforms:instance(''personlist'')/ >> Person[@key=''%current-value%'']/PersonName/FullName', >> '%current-value%', $current-value))"></xforms:output> >> </xhtml:td> >> <xhtml:td> >> <xforms:output value="score"></xforms:output> >> </xhtml:td> >> </xhtml:tr> >> </xforms:repeat> >> </xhtml:table> >> >> This is the result I got. My question is how can I sort by the second >> column >> (name). This column doesn't exist in the repeat nodeset, but I can >> get it >> from other instance because there is fk in nodeset. It is a lookup. >> Does >> exf:sort provide solution of this situation? Could you check it? >> >> fk name score >> >> p1 Tom 90 >> >> p2 Jack 100 >> >> p3 Clark 80 >> >> p4 Mike 70 >> >> >> Thank you very much! >> >> -- >> View this message in context: >> http://www.nabble.com/Can-I-sort-by-the-label-%28ref-by-the-value-in-xml%29-in-exf%3Asort-function-tp17867017p18037995.html >> Sent from the ObjectWeb OPS - Users mailing list archive at >> Nabble.com. >> >> >> >> ______________________________________________________________________ >> This email has been scanned by the MessageLabs Email Security System. >> For more information please visit http://www.messagelabs.com/email >> ______________________________________________________________________ >> >> _______________________________________________________________________ >> The information transmitted is intended only for the person or >> entity to >> which it is addressed and may contain confidential and/or privileged >> material. Any review, retransmission, dissemination or other use >> of, or >> taking of any action in reliance upon, this information by persons or >> entities other than the intended recipient is prohibited. If you >> received >> this in error, please contact the sender and delete the material >> from any >> computer. >> >> _____________________________________________________________________ >> This e-mail has been scanned for viruses by Verizon Business Internet >> Managed Scanning Services - powered by MessageLabs. For further >> information >> visit http://www.mci.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 >> >> >> >> -- >> View this message in context: >> http://www.nabble.com/Can-I-sort-by-the-label-%28ref-by-the-value-in-xml%29-in-exf%3Asort-function-tp17867017p18076107.html >> Sent from the ObjectWeb OPS - Users mailing list archive at >> Nabble.com. >> >> >> >> ______________________________________________________________________ >> This email has been scanned by the MessageLabs Email Security System. >> For more information please visit http://www.messagelabs.com/email >> ______________________________________________________________________ >> >> _______________________________________________________________________ >> The information transmitted is intended only for the person or >> entity to >> which it is addressed and may contain confidential and/or privileged >> material. Any review, retransmission, dissemination or other use >> of, or >> taking of any action in reliance upon, this information by persons or >> entities other than the intended recipient is prohibited. If you >> received >> this in error, please contact the sender and delete the material >> from any >> computer. >> >> _____________________________________________________________________ >> This e-mail has been scanned for viruses by Verizon Business Internet >> Managed Scanning Services - powered by MessageLabs. For further >> information visit http://www.mci.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 >> >> > > -- > View this message in context: http://www.nabble.com/Can-I-sort-by-the-label-%28ref-by-the-value-in-xml%29-in-exf%3Asort-function-tp17867017p18099545.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 Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.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 |
In reply to this post by James Gu
Erik/James,
I agree I've done some testing with this in the past and found javascript sorting caused a number of problems for the server Running an XSL on the server is pretty fast, if not equally as fast as your current sort method, which is also processed server-side Ryan ------------------------ Ryan Puddephatt FIX Developer Fidessa LatentZero 1 Alfred Place London WC1E 7EB Office: +44 (0) 20 7462 4200 Direct: +44 (0) 20 7323 6112 Blackberry: +44 (0) 79 8539 2458 Fax: +44 (0) 20 7462 4242 Email: [hidden email] Web: http://www.latentzero.com Sent from my blackberry device ----- Original Message ----- From: Erik Bruchez <[hidden email]> To: [hidden email] <[hidden email]> Sent: Wed Jun 25 17:27:40 2008 Subject: [ops-users] Re: Re: RE: Re: Can I sort by the label (ref by the value in xml) in exf:sort function You could sort data on the client, but this raises an issue of keeping client and server in sync. E.g. if you use xforms:repeat, the server assumes it knows in which order the data is on the client. If you change it on the client without telling the server, you risk confusing the server later and get unpredictable results. -Erik On Jun 24, 2008, at 1:37 PM, JamesGu wrote: > > Ryan, > > Seems you did some research on this. Thank you very much! This works > but I > am worried about the performance on server side. Is there some way > to do > this kind of sorting on client side? Even it is complicated. > > Thanks, > James > > > > Ryan Puddephatt-3 wrote: >> >> You could use a XPL to process the sort using XSLT >> >> I think this is going to be the easiest way >> ------------------------ >> Ryan Puddephatt >> FIX Developer >> Fidessa LatentZero >> 1 Alfred Place >> London WC1E 7EB >> Office: +44 (0) 20 7462 4200 >> Direct: +44 (0) 20 7323 6112 >> Blackberry: +44 (0) 79 8539 2458 >> Fax: +44 (0) 20 7462 4242 >> Email: [hidden email] >> Web: http://www.latentzero.com >> Sent from my blackberry device >> >> ----- Original Message ----- >> From: JamesGu <[hidden email]> >> To: [hidden email] <[hidden email]> >> Sent: Mon Jun 23 20:07:37 2008 >> Subject: [ops-users] RE: Re: Can I sort by the label (ref by the >> value in >> xml) in exf:sort function >> >> >> >> >> You solution can solve the problem in this example. You changed the >> nodeset >> from employee to persons, but in my real cases, there are multiple >> reference >> columns and I need to keep the employee as nodeset. What I want is to >> provide user the ability to sort by reference columns. >> >> What I want is something like this: >> >> <xforms:repeat nodeset="exf:sort(xxforms:instance('scorelist')/ >> employee, >> 'xxforms:instance(''personlist'')/Person[@key=current()/personfk]/ >> PersonName/FullName' >> ,'text')"> >> >> Unfortunately, current() function can not be used in xpath. >> >> >> <xhtml:table> >> <xforms:repeat >> nodeset="exf:sort(xxforms:instance('personlist')/Person,'PersonName/ >> FullName','text')"> >> <xhtml:tr> >> <xhtml:td> >> <xforms:output value="@key"></xforms:output> >> </xhtml:td> >> <xhtml:td> >> <xforms:output >> value="PersonName/Fullname"></xforms:output> >> </xhtml:td> >> <xhtml:td> >> <xforms:output >> value="xxforms:instance('scorelist')/employee[personfk = >> current()/@key]/score"></xforms:output> >> </xhtml:td> >> </xhtml:tr> >> </xforms:repeat> >> </xhtml:table> >> >> Ryan >> >> ----------------------------------------------- >> Ryan Puddephatt >> FIX Developer >> Fidessa LatentZero >> 1 Alfred Place >> London WC1E 7EB >> Office: +44 (0) 20 7462 4200 >> Direct: +44 (0) 20 7323 6112 >> Blackberry: +44 (0) 79 8539 2458 >> Fax: +44 (0) 20 7462 4242 >> Email: [hidden email] >> Web: http://www.latentzero.com >> >> >> -----Original Message----- >> From: JamesGu [mailto:[hidden email]] >> Sent: 20 June 2008 22:52 >> To: [hidden email] >> Subject: [ops-users] Re: Can I sort by the label (ref by the value >> in xml) >> in exf:sort function >> >> >> These are the instances. >> <xforms:instance id="scorelist"> >> <department> >> <employee> >> <personfk>p3</personfk> >> <score>80</score> >> </employee> >> <employee> >> <personfk>p4</personfk> >> <score>70</score> >> </employee> >> <employee> >> <personfk>p1</personfk> >> <score>90</score> >> </employee> >> <employee> >> <personfk>p2</personfk> >> <score>100</score> >> </employee> >> </department> >> </xforms:instance> >> >> <xforms:instance id="personlist"> >> <persons> >> <Person key="p1"> >> <PersonName> >> <FullName>Tom</FullName> >> </PersonName> >> </Person> >> <Person key="p2"> >> <PersonName> >> <FullName>Jack</FullName> >> </PersonName> >> </Person> >> <Person key="p3"> >> <PersonName> >> <FullName>Clark</FullName> >> </PersonName> >> </Person> >> <Person key="p4"> >> <PersonName> >> <FullName>Mike</FullName> >> </PersonName> >> </Person> >> </persons> >> </xforms:instance> >> >> >> This is the code to generate a table for instance list. >> >> <xhtml:table> >> <xforms:repeat >> nodeset="exf:sort(xxforms:instance('scorelist')/ >> employee,'personfk','text')"> >> <xhtml:tr> >> <xhtml:td> >> <xforms:output value="personfk"></ >> xforms:output> >> </xhtml:td> >> <xhtml:td> >> <xxforms:variable name="current-value" >> select="personfk"></xxforms:variable> >> <xforms:output >> >> value="saxon:evaluate(replace('xxforms:instance(''personlist'')/ >> Person[@key=''%current-value%'']/PersonName/FullName', >> '%current-value%', $current-value))"></xforms:output> >> </xhtml:td> >> <xhtml:td> >> <xforms:output value="score"></xforms:output> >> </xhtml:td> >> </xhtml:tr> >> </xforms:repeat> >> </xhtml:table> >> >> This is the result I got. My question is how can I sort by the second >> column >> (name). This column doesn't exist in the repeat nodeset, but I can >> get it >> from other instance because there is fk in nodeset. It is a lookup. >> Does >> exf:sort provide solution of this situation? Could you check it? >> >> fk name score >> >> p1 Tom 90 >> >> p2 Jack 100 >> >> p3 Clark 80 >> >> p4 Mike 70 >> >> >> Thank you very much! >> >> -- >> View this message in context: >> http://www.nabble.com/Can-I-sort-by-the-label-%28ref-by-the-value-in-xml%29-in-exf%3Asort-function-tp17867017p18037995.html >> Sent from the ObjectWeb OPS - Users mailing list archive at >> Nabble.com. >> >> >> >> ______________________________________________________________________ >> This email has been scanned by the MessageLabs Email Security System. >> For more information please visit http://www.messagelabs.com/email >> ______________________________________________________________________ >> >> _______________________________________________________________________ >> The information transmitted is intended only for the person or >> entity to >> which it is addressed and may contain confidential and/or privileged >> material. Any review, retransmission, dissemination or other use >> of, or >> taking of any action in reliance upon, this information by persons or >> entities other than the intended recipient is prohibited. If you >> received >> this in error, please contact the sender and delete the material >> from any >> computer. >> >> _____________________________________________________________________ >> This e-mail has been scanned for viruses by Verizon Business Internet >> Managed Scanning Services - powered by MessageLabs. For further >> information >> visit http://www.mci.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 >> >> >> >> -- >> View this message in context: >> http://www.nabble.com/Can-I-sort-by-the-label-%28ref-by-the-value-in-xml%29-in-exf%3Asort-function-tp17867017p18076107.html >> Sent from the ObjectWeb OPS - Users mailing list archive at >> Nabble.com. >> >> >> >> ______________________________________________________________________ >> This email has been scanned by the MessageLabs Email Security System. >> For more information please visit http://www.messagelabs.com/email >> ______________________________________________________________________ >> >> _______________________________________________________________________ >> The information transmitted is intended only for the person or >> entity to >> which it is addressed and may contain confidential and/or privileged >> material. Any review, retransmission, dissemination or other use >> of, or >> taking of any action in reliance upon, this information by persons or >> entities other than the intended recipient is prohibited. If you >> received >> this in error, please contact the sender and delete the material >> from any >> computer. >> >> _____________________________________________________________________ >> This e-mail has been scanned for viruses by Verizon Business Internet >> Managed Scanning Services - powered by MessageLabs. For further >> information visit http://www.mci.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 >> >> > > -- > View this message in context: http://www.nabble.com/Can-I-sort-by-the-label-%28ref-by-the-value-in-xml%29-in-exf%3Asort-function-tp17867017p18099545.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 Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/ ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ _______________________________________________________________________ The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. _____________________________________________________________________ This e-mail has been scanned for viruses by Verizon Business Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.mci.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 |
Free forum by Nabble | Edit this page |