Yes you can. This is done easily by adding the jQuery snippet to the first item the XSLT spews out only.
In your ContentQueryMain.xslt find the template OuterTemplate.CallItemTemplate. It has a <xsl:choose> going on in it. In the <xsl:otherwise> clauss add the following:
<xsl:apply-templates select="." mode="itemstyle">
<xsl:with-param name="CurPos" select="$CurPosition" />
</xsl:apply-templates>
Go to your ItemStyle.xslt and in that either create a new or modify a current template and add this:
<xsl:param name="CurPos"/>
right under
<xsl:template name="MyTemplate" match="Row[@Style='MyTemplate']" mode="itemstyle">
So you should have something like this:
<xsl:template name="MyTemplate" match="Row[@Style='MyTemplate']" mode="itemstyle">
<xsl:param name="CurPos"/>
// Rest of your template structure here
</xsl:template>
Within this template add the following:
<xsl:if test="$CurPos = 1">
<xsl:comment>
<![CDATA[
$(document).ready( function() {
// your logic to add css etc. to surrounding container here
});
]]>
</xsl:comment>
</xsl:if>
So your end result should be something like this:
<xsl:template name="MyTemplate" match="Row[@Style='MyTemplate']" mode="itemstyle">
<xsl:param name="CurPos"/>
<xsl:if test="$CurPos = 1">
<xsl:comment>
<![CDATA[
$(document).ready( function() {
// your logic to add css etc. to surrounding container here
});
]]>
</xsl:comment>
</xsl:if>
// Rest of your template structure here
</xsl:template>
Hope this helps :)