<xsl:template match="wix:Package"> Will match the Package element itself. You'll need to copy the element, *then* add the attribute to the copied element.
<xsl:template match="wix:Package"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:attribute name="Id">$(var.PackageId)</xsl:attribute> </xsl:copy> </xsl:template> A couple of comments: 1.) Consider reading Learning XSLT and XSLT Cookbook. Great books! 2.) Consider *not* setting Package/@Id. You should let WiX generate a new Package/@Id on every build of your package as per the Windows Installer documentation. Edwin G. Castro Software Developer - Staff Electronic Banking Services Fiserv Office: 503-746-0643 Fax: 503-617-0291 www.fiserv.com Please consider the environment before printing this e-mail > -----Original Message----- > From: sangeeta1 [mailto:snmsn...@gmail.com] > Sent: Friday, December 10, 2010 10:18 AM > To: wix-users@lists.sourceforge.net > Subject: Re: [WiX-users] Heat.exe - How to pass Product Manufacturer, > Name, Title, version > > > The Wix schema does not let me add a attribute to Package though. I want to > assign a package Id to the msi. > > <xsl:template match="wix:Package"> > <xsl:attribute name="Id">$(var.PackageId)</xsl:attribute> > </xsl:template> > > With you example, I am able to edit the Product name. thanks. > <xsl:template match="wix:Product/@Name"> > <xsl:attribute name="Name">$(var.ProductNameName)</xsl:attribute> > </xsl:template> > > > > On Fri, Dec 10, 2010 at 12:55 PM, Blair-2 [via Windows Installer XML (WiX) > toolset] <ml-node+5824029-456030519-306...@n2.nabble.com<ml- > node%2b5824029-456030519-306...@n2.nabble.com> > > wrote: > > > Add xmlns:wix="http://schemas.microsoft.com/wix/2006/wi" in the root > > element of your XSLT and change your template to: > > > > <xsl:template match="wix:packa...@name"> > > <xsl:attribute name="Name">$(var.ProductName)</xsl:attribute> > > </xsl:template> > > > > > > -----Original Message----- > > From: sangeeta1 [mailto:[hidden > > email]<http://user/SendEmail.jtp?type=node&node=5824029&i=0>] > > > > Sent: Friday, December 10, 2010 9:38 AM > > To: [hidden email] > > <http://user/SendEmail.jtp?type=node&node=5824029&i=1> > > Subject: Re: [WiX-users] Heat.exe - How to pass Product Manufacturer, > > Name, Title, version > > > > > > Thanks a lot for these details! > > > > Taking your Manufacturer xsl as a baseline example, I tried to replace > > the Name attribute in <Product> but really made no progress. I got > > this crappy code to work, but would like something like this. > > > > <xsl:template match="packa...@name"> > > <xsl:attribute name="Name">$(var.ProductName)</xsl:attribute> > > </xsl:template> > > > > > > I got this to work, but I do not like checking for 'PUT-PRODUCT-NAME- > HERE' > > constant. > > <xsl:template match="@Name[.='PUT-PRODUCT-NAME-HERE']"> > > <xsl:attribute name="Name">$(var.ProductName)</xsl:attribute> > > </xsl:template> > > > > > > Also, I want to insert an attribute in the <Package> element, and this > > code > > > > again does not work. > > <xsl:template match="Package"> > > <xsl:attribute name="Id">$(var.PackageId)</xsl:attribute> > > </xsl:template> > > > > Any idea what I am missing here? I should confess, this is the first > > time I > > > > am writing an Xsl transform. > > > > thanks, > > sangeeta > > > > > > > > > > > > On Thu, Dec 9, 2010 at 2:00 PM, Edwin G. Castro [via Windows Installer > > XML > > (WiX) toolset] <[hidden > > email]<http://user/SendEmail.jtp?type=node&node=5824029&i=2> > > <[hidden email] > > <http://user/SendEmail.jtp?type=node&node=5824029&i=3>> > > > wrote: > > > > > Here are your options: > > > > > > 1.) Use a XLST transform to change the generated wxs > > > 2.) Use -var to specify a preprocessor variable (such as > > > var.MySource) > > and > > > specify the value for MySource on the command line to candle.exe > > > (see the > > -d > > > switch) > > > 3.) Specify a base path when calling light.exe (see the -b switch) > > > > > > Option three is interesting because you don't use the -var parameter > > > to heat.exe at all. Instead you tell light.exe to use one or more > > > base paths > > as > > > the roots to look for files (you can specify more than one). > > > > > > Edwin G. Castro > > > Software Developer - Staff > > > Electronic Banking Services > > > Fiserv > > > Office: 503-746-0643 > > > Fax: 503-617-0291 > > > www.fiserv.com > > > P Please consider the environment before printing this e-mail > > > > > > > -----Original Message----- > > > > From: sangeeta1 [mailto:[hidden email]< > > http://user/SendEmail.jtp?type=node&node=5820142&i=0>] > > > > > > > Sent: Wednesday, December 08, 2010 8:47 PM > > > > To: [hidden email]< > > http://user/SendEmail.jtp?type=node&node=5820142&i=1> > > > > Subject: Re: [WiX-users] Heat.exe - How to pass Product > > > > Manufacturer, Name, Title, version > > > > > > > > > > > > After trying out an example, I see the significance of the -var > > variable. > > > > > > > > > > > Regarding you example in using -var > > > > > > > > How can I replace the value of "Source" to a physical path of > > > > the > > root > > > folder > > > > (like c:\temp\test) without having to use a wix variable var.MySource? > > I > > > am > > > > automating the generation of msi given a set of installable files. > > > > I > > will > > > be > > > > invoking these commands from .net program. > > > > > > > > many thanks for your help on this.. > > > > > > > > > > > > On Wed, Dec 8, 2010 at 5:01 PM, Edwin G. Castro [via Windows > > > > Installer > > > XML > > > > (WiX) toolset] <[hidden email]< > > http://user/SendEmail.jtp?type=node&node=5820142&i=2><ml- > > > > > > > [hidden email] > > > > <http://user/SendEmail.jtp?type=node&node=5820142&i=3>> > > > > > > > wrote: > > > > > > > > > Heat does not generate a <Product/> element. > > > > > > > > > > Heat /? shows the following documentation for -var: > > > > > > > > > > -var <VariableName> substitute File/@Source="SourceDir" with > > > > > a preprocessor or a wix variable (e.g. -var var.MySource will > > > > > become File/@Source="$(var.MySource)\myfile.txt" and -var > > > > > wix.MySource will become > File/@Source="!(wix.MySource)\myfile.txt" > > > > > > > > > > This does text transformation on the generated output wxs file. > > > > > I created an empty text file called test.txt and used the > > > > > following command line to harvest it using heat.exe: > > > > > > > > > > heat file test.txt -out test.wxs > > > > > > > > > > Here are the contents of test.wxs: > > > > > > > > > > <?xml version="1.0" encoding="utf-8"?> <Wix > > > > > xmlns="http://schemas.microsoft.com/wix/2006/wi"> > > > > > <Fragment> > > > > > <DirectoryRef Id="TARGETDIR"> > > > > > <Directory Id="dir22FE4E6795D49A83D8CC3F97AEACA344" > > > > Name="code" > > > > > /> > > > > > </DirectoryRef> > > > > > </Fragment> > > > > > <Fragment> > > > > > <DirectoryRef Id="dir22FE4E6795D49A83D8CC3F97AEACA344"> > > > > > <Component Id="cmp5BA64E6B74419477D4B75A1E802397FC" > > > > > Guid="PUT-GUID-HERE"> > > > > > <File Id="fil67D465DE6C69EA3B3CD0B7487E6132B6" > > > > > KeyPath="yes" Source="SourceDir\code\test.txt" /> > > > > > </Component> > > > > > </DirectoryRef> > > > > > </Fragment> > > > > > </Wix> > > > > > > > > > > Notice that File/@Source="SourceDir\code\test.txt" > > > > > > > > > > If use -var like this: > > > > > > > > > > heat file test.txt -out test.wxs -var var.CodeDir > > > > > > > > > > Then I get this: > > > > > > > > > > <?xml version="1.0" encoding="utf-8"?> <Wix > > > > > xmlns="http://schemas.microsoft.com/wix/2006/wi"> > > > > > <Fragment> > > > > > <DirectoryRef Id="TARGETDIR"> > > > > > <Directory Id="dir22FE4E6795D49A83D8CC3F97AEACA344" > > > > Name="code" > > > > > /> > > > > > </DirectoryRef> > > > > > </Fragment> > > > > > <Fragment> > > > > > <DirectoryRef Id="dir22FE4E6795D49A83D8CC3F97AEACA344"> > > > > > <Component Id="cmp5BA64E6B74419477D4B75A1E802397FC" > > > > > Guid="PUT-GUID-HERE"> > > > > > <File Id="fil67D465DE6C69EA3B3CD0B7487E6132B6" > > > > > KeyPath="yes" Source="$(var.CodeDir)\code\test.txt" /> > > > > > </Component> > > > > > </DirectoryRef> > > > > > </Fragment> > > > > > </Wix> > > > > > > > > > > Notice that File/@Source="$(var.CodeDir)\code\test.txt" just > > > > > like the > > > > > > > documentation says. > > > > > > > > > > In a <Product/> element is *not* generated in either example. > > > > > > > > > > Edwin G. Castro > > > > > Software Developer - Staff > > > > > Electronic Banking Services > > > > > Fiserv > > > > > Office: 503-746-0643 > > > > > Fax: 503-617-0291 > > > > > www.fiserv.com > > > > > P Please consider the environment before printing this e-mail > > > > > > > > > > > > > > > > -----Original Message----- > > > > > > From: sangeeta1 [mailto:[hidden > > > > > > > email]<http://user/SendEmail.jtp?type=node&node=5816953&i=0>] > > > > > > > > > > > Sent: Wednesday, December 08, 2010 12:25 PM > > > > > > To: [hidden > > > > > > > email]<http://user/SendEmail.jtp?type=node&node=5816953&i=1> > > > > > > Subject: [WiX-users] Heat.exe - How to pass Product > > > > > > Manufacturer, Name, Title, version > > > > > > > > > > > > > > > > > > Hi all, > > > > > > > > > > > > I am trying to generate a wxs source file using Heat.exe > > > > > > and wanted to > > > > > > > > > > > check if I can pass values for Manufacturer, Name, Title and > > version > > > > > > to heat.exe? I tried using -var argument, but does nt seem to > > update > > > > > > it to > > > > > the > > > > > > source file > > > > > > > > > > > > heat.exe dir c:\temp\Configuration\Files -ag -cg MyComp -ag > > > > > > -gg -g1 > > > > > > > > -ke > > > > > -var > > > > > > Product/@Manufacturer=" <Product/@Manufacturer=%22>ABCD" > - > > > > template > > > > > > product -out c:\temp\Configuration\wixauto\mainsource.wxs > > > > > > > > > > > > > > > > > > thanks! > > > > > > > > > > > > -- > > > > -- > View this message in context: http://windows-installer-xml-wix- > toolset.687559.n2.nabble.com/Heat-exe-How-to-pass-Product- > Manufacturer-Name-Title-version-tp5816654p5824105.html > Sent from the wix-users mailing list archive at Nabble.com. > ------------------------------------------------------------------------------ > Oracle to DB2 Conversion Guide: Learn learn about native support for > PL/SQL, new data types, scalar functions, improved concurrency, built-in > packages, OCI, SQL*Plus, data movement tools, best practices and more. > http://p.sf.net/sfu/oracle-sfdev2dev > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL, new data types, scalar functions, improved concurrency, built-in packages, OCI, SQL*Plus, data movement tools, best practices and more. http://p.sf.net/sfu/oracle-sfdev2dev _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users