gagidlof February 2016

WiX WSLT transform to remove an attribute from a .wsx file

Another transform noob question: I am trying to come up with a transform that will remove an attribute from a Heated .wxs file.

Heat is generating the Class Attribute 'RelativePath="yes" which is throwing an error in the compiler. The attribute isn't necessary in our case. And just changing it to "no" does not get rid of the error. What I would like to do is run a transform to remove the attribute.

The current output file looks like:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="SystemFolder">
            <Component Id="todgub7.dll" Guid="{4DEBD59A-D93A-43CC-AD8A-2198E1C308F7}" Permanent="yes">
                <File Id="todgub7.dll" KeyPath="yes" Source="$(var.OC2.WinSys32)\todgub7.dll">
                    <Class Id="{359AA0C1-DDF8-49DB-83FF-6184706A9106}" Context="InprocServer32" Description="ComponentOneUnboundDataSource" RelativePath="yes" ThreadingModel="apartment">
                        <ProgId Id="ComponentOneUnboundDataSource" Description="ComponentOne OLE DB Data Source for Unbound Mode" />
                    </Class>
                </File>
                <RegistryValue Root="HKCR" Key="CLSID\{359AA0C1-DDF8-49db-83FF-6184706A9106}\RefCount" Value="1" Type="string" Action="write" />
            </Component>
        </DirectoryRef>
    </Fragment>
</Wix>

I am hoping to get:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="SystemFolder">
            <Component Id="todgub7.dll" Guid="{4DEBD59A-D93A-43CC-AD8A-2198E1C308F7}" Permanent="yes">
                <File Id="todgub7.dll" KeyPath="yes" Source="$(var.OC2.WinSys32)\todgub7.dll">
                    <Class Id="{359AA0C1-DDF8-49DB-83FF        

Answers


Elliotte Rusty Harold February 2016

Add this template to your stylesheet:

 <xsl:template match="@RelativePath"></xsl:template>

Since it's more specific, it will take precendence over the other template that copies attributes not named RelativePath.

Post Status

Asked in February 2016
Viewed 2,426 times
Voted 12
Answered 1 times

Search




Leave an answer