First, following-sibling::main_image[1] is shorthand - there is no need for the 'position() = ' part of the predicate.
If you are using XSLT 2.0 then youwould probably use xsl:for-each-group with the group-starting-with attribute to split everything using the main_content element.
In XSLT 1.0 You could do something like this:
Code:
<xsl:for-each select="following-sibling::main_image[current()/generate-id()=preceding-sibling::main_content/generate-id()]">
This would give you all the main_image elements where the preceding main_content had the same unique id as the current element (i.e. they are the same).