based on example page from PS, wrote xsl code to generate similar output for pages, but did not get same behaviour. Behaviour I got is what I would have expected; behaviour on PS's sample page is voo-doo to me. Wrote him asking if he could explain the problem.
As part of that, rewrote code that generates relatedDocument list so that there is now an initial branch for images vs non-images, rather than a number of small branches to specially handle images vs non-images.