Unfortunately there are some issues around using xsl:sort. InfoPath will not leave this element alone during a roundtrip in the designer. The only way to use xsl:sort successfully is to either add it at the very end (and don't load in the designer any more), or use a preserve code block.
Actually, you can avoid using a preserve code block provided that you have some pre-publish documentation that instructs how to fix each xsl:sort element manually. This might be okay until your dev work is complete (i.e. the tables stop changing). Once the tables are "fixed", then add the preserve code block so you don't keep losing your sort.
--
Greg Collins [InfoPath MVP]
Please visit:
http://www.InfoPathDev.com
Is there any way to sort entries in repeating tables aka <xsl:sort>? I just
do not want to have preserved code for every table/repeating section.
Thanks.