At 2010-01-29 17:20 -0500, Anurag Saxena wrote:
What i am looking for is order by if first element available, if not then order by $second....

  order by if ( $first ) then $first else $second

Also it will be very helpfull if you can guide me or point me to some link where i can see how to handle the blank elements in order by. My requirement is they should always be in the end of the sorted list irrespective of whether i do the sorting on ascending or descending order.

Just create a sequence of those that are not blank sorted followed by those that are blank ... there is no obligation to have all items participate in the one sort:

  let $population := ....whatever...
  return ( for $each in $population[...non-blank-condition...]
               order by ...criteria...
               return $each,
           $population[...blank-condition...] )

I hope this helps.

. . . . . . . . . . . . . Ken


--
XSLT/XQuery/XPath training after http://XMLPrague.cz 2010-03-15/19
XSLT/XQuery/XPath training:   San Carlos, California 2010-04-26/30
Vote for your XML training:   http://www.CraneSoftwrights.com/q/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/q/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:[email protected]
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/q/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to