I have solved mine too.. Not sure why I had to move the line setting response content type above the xml data generation loop. I used to have it at the end of the page after the the data get generated in xml format.
Is this already corrected? We have our queries written in xml and translates them into html pages using xslt. I don't think we can specify default values for sidx or any other request parameters in xml like the php did here.
Why would we want to use sortname and sortorder at first load and then switch to sidx and sord thereafter?