Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6640761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:42:37+00:00 2026-05-25T23:42:37+00:00

Given the following XML file: <?xml version=1.0 encoding=utf-8?> <Wix xmlns=http://schemas.microsoft.com/wix/2006/wi> <Fragment> <DirectoryRef Id=INSTALLLOCATIONAGENT> <Component

  • 0

Given the following XML file:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
    <DirectoryRef Id="INSTALLLOCATIONAGENT">
        <Component Id="cmp140DC3A98DEC1F1F528260F1806A3999" Guid="*">
            <File Id="fil57A7BE096A39C9A45B8306DDA29D5B2E" KeyPath="yes" Source="SourceDir\Program.exe" />
        </Component>
        <Component Id="cmpD2075C288DC3B6998C8A7C7E7DF78EB7" Guid="*">
            <File Id="filD8C1A7C27FA3DCB1A863FC3F0420B444" KeyPath="yes" Source="SourceDir\System.Data.SqlServerCe.dll" />
        </Component>
        <Directory Id="dir1377A3F5233B835FB05556A0B1386070" Name="amd64">
            <Component Id="cmp41C2DD9BFF63ABDC86410CFD8251F745" Guid="*">
                <File Id="fil87F68441B60D7259CD41A2CDB411AFC6" KeyPath="yes" Source="SourceDir\amd64\sqlcecompact40.dll" />
            </Component>
            <Component Id="cmpAA3318DF657EDDE7DF58C4CF51DEE2A9" Guid="*">
                <File Id="fil97009E86AAFE6C33EF01BF2EBF205249" KeyPath="yes" Source="SourceDir\amd64\sqlceer40EN.dll" />
            </Component>
            <Component Id="cmp2DD5FBEDECB367F9B56953EBE56D9AEA" Guid="*">
                <File Id="fil42F87CDC8C959316EC83D9271E737C38" KeyPath="yes" Source="SourceDir\amd64\sqlceme40.dll" />
            </Component>
            </Directory>
        </Directory>
    </DirectoryRef>
</Fragment>
<Fragment>
    <ComponentGroup Id="RetailClub.Agent_Project">
        <ComponentRef Id="cmpFFCDA0633C7840EACD8A6CEEFA6EC93A" />
        <ComponentRef Id="cmp96A706AAAB79BB01C9E42BBE9D4DD252" />
        <ComponentRef Id="cmpF2F2F70F2405BCD6BBBB9579CE9EF19B" />
        <ComponentRef Id="cmpF292744916F0F54B44B137EF41E6B160" />
        <ComponentRef Id="cmpFAA31CC5660D6586E79ECC5D008CB730" />
        <ComponentRef Id="cmp9D128034819C12206F13D1EEAABC27A3" />
        <ComponentRef Id="cmpA4ED042A16E7DD31342DA0D47DC7E455" />
        <ComponentRef Id="cmpD531F67ABC1E63E8DB26A6F38D95B212" />
        <ComponentRef Id="cmp7A771F6C7D7E3E3DD707534E56E6A872" />
        <ComponentRef Id="cmpC60669855D22EE54FCA4855DF53BA0E7" />
        <ComponentRef Id="cmp6A8D269A1F473E6F4B091023BC661C5A" />
        <ComponentRef Id="cmpBB8EE28B3ECA91AC087B9D6D365FB19F" />
        <ComponentRef Id="cmpA19E7221E858827A2E5A08010A1AB80A" />
        <ComponentRef Id="cmp140DC3A98DEC1F1F528260F1806A3999" />
        <ComponentRef Id="cmpAC61AD2134F0DA7E4A92C673648AAF1F" />
        <ComponentRef Id="cmp71A3488860AA96C23B2B73BE84AD944D" />
        <ComponentRef Id="cmpD79B6BCF2C02DFE7B4D089414E982035" />
        <ComponentRef Id="cmp6336B810161B473EFA5920B8ACA2101D" />
        <ComponentRef Id="cmpD2075C288DC3B6998C8A7C7E7DF78EB7" />
        <ComponentRef Id="cmp625073995F3B29478ACC5A45E5005184" />
        <ComponentRef Id="cmp6919DDAC4EF84609E800F79B84ACE037" />
        <ComponentRef Id="cmpD411331F9F18AC0A62F4D342193C578B" />
        <ComponentRef Id="cmp41C2DD9BFF63ABDC86410CFD8251F745" />
        <ComponentRef Id="cmpAA3318DF657EDDE7DF58C4CF51DEE2A9" />
        <ComponentRef Id="cmp2DD5FBEDECB367F9B56953EBE56D9AEA" />
        <ComponentRef Id="cmpD6209C86C787D37B2BC10491715961A4" />
        <ComponentRef Id="cmpDEFFF257D183C61CF106691B502C9B92" />
        <ComponentRef Id="cmpAE88027B6D0222521E0ABA368319FF67" />
        <ComponentRef Id="cmpF2490B3F3B6C3AFDCCE0B7D9E04B1307" />
        <ComponentRef Id="cmpC3992B351478947A4EC528039072EE48" />
        <ComponentRef Id="cmp70020D3E903A3C6460350DB8EDA762AE" />
        <ComponentRef Id="cmp09907E3F88C8846C5036ED1B4E1E81DF" />
        <ComponentRef Id="cmpB35A402A2163C959687B4BA4121F079A" />
        <ComponentRef Id="cmp775993523FE108E37468C65AD0ACB4B4" />
        <ComponentRef Id="cmp05F27393E5D1CAA313305B4861210845" />
        <ComponentRef Id="cmp7FF316CEF60AD840CF18827C447F6127" />
        <ComponentRef Id="cmpF6ECEDC852A8809386FCE1F6FD6BF773" />
        <ComponentRef Id="cmp359949C0EE3700CD3FEDC58C2938CA02" />
        <ComponentRef Id="cmpF07C3AB85632B07E2F0F35C8E102F750" />
        <ComponentRef Id="cmp9BF2FC39D1074790EA6D5E031D4E9665" />
        <ComponentRef Id="cmp781555C9539D6B197CC3E2862D633313" />
        <ComponentRef Id="cmpA3348368AD2302BEA9380BFC071D019F" />
        <ComponentRef Id="cmp976CCA18B7D5A52752D172D9F1B353E5" />
        <ComponentRef Id="cmpD67BE195D2659B6309E067CEFCEBA782" />
        <ComponentRef Id="cmpF8865B27ABD17AFD84B4C6DA99BA5982" />
        <ComponentRef Id="cmp9DA6349D71DB330B293596A73268CCA4" />
        <ComponentRef Id="cmpD6C59BB2981DADF2241DC165EDF05FD8" />
        <ComponentRef Id="cmp0B8BBF1185264AB2CE511BAFC03E2F1B" />
    </ComponentGroup>
</Fragment>
</Wix>

I would like to remove the Component Element and related ComponentRef that contains the Source attribute “SourceDir\Program.exe”.

I therefore apply the following XSLT, based on other SO accepted answer:
Removing related elements using XSLT 1.0

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" indent="yes" />

  <xsl:key name="configComponent"
match="Component[File/@Source[substring(., 
           string-length() - string-length('exe') + 1) = 'exe']]"
use="@Id" />

  <xsl:template match="Component[key('configComponent', @Id)]" />

  <xsl:template match="ComponentRef[key('configComponent', @Id)]" />

  <xsl:template match="@*|node()">
<xsl:copy>
  <xsl:apply-templates select="@*|node()"/>
</xsl:copy>
  </xsl:template>
</xsl:stylesheet>

The result is the same original XML with no elements removed.

I am using http://www.xmlper.com/ to test.

Any ideas as to why it is not working?

Regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T23:42:38+00:00Added an answer on May 25, 2026 at 11:42 pm

    I think it’s all about XML namespaces.
    Try the following:

    • add an XML namespace for WiX elements:

    xmlns:wix="http://schemas.microsoft.com/wix/2006/wix"

    • prefix each WiX element in the XSLT stylesheet with wix:, like this:

    <xsl:template match="wix:Component[key('configComponent', @Id)]" />

    I don’t think this is optimal or the “right” way to it, but it works for me 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the following XML file: <?xml version=1.0 encoding=UTF-8?> <process name=TestSVG2 xmlns=http://www.example.org targetNamespace=http://www.example.org xmlns:xsd=http://www.w3.org/2001/XMLSchema> <sequence>
Given the following XML file: <?xml version=1.0 encoding=UTF-8?> <application name=foo> <movie name=tc english=tce.swf chinese=tcc.swf
Given the following XML file: <?xml version=1.0 encoding=UTF-8?> <doc> <head> <title>Introduction</title> <section>section</section> <channel>testing/test</channel> </head>
In Android project's strings.xml file i have following html text <?xml version=1.0 encoding=utf-8?> <resources>
Following is sample XML File - <?xml version=1.0 encoding=UTF-8?> <Catalog> <Book> <AName>Steven Holzner</AName> <BName>Using
Given some sample data.xml file: <?xml version=1.0 encoding=utf-8?> <data> <categories> <category id=google> <name>Google</name> </category>
I have the following Phing configuration file: <?xml version=1.0 encoding=UTF-8?> <project name=ru.fractalizer.phpsweetpdo default=make-phar-packages basedir=..>
i have a XML file as follows: <?xml version=1.0 encoding=utf-8 ?> <publisher> <name>abc</name> <link>http://</link>
Given the following xml fragment: <Problems> <Problem> <File>file1</File> <Description>desc1</Description> </Problem> <Problem> <File>file1</File> <Description>desc2</Description> </Problem>
Given this xml document: <?xml version=1.0 encoding=UTF-8?> <mydoc> <foo f=fooattr> <bar r=barattr1> <baz z=bazattr1>this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.