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

  • Home
  • SEARCH
  • 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 7871997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:04:45+00:00 2026-06-03T02:04:45+00:00

How could I make both templates work in the same XSLT file? Source XML

  • 0

How could I make both templates work in the same XSLT file?

Source XML

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="WixSlave.Binaries">
            <Component Id="cmpA1D1BF677641BE2AE700859D8256B0FC" Guid="{B0BF9CBD-8A5D-43C1-B9DE-0A1B5A6BD1DE}">
                <File Id="filC2827DDF7874712A62423151FBE8CE34" Source="$(var.WixSlave.TargetDir)\WixSlave.exe" />
            </Component>
            <Component Id="cmpBC6AB890535757A915C99A10445CC74E" Guid="{8726FF82-808A-4736-AD0A-C804A34E494B}">
                <File Id="fil7BD5BE5CD71AC92FF47D1D51A99FEE05" Source="$(var.WixSlave.TargetDir)\WixSlave.exe.config" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="WixSlave.Binaries">
            <ComponentRef Id="cmpA1D1BF677641BE2AE700859D8256B0FC" />
            <ComponentRef Id="cmpBC6AB890535757A915C99A10445CC74E" />
        </ComponentGroup>
    </Fragment>
</Wix>

Only Folder Template Produces Desired Output, Registry Template “Ignored”

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:wix="http://schemas.microsoft.com/wix/2006/wi" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <!-- Copy all attributes and elements to the output. -->
    <xsl:template match="@*|*">
        <xsl:copy>
            <xsl:apply-templates select="@*"/>
            <xsl:apply-templates select="*"/>
        </xsl:copy>
    </xsl:template>

    <!-- Folder Template -->
    <xsl:template match="wix:Wix/wix:Fragment/wix:DirectoryRef">
        <DirectoryRef Id="TARGETFOLDER">
            <xsl:copy-of select="*"/>
        </DirectoryRef>
    </xsl:template>

    <!-- Registry Template -->
    <xsl:template match="wix:Wix/wix:Fragment/wix:DirectoryRef/wix:Component">
        <Component>
            <xsl:apply-templates select="@*|*"/>
            <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Name="toBeVariableKey" Type="integer" Value="1" KeyPath="yes"/>
        </Component>
    </xsl:template>
</xsl:stylesheet>

Registry Template Works Fine Without Folder Template

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:wix="http://schemas.microsoft.com/wix/2006/wi" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <!-- Copy all attributes and elements to the output. -->
    <xsl:template match="@*|*">
        <xsl:copy>
            <xsl:apply-templates select="@*"/>
            <xsl:apply-templates select="*"/>
        </xsl:copy>
    </xsl:template>

    <!-- Registry Template -->
    <xsl:template match="wix:Wix/wix:Fragment/wix:DirectoryRef/wix:Component">
        <Component>
            <xsl:apply-templates select="@*|*"/>
            <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Name="toBeVariableKey" Type="integer" Value="1" KeyPath="yes"/>
        </Component>
    </xsl:template>
</xsl:stylesheet>
  • 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-06-03T02:04:47+00:00Added an answer on June 3, 2026 at 2:04 am

    You have to let the chain of template matching continue. Changing the folder template in the following way will get you going:

    <!-- Folder Template -->
    <xsl:template match="wix:Wix/wix:Fragment/wix:DirectoryRef">
        <DirectoryRef Id="TARGETFOLDER">
            <xsl:apply-templates select="*"/>
        </DirectoryRef>
    </xsl:template>
    

    so basically you have to let XSLT know that you need to continue traversing the nodes further down.

    UPDATE: and remove the copy-of instruction if you don’t want the duplication of the Component node

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

Sidebar

Related Questions

It seems that both of them could make the element move from its current
I know you could make a helper pretty easily given the data. So, if
Hey guys I was wondering how I could make the title of my website
In C# I sometimes wish I could make special methods for certain instantiations of
Is there a python lib that could make a 2-dimensional list of (R,G,B) data
I am curious how I could make a PHP script where you pass your
Ages ago when I was a java developer I could make separate ant scripts
Ok guys, I started to learn more about Jquery and now I could make
How could I make a UIImage move from the bottom of the screen, to
I know I could just make all the Mix_Musics public, and not worry about

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.