The crash in "explain" looks very like this bug:
 
http://sourceforge.net/tracker/index.php?func=detail&aid=1913903&group_id=29872&atid=397617
 
But that bug is fixed in 9.0.0.4. You claim to be running 9.0.0.4, but I don't think you can be.
 
By the way... I don't understand the meaning of the "OPT" messages, what is it complaining about?
 
It's not complaining about anything. When you use -explain, you switch on two options: (a) optimizer tracing, which tells you where the expressions have been rewritten by the optimizer for efficiency, and (b) a display of the final expression tree after all the rewrites have been completed. For example, it's telling you that ss:Cell[$start-col] was replaced with the internal function call itemAt(ss:Cell, 5).  This doesn't mean that there is anything wrong with your code; on the contrary, it's good if you write your code in a way that can be optimized. In this case the optimization allows Saxon to directly select the 5th item in the input sequence, rather than scanning the whole input sequence and testing each item to see if its position number is 5.
 
Michael Kay
http://www.saxonica.com/