See whether using
<xsl:sequence
select="$element ! (. | .//* | key('ref', content-links/content-link/@content-id)/mf:get-related-elements(.))"/>
works for your latest requirement.
But it is hard to tell whether the original approach patched each time you add a requirement is the right way to go unless you start describing with some sentences what the criteria are to copy and not to copy nodes through to the output.
CLICK HERE to find out more related problems solutions.