Hi Mary, I think the order of the attributes does not have any meaning as XML does not have a notion of order in attributes.
http://www.w3.org/TR/REC-xml/#sec-starttags If you want to preserve the order, consider putting these in elements instead of attributes. -Danny From: [email protected] [mailto:[email protected]] On Behalf Of Kalinosky, Mary Sent: Tuesday, July 09, 2013 11:52 AM To: [email protected] Subject: [MarkLogic Dev General] preserve sort order Is there any way to preserve sort order in xquery? My problem is that the data has to get passed to the MVC framework's get-response() function on the return, so I think it's automatically reverting to document order. I thought that doing the sort right in the first paramter of the subsequence() function would capture the first 'n' items after they are sorted, but it does not. I also tried having the $search-results parameter sorted before the call to subsequence(), but that did not work either. See the following code: let $data := <figures count="{$count}" mediatypes="{$mtypes}" start="{$start}" end="{$start+$myns:image-paging-default}" page="{$page}" increment="{$myns:image-paging-default}" total-pages="{ if ($count lt $myns:image-paging-default) then 1 else ceiling(($count + 1) div $myns:image-paging-default) }" { subsequence( ( for $item in ($search-results) order by $item//figure/@ftype descending return $item), $start, $myns:image-paging-default) } </figures> let $sidebar := xdmp:get-server-field('imagefacets') return utils:get-response($req, ($data,$sidebar) ) Many Thanks, Mary Kalinosky Senior Technical Developer, eProducts Thieme Medical Publishers 333 Seventh Avenue, New York, NY 10001 USA Ruedigerstrasse 14, 70469 Stuttgart, Germany Email: [email protected]<blocked::mailto:[email protected]> Tel: +1 212 584-4684 www.thieme.com<http://www.thieme.com/> Thieme eNeurosurgery: The world's most comprehensive neurosurgical resource online.
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
