Re: sorting, was: Version 3.0 now available!
Brought to you by:
bs_php,
nigelswinson
From: Nigel S. <nig...@us...> - 2002-05-14 18:51:03
|
> > Ok the default order for the results is now doc order. Sorting by other > > means probably isn't too difficult anyway, as you can use the usort() > > function that takes a callback of two elements that you can then write your > > own function to compare elements with. > > wouldn't disagree with you Nigel, but the problem is surely where there is no > element to sort by. If you have in your xml source > <a><b><c><a><b><c><b><a> > and you say match("//a | //b"), it should return a b a b b a, but it doesn't; > it returns the <a>s first, then the <b>s, i.e. a a a b b b. This is wrong, as > you are losing information, namely the document order. Of course, as you say, > if you want it sorted in some particular sequence, then you can do so using > PHP functions. Yeah it used to return aaabbb, but as I said "the default order for the results is now doc order". So as of CVS file version 1.86, the order returned will be ababba. If you want to sort by some other criteria, other than doc order, then you can use usort(). Hopefully that meets the needs... Nigel |