1st thing, in your code:
Code:
<xsl:template match="parentnode">
<xsl:for-each select="child::childnode">
<xsl:if test="contains($permissions,concat('|',./@key,'|'))">
<xsl:copy>
<xsl:apply-templates select="node()|@*" />
</xsl:copy>
</xsl:if>
</xsl:for-each>
</xsl:template>
You're going to be copying the child nodes, not the the parent node. I suggest using a conditional select using braces [] to see if you've found a node.
Code:
<xsl:template match="parentnode">
<xsl:if test="childnode[contains($permissions,concat('|',./@key,'|'))]">
<xsl:copy>
<xsl:apply-templates select="node()|@*" />
</xsl:copy>
</xsl:if>
</xsl:template>