The problem lies with when you pass your the $data variable as a parameter to myTemplate
<xsl:call-template name="myTemplate">
<xsl:with-param name="myparam">
<xsl:value-of select="$data"/>
</xsl:with-param>
</xsl:call-template>
Because you are using xsl:value-of here, this is only passing the text value of the nodes held in $data; i.e. the parameter is just a single text node. To retain the nodes you would need to use xsl:copy-of
<xsl:call-template name="myTemplate">
<xsl:with-param name="myparam">
<xsl:copy-of select="$data"/>
</xsl:with-param>
</xsl:call-template>
Strictly speaking, this passing a "result tree fragment" which is why you would have to use the node-set extension function, but you would have to modify your use of it because the data node is not strictly the parent node here, the document fragment is
Inner1:<xsl:value-of select="msxsl:node-set($myparam)/data"/>
<br />
Inner2:<xsl:value-of select="msxsl:node-set($myparam)/data/foobar"/>
But, you don't actually have to use node-set here at all really. Change how call the template to this...
<xsl:call-template name="myTemplate">
<xsl:with-param name="myparam" select="$data"/>
</xsl:call-template>
There is an important difference here. This is no longer a result tree fragment, but is referencing the input document directly, meaning you don't have to use node-set at all.
<xsl:template name="myTemplate">
<xsl:param name="myparam"/>
Inner1:<xsl:value-of select="$myparam"/>
<br />
Inner2:<xsl:value-of select="$myparam/foobar"/>
</xsl:template>