I am using exf:sort in my application.
<xforms:repeat nodeset="exf:sort(//row, 'column1', 'text', 'ascending') This one works well. <xforms:repeat nodeset="exf:sort(//row, 'concat(column1,column2)', 'text', 'ascending') But this doesn't work. It seems it doesn't support complex xpath (has function). This is just an example. I need to sort by the calculated result. Could you provide some suggestion? java.lang.ClassCastException: org.orbeon.saxon.dom4j.NodeWrapper at org.orbeon.saxon.functions.Concat.evaluateItem(Concat.java:38) at org.orbeon.saxon.sort.SortedIterator.buildArray(SortedIterator.java:176) at org.orbeon.saxon.sort.SortedIterator.doSort(SortedIterator.java:193) at org.orbeon.saxon.sort.SortedIterator.next(SortedIterator.java:76) at org.orbeon.saxon.expr.FilterIterator.getNextMatchingItem(FilterIterator.java:65) |
hi,
> <xforms:repeat nodeset="exf:sort(//row, 'concat(column1,column2)', 'text', > 'ascending') > But this doesn't work. It seems it doesn't support complex xpath (has > function). This is just an example. I need to sort by the calculated result. > Could you provide some suggestion? maybe it's because concat requires two strings, but this example will pass two elements / nodes to concat. Does this work: <xforms:repeat nodeset="exf:sort(//row, concat(column1,column2, ''), 'text', 'ascending'> HTH florian -- 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 |
It doesn't work. The exf sort column should be a xpath string and it will be evaluated at runtime.
|
Administrator
|
Can you try:
concat(string(column1), string(column2))' Not sure why this would be necessary though! -Erik On Oct 13, 2008, at 8:19 PM, cheney zhao wrote: > > It doesn't work. The exf sort column should be a xpath string and it > will be > evaluated at runtime. > -- > View this message in context: http://www.nabble.com/exf-sort-column-doesn%27t-support-function--tp19951724p19966435.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 |
Erik,
Thank you so much, 'concat(string(column1), string(column2))' works well. I have problem on another sort column. Maybe it is too complicated. I want to use a reference attribute to do a query in another instance and get the sort column. 'xxforms:instance('person-ins')/Person[@key=context()/@personReference]/FullName' The error message said instance and context() function is not supported. Do you have any good idea on how to do this? Thanks, Cheney |
Administrator
|
Cheney,
On Oct 15, 2008, at 12:11 AM, cheney zhao wrote: > 'xxforms:instance('person-ins')/Person[@key=context()/ > @personReference]/FullName' > > The error message said instance and context() function is not > supported. Do > you have any good idea on how to do this? Would you have an example, if possible running in the sandbox, that would show this? Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ Personal Blog: http://avernet.blogspot.com/ Twitter - http://twitter.com/avernet -- 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 |
test.xhtml
This is the example. In the example, I sort the result by Quantity and it works well. What I want to sort is the commented line. <xforms:repeat nodeset="exf:sort(xxforms:instance('buy-list')/Customer/Cart/Item, 'xxforms:instance('all-products')/Product[@id=context()/@productRef]/Name', 'text', 'ascending')"> There are two questiosns: 1. There is single single quotes in the sort column expression and the sort column is a string parameter, it should be wrapped with single quotes. How to make it work? 2. It seems is doesn't support instance and context function. |
Administrator
|
On Oct 19, 2008, at 7:37 PM, JamesGu wrote:
> <xforms:repeat > nodeset="exf:sort(xxforms:instance('buy-list')/Customer/Cart/Item, > 'xxforms:instance('all-products')/Product[@id=context()/@productRef]/ > Name', > 'text', 'ascending')"> > > There are two questiosns: > 1. There is single single quotes in the sort column expression and > the sort > column is a string parameter, it should be wrapped with single > quotes. How > to make it work? to pass the string W's end to an XPath function f() a string, you would write: f('W''s end'). > 2. It seems is doesn't support instance and context function. The second argument is an XPath expression which is evaluated by exf:sort() relative to the nodes returned by the first expression. It is passed to exf:sort() as a string, otherwise it would be evaluate before exf:sort() is called, and it wouldn't run in the appropriate context. Because this expression is evaluate by exf:sort(), the functions you normally have in XForms (such as xxforms:instance() and context()) are not available. Unless we (or you) extends exf:sort(), unfortunately you can't access another instance in that second XPath expression, which means you can't sort on the name of the product, unless you store the content of the all-products instance in your buy-list instance. Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ Personal Blog: http://avernet.blogspot.com/ Twitter - http://twitter.com/avernet -- 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 |