Apply the following XSLT at runtime to renditions:

<? version='1.0' encoding='UTF-8'?>
<xsl:stylesheet ns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
<xsl:template match='@*|node()'>
<xsl:copy><xsl:apply-templates select='@*|node()'/></xsl:copy>
</xsl:template>
<xsl:template match='BOX | GROUP' priority='0'>
<xsl:variable name='uid'><xsl:value-of select='ID/@UID'/></xsl:variable>
<xsl:if test='count(//BOXREF[@UID = $uid]) = 0'>
<xsl:copy><xsl:apply-templates select='@*|node()'/></xsl:copy>
</xsl:if>
</xsl:template>
<xsl:template match='BOXREF'>
<xsl:variable name='uid'><xsl:value-of select='@UID'/></xsl:variable>
<xsl:for-each select='//BOX[ID/@UID=$uid]'>
<xsl:copy><xsl:apply-templates select='@*|node()'/></xsl:copy>
</xsl:for-each>
<xsl:for-each select='//GROUP[ID/@UID=$uid]'>
<xsl:copy><xsl:apply-templates select='@*|node()'/></xsl:copy>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

Sample URL: http://localhost:8080//QXPDocname.qxp?XSL=file:XsltlocationandName.xslt