You can do this without variables. Like this:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wi="http://schemas.microsoft.com/wix/2006/wi">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>
<xsl:key name="kCompsToRemove"
match="wi:Component[contains(wi:File/@Source, 'ABC')]"
use="@Id" />
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[self::wi:Component or self::wi:ComponentRef]
[key('kCompsToRemove', @Id)]" />
</xsl:stylesheet>
When run on your sample input, this produces:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="APPFOLDER">
<Component Id="cmp78E9FF58917B1844F3E9315A285F3147" Guid="SOME-GUID">
<File Id="fil093D6D7CB723B5B62730D7B4E575F154" KeyPath="yes" Source="PQR.Some.dll" />
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="AppFiles">
<ComponentRef Id="cmp78E9FF58917B1844F3E9315A285F3147" />
</ComponentGroup>
</Fragment>
</Wix>