I am stumped. Given an xml doc like:
<Frag>
<DirRef Id="BeemzDir">
<Com Id="BEED24F05AB78FB588F61D4092654B6D" Guid="{A11AB356-2F45-4157-92EF-ED49F5BE0F70}">
<FileName Id="fil1" KeyPath="yes" Source="My.Exe" />
</Com>
<Com Id="FFF24F05AB78FB588F61D4092654CCC" Guid="{A11AB356-2F45-4157-92EF-ED49F5BE0F70}">
<FileName Id="fil2" KeyPath="yes" Source="My.Dll" />
</Com>
</DirRef>
</Frag>
<Frag>
<ComGroup Id="MyGroup">
<CompRef Id="BEED24F05AB78FB588F61D4092654B6D" />
<CompRef Id="FFF24F05AB78FB588F61D4092654CCC" />
</ComGroup>
</Frag>
I need to use xslt to remove the element that houses the Source="My.Exe". In this case remove element "Com" where its attribute id=BEED24F05AB78FB588F61D4092654B6D.
I have done that. But what I cant do is also remove the "CompRef" element where Id=BEED24F05AB78FB588F61D4092654B6D.
So after transformation I want my xml to look like:
<Frag>
<DirRef Id="BeemzDir">
<Com Id="FFF24F05AB78FB588F61D4092654CCC" Guid="{A11AB356-2F45-4157-92EF-ED49F5BE0F70}">
<FileName Id="fil2" KeyPath="yes" Source="My.Dll" />
</Com>
</DirRef>
</Frag>
<Frag>
<ComGroup Id="MyGroup">
<CompRef Id="FFF24F05AB78FB588F61D4092654CCC" />
</ComGroup>
</Frag>
Any help would be appreciated.
Update
Here is some xml that deletes the "FileName" element.
<xsl:template match="Com/FileName[contains(@Source,'My.Exe')='true']">
</xsl:template>
So that results in:
<Frag>
<DirRef Id="BeemzDir">
<Com Id="BEED24F05AB78FB588F61D4092654B6D" Guid="{A11AB356-2F45-4157-92EF-ED49F5BE0F70}">
</Com>
<Com Id="FFF24F05AB78FB588F61D4092654CCC" Guid="{A11AB356-2F45-4157-92EF-ED49F5BE0F70}">
<FileName Id="fil2" KeyPath="yes" Source="My.Dll" />
</Com>
</DirRef>
</Frag>
<Frag>
<ComGroup Id="MyGroup">
<CompRef Id="BEED24F05AB78FB588F61D4092654B6D" />
<CompRef Id="FFF24F05AB78FB588F61D4092654CCC" />
</ComGroup>
</Frag>
Changing the above xsl that calls an xsl:apply-template doesn nothing, as its stuck in the node its operating in. I dont know how to store the Ids I want to delete and then loop through them.
Update 2
There can be more than one node to delete, that is multiple "Com" elements where source="MyExe". Also the Id is autogenerated so will be different each this is run.