eelou
asked on
How to find and change a registry value in WIX using XSL
This is the xml...
I have already modified a number of values using xsl, here is part of that...
What I want to do now is change "Value="[#fil4E063919C21DF FABD05CADC 857B9D549] " (the fourth RegistryValue down), to Value="[#filfil123321]" , to agree with the file id of above (which I will provide in the replace statement)
I have started the xsl:template match, but do not know how to search\get to, that particular value, and replace it.
Please give me the exact code, please do not point me to something that might help. I have done searches, and have not found what I am looking for.
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment><DirectoryRef Id="InstallDirx64" /></Fragment>
<Fragment><ComponentGroup Id="LouComponentx64"><Component Directory="InstallDirx64" Id="cmp123321" Guid="{0B7441C0-A876-41BA-87C9-077CED712FAA}" Win64="yes">
<Condition>VersionNT64</Condition>
<File KeyPath="yes" Source="$(var.louDLL.TargetDir)\louDLL.dll" Id="fil123321">
<TypeLib Id="{90BB27B2-9EB2-4B8D-930F-58B7F74D686E}" Description="louDLLLib" HelpDirectory="InstallDirx64" Language="0" MajorVersion="1" MinorVersion="0"><Class Id="{246FDA8F-F37B-4CD7-B580-D2A0931B16F6}" Context="InprocServer32" Description="lou Class" ThreadingModel="apartment" Version="1.0" Programmable="yes" Control="yes"><ProgId Id="lou.1" Description="lou Class"><ProgId Id="lou" Description="lou Class" /></ProgId></Class><Interface Id="{51154861-52EE-40AA-96B0-5DF53324E7F8}" Name="IShareImage" ProxyStubClassId32="{00020424-0000-0000-C000-000000000046}" /><Interface Id="{8FE4941F-EE44-4389-A083-344B392FE2FF}" Name="Ilou" ProxyStubClassId32="{00020424-0000-0000-C000-000000000046}" /></TypeLib>
</File>
<RegistryValue Root="HKCR" Key="*\ShellEx\ContextMenuHandlers\lou" Value="{246FDA8F-F37B-4CD7-B580-D2A0931B16F6}" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{246FDA8F-F37B-4CD7-B580-D2A0931B16F6}\MiscStatus\1" Value="132497" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{246FDA8F-F37B-4CD7-B580-D2A0931B16F6}\MiscStatus" Value="0" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{246FDA8F-F37B-4CD7-B580-D2A0931B16F6}\ToolboxBitmap32" Value="[#fil4E063919C21DFFABD05CADC857B9D549], 106" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\Explorer" Name="GlobalAssocChangedCounter" Value="1" Type="integer" Action="write" />
</Component></ComponentGroup></Fragment>
</Wix>
I have already modified a number of values using xsl, here is part of that...
<xsl:template match="wix:Component">
<xsl:copy>
<xsl:apply-templates select="@*" />
<!-- Adding the Win64-attribute as we have a x64 application -->
<xsl:attribute name="Id">
<xsl:text>cmp123321</xsl:text>
</xsl:attribute>
<xsl:attribute name="Guid">
<xsl:text>{0B7441C0-A666-41BA-87C9-098CED712FAA}</xsl:text>
</xsl:attribute>
<xsl:attribute name="Win64">yes</xsl:attribute>
<xsl:text>
</xsl:text>
<xsl:element name="Condition">VersionNT64</xsl:element>
<!-- Now take the rest of the inner tag -->
<xsl:apply-templates select="node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="wix:File">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:attribute name="Id">
<xsl:text>fil123321</xsl:text>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="wix:RegistryValue">
<xsl:copy>
</xsl:copy>
</xsl:template>
What I want to do now is change "Value="[#fil4E063919C21DF
I have started the xsl:template match, but do not know how to search\get to, that particular value, and replace it.
Please give me the exact code, please do not point me to something that might help. I have done searches, and have not found what I am looking for.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am fairly new to XML and XSL, I am missing something here.
I added the xpath-function...
I added the xpath-function...
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"
xmlns="http://schemas.microsoft.com/wix/2006/wi"
exclude-result-prefixes="wix">
Now I get Heat error, "error applying transform...Cannot find a script or an extension object associated with namespace 'http://www.w3.org/2005/xpath-functions'"
ASKER
Could not use that code, removed the xpath-functions, had to do this...
<xsl:template match="wix:RegistryValue[substring(@Value, 1, 5) = '[#fil' ]">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:attribute name="Value">[#fil123321]</xsl:attribute>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
Now I get Heat error, "error applying transform...Cannot find a script or an extension object associated with namespace 'http://www.w3.org/2005/xpath-functions'Unfortunately, I don't know anything about Heat in particular so I can't help there, other than to say that some processors MAY let you leave off the fn: prefix on the starts-with function and then you can omit the xmlns:fn declaration.
However, if you are able to use the substring method without qualifying it (which makes me think that you can do the same with starts-with) then you should still be able to do it much like the first post that I gave, ie...
<xsl:template match="wix:RegistryValue/@Value[substring(., 1, 5) = '[#fil']">
<xsl:attribute name="Value">[#fil123321]</xsl:attribute>
</xsl:template>
ASKER
WIX does not work with 2.0 yet. That is why your code does not work.
ASKER
Could not use the code provided.
ASKER