Quite a piece of work. I will try to understand it.
A small correction:
margin-[top,bottom]: width of containing block, except for page context where it
^^^^^ height (I suppose).
Well, not according to the spec:
http://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#margin-top
(my patch does not deal with the block-width / page-height issue correctly btw).
regards, finn