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 7888357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:48:43+00:00 2026-06-03T05:48:43+00:00

How to extract File -> Source value and assign it as RegistryValue -> Name

  • 0
  • How to extract File -> Source value
  • and assign it as RegistryValue -> Name, where RegistryValue is injected as a new element with the XSLT provided?

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>

XSLT Working Without Variable Name Attribute Value

<?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>
    <xsl:template match="wix:Wix/wix:Fragment/wix:DirectoryRef/wix:Component">
        <Component>
            <xsl:apply-templates select="@*|*"/>
            <RegistryValue Name="toBeVariableKey" Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="integer" Value="1" KeyPath="yes"/>
        </Component>
    </xsl:template>
</xsl:stylesheet>
  • To be more specific I would like to read the File element attribute Source="$(var.WixSlave.TargetDir)\WixSlave.exe" and then transform it to just WixSlaveexe i.e. extract from the source string only letters (a-z, A-Z), starting after last slash
  • And then assign that string to the RegistryValue element Name attribute, which in the sample is Name="toBeVariableKey", but should become Name="WixSlaveexe" for the first Component

  • For the second Component it should be reading from File Source="$(var.WixSlave.TargetDir)\WixSlave.exe.config" and adding RegistryValue with Name="WixSlaveexeconfig", and so on…

  • 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-03T05:48:45+00:00Added an answer on June 3, 2026 at 5:48 am

    You can use an attribute value template to set the Name

    <RegistryValue Name="{substring-after(wix:File/@Source, '\')}" />
    

    This should extract the sub-string after the first slash, and assign the result to the attribute name.

    To remove any dots from the text, you can use the translate function, like so

    <RegistryValue Name="{translate(substring-after(wix:File/@Source, '\'), '.', '')}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My XML File is stored in oracle column <?xml version=1.0 encoding=UTF-8?> <BasicProductTemplateType xmlns=http://www.asia.com/app/Product_2_0 xmlns:jBos_Common_1_0=http://www.asia.com/jBos/Common_1_0>
Is there a way to extract the file name from the file full path
I want to extract just the file name portion of a path. My code
I am trying to get an attribute value from an XML file, but my
I need to programmatically extract method definition/implementation from Java source file, could you recommend
A third party source daily FTPs a zip file (which contains xml file) in
I need to extract the names of functions defined in a C source file
I've got bytes array in database. How to extract file extension (mime/type) from byte
How can i extract bz2 file in Java on Android? Are any included libraries
Is it possible to extract a single file or diff of a file from

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.