Here's a little diddy I wrote up for the JDK.  Some minor modifications will be 
required.  There are two files
JDK.HeatTx.xsl
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:wix="http://schemas.microsoft.com/wix/2006/wi";>
  <xsl:import href="JDK.HeatTx.base.xsl" />
  <xsl:variable name="platform">x64</xsl:variable>
  <xsl:variable name="javaRuntimeSubfoldername">jdk1.7.0_21</xsl:variable>
  <xsl:variable name="installerCabDiskId">$(var.JDKDiskId)</xsl:variable>
</xsl:stylesheet>

JDK.HeatTx.base.xsl
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0"
    xmlns="http://schemas.microsoft.com/wix/2006/wi";
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:wix="http://schemas.microsoft.com/wix/2006/wi";>

  <xsl:output method="xml" indent="yes" />
  <xsl:strip-space elements="*"/>

  <xsl:variable name="platform">TEST</xsl:variable>
  <xsl:variable name="javaRuntimeSubfoldername">TEST</xsl:variable>
  <xsl:variable name="installerCabDiskId">TEST</xsl:variable>
  
  <xsl:template match="wix:Wix">
    <Wix>
      
<xsl:comment>*********************************************************************************************************************************************************************</xsl:comment>
      
<xsl:comment>*********************************************************************************************************************************************************************</xsl:comment>
      
<xsl:comment>*********************************************************************************************************************************************************************</xsl:comment>
      <xsl:comment>This code is AUTO-GENERATED by a combination of HEAT.EXE and 
the JDK.HeatTx.<xsl:value-of select="$platform" />.xsl file that should be 
RIGHT BESIDE THE FILE YOU ARE LOOKING AT IN VISUAL STUDIO!!!!</xsl:comment>
      
<xsl:comment>*********************************************************************************************************************************************************************</xsl:comment>
      
<xsl:comment>*********************************************************************************************************************************************************************</xsl:comment>
      
<xsl:comment>*********************************************************************************************************************************************************************</xsl:comment>

      <xsl:processing-instruction 
name="include">"$(var.SolutionDir)Variables.wxi"</xsl:processing-instruction>
      <xsl:processing-instruction 
name="define">Libraries_JDK="$(var.MyAppLibraries)MyApp/JDK/server-jre-windows-<xsl:value-of
 select="$platform" />/<xsl:value-of select="$javaRuntimeSubfoldername" 
/>/"</xsl:processing-instruction>
      <xsl:apply-templates select="wix:Fragment" />
    </Wix>
  </xsl:template>

  <xsl:template match="wix:Wix/wix:Fragment" name="Fragments">
    <Fragment>
      <xsl:apply-templates />
    </Fragment>
  </xsl:template>

  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="node()|@*" name="all">
    <xsl:copy>
      <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="wix:Wix/wix:Fragment/wix:ComponentGroup/wix:Component" 
name="Component">    
    <xsl:element name="Component">
      <xsl:attribute name="Id">
        <xsl:value-of select="./@Id"/>
      </xsl:attribute>
      <xsl:attribute name="Directory">
        <xsl:value-of select="./@Directory"/>
      </xsl:attribute>
      <xsl:attribute name="Guid">
        <xsl:value-of select="./@Guid"/>      
      </xsl:attribute>
      <xsl:attribute name="DiskId">
        <xsl:value-of select="$installerCabDiskId"/>
      </xsl:attribute>
      <xsl:apply-templates select="@*|node()" />
    </xsl:element>  
  </xsl:template>
</xsl:stylesheet>


At the end, it should spit out something like this:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"; 
xmlns:wix="http://schemas.microsoft.com/wix/2006/wi";>
    
<!--*********************************************************************************************************************************************************************-->
    
<!--*********************************************************************************************************************************************************************-->
    
<!--*********************************************************************************************************************************************************************-->
    <!--This code is AUTO-GENERATED by a combination of HEAT.EXE and the 
JDK.HeatTx.x64.xsl file that should be RIGHT BESIDE THE FILE YOU ARE LOOKING AT 
IN VISUAL STUDIO!!!!-->
    
<!--*********************************************************************************************************************************************************************-->
    
<!--*********************************************************************************************************************************************************************-->
    
<!--*********************************************************************************************************************************************************************-->
    <?include "$(var.SolutionDir)Variables.wxi"?>
    <?define 
Libraries_JDK="$(var.MyAppLibraries)MyApp/JDK/server-jre-windows-x64/jdk/"?>
    <Fragment>
        <DirectoryRef Id="MyApp">
            <Directory Id="dir95AC25F4E65F03DE47DE26C8B2E217CF" Name="jdk" />
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="MyApp_JDK_ComponentGroup_x64">
            <Component DiskId="$(var. JDKDiskId)" 
Id="cmp5E4BC60B4627CBFFB31BEF3BF5D64E49" 
Directory="dir95AC25F4E65F03DE47DE26C8B2E217CF" Guid="*">
                <File Id="fil9EEF26BA97CBA9D289CA709452C332A1" KeyPath="yes" 
Source="$(var.Libraries_JDK)\COPYRIGHT" />
            </Component>
            <Component DiskId="$(var.JDKDiskId)" 
Id="cmp63F661747E5E3AE4208F291DFD10F3F6" 
Directory="dir95AC25F4E65F03DE47DE26C8B2E217CF" Guid="*">
                <File Id="fil53990C4DA6281F0039F8C5D85DCE6816" KeyPath="yes" 
Source="$(var.Libraries_JDK)\LICENSE" />
            </Component>
            <Component DiskId="$(var. JDKDiskId)" 
Id="cmpCCCD5EE2E5BFE492F12A897DE132948D" 
Directory="dir95AC25F4E65F03DE47DE26C8B2E217CF" Guid="*">
                <File Id="fil0B049DB1ED1E694E2827E3260353211C" KeyPath="yes" 
Source="$(var.Libraries_JDK)\README.html" />
            </Component>
            <Component DiskId="$(var. JDKDiskId)" 
Id="cmp6289786096EA4753B4A718557511508F" 
Directory="dir95AC25F4E65F03DE47DE26C8B2E217CF" Guid="*">
                <File Id="fil82AA801324D7AF3A0D6F7CADC8956203" KeyPath="yes" 
Source="$(var.Libraries_JDK)\release" />
            </Component>
.....
</ComponentGroup>
</Fragment>
<Fragment>
<DirectoryRef Id="dirD341AAE8DDEAEC083E4E1B691639200F">
            <Directory Id="dir0163A350E6BAD55214CB47F2E2B6F5E7" 
Name="update_tracking" />
        </DirectoryRef>
</Fragment>
<Fragment>...
...
</Wix>

In a static wxs file include the ComponentGroupRef.  I have one that looks like 
this:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";>
  <Fragment Id="F.CG.JDK.ComponentGroups">
    <ComponentGroup Id=" JDK.Decision">
      <?if $(var.Platform)=x64?>
        <ComponentGroupRef Id="MyApp_ JDK_ComponentGroup_x64"/>
      <?else?>
        <ComponentGroupRef Id="MyApp_JDK_ComponentGroup_x86"/>
      <?endif?>
    </ComponentGroup>
  </Fragment>
</Wix>

I have a "stub" file checked in and I generate the contents of the dynamic wxs 
files every time but that is personal preference.

Finally, bringing it all together, here is my "BeforeBuild" target in my 
.wixproj.  This assumes that the JDK zip/tar has been decompressed to the 
appropriate folder.
<Target Name="BeforeBuild">
        <Exec Command="attrib -r &quot;./Generated/*.*&quot;"/>
        <Exec Command="attrib -r &quot;./*.HeatTx.xsl&quot;"/>
        
        <XmlPoke Namespaces="&lt;Namespace Prefix='xsl' 
Uri='http://www.w3.org/1999/XSL/Transform' /&gt;&lt;Namespace Prefix='wix' 
Uri='http://schemas.microsoft.com/wix/2006/wi' /&gt;"
                Query="/xsl:stylesheet/xsl:variable[@name='platform']" 
Value="x86" XmlInputPath="JDK.HeatTx.xsl" />
                
        <XmlPoke Namespaces="&lt;Namespace Prefix='xsl' 
Uri='http://www.w3.org/1999/XSL/Transform' /&gt;&lt;Namespace Prefix='wix' 
Uri='http://schemas.microsoft.com/wix/2006/wi' /&gt;"
                
Query="/xsl:stylesheet/xsl:variable[@name='javaRuntimeSubfoldername']" 
Value="jre1.7.0_21" XmlInputPath="JDK.HeatTx.xsl" />
                
        <HeatDirectory
                NoLogo="true"
                SuppressAllWarnings="false"
                SuppressSpecificWarnings=""
                ToolPath="$(WixToolPath)"
                TreatWarningsAsErrors="false"
                TreatSpecificWarningsAsErrors=""
                VerboseOutput="true"
                AutogenerateGuids="true"
                GenerateGuidsNow="true"
                OutputFile="./Generated/JDK.x86.wxs"
                SuppressFragments="false"
                SuppressUniqueIds="false"
                Transforms="JDK.HeatTx.xsl"
                
Directory="../../../Libraries/JDK/server-jre-windows-x86/jre1.7.0_21"
                ComponentGroupName="MyApp_JDK_ComponentGroup_x86"
                DirectoryRefId="DWS"
                KeepEmptyDirectories="false"
                PreprocessorVariable="var.Libraries_JDK"
                SuppressCom="true"
                SuppressRootDirectory="false"
                SuppressRegistry="true" />
                
        <XmlPoke Namespaces="&lt;Namespace Prefix='xsl' 
Uri='http://www.w3.org/1999/XSL/Transform' /&gt;&lt;Namespace Prefix='wix' 
Uri='http://schemas.microsoft.com/wix/2006/wi' /&gt;"
                Query="/xsl:stylesheet/xsl:variable[@name='platform']" 
Value="x64" XmlInputPath="JDK.HeatTx.xsl" />
                
        <XmlPoke Namespaces="&lt;Namespace Prefix='xsl' 
Uri='http://www.w3.org/1999/XSL/Transform' /&gt;&lt;Namespace Prefix='wix' 
Uri='http://schemas.microsoft.com/wix/2006/wi' /&gt;"
                
Query="/xsl:stylesheet/xsl:variable[@name='javaRuntimeSubfoldername']" 
Value="jdk1.7.0_21" XmlInputPath="JDK.HeatTx.xsl" />
                
        <HeatDirectory
                NoLogo="true"
                SuppressAllWarnings="false"
                SuppressSpecificWarnings=""
                ToolPath="$(WixToolPath)"
                TreatWarningsAsErrors="false"
                TreatSpecificWarningsAsErrors=""
                VerboseOutput="true"
                AutogenerateGuids="true"
                GenerateGuidsNow="true"
                OutputFile="./Generated/JDK.x64.wxs"
                SuppressFragments="false"
                SuppressUniqueIds="false"
                Transforms="JDK.HeatTx.xsl"
                
Directory="../../../Libraries/JDK/server-jre-windows-x64/jdk1.7.0_21"
                ComponentGroupName="MyApp_JDK_ComponentGroup_x64"
                DirectoryRefId="DWS"
                KeepEmptyDirectories="false"
                PreprocessorVariable="var.Libraries_JDK"
                SuppressCom="true"
                SuppressRootDirectory="false"
                SuppressRegistry="true" />
                
        <XmlPoke Namespaces="&lt;Namespace Prefix='xsl' 
Uri='http://www.w3.org/1999/XSL/Transform' /&gt;&lt;Namespace Prefix='wix' 
Uri='http://schemas.microsoft.com/wix/2006/wi' /&gt;"
                Query="/xsl:stylesheet/xsl:variable[@name='platform']" 
Value="x86" XmlInputPath="Tomcat.HeatTx.xsl" />
                
        <HeatDirectory
                NoLogo="true"
                SuppressAllWarnings="false"
                SuppressSpecificWarnings=""
                ToolPath="$(WixToolPath)"
                TreatWarningsAsErrors="false"
                TreatSpecificWarningsAsErrors=""
                VerboseOutput="true"
                AutogenerateGuids="true"
                GenerateGuidsNow="true"
                OutputFile="./Generated/Tomcat.x86.wxs"
                SuppressFragments="false"
                SuppressUniqueIds="false"
                Transforms="Tomcat.HeatTx.xsl"
                
Directory="../../../Libraries/Tomcat/apache-tomcat-7.0.39-windows-x86\apache-tomcat-7.0.39"
                ComponentGroupName="MyApp_Tomcat_ComponentGroup"
                DirectoryRefId="DWS"
                KeepEmptyDirectories="false"
                PreprocessorVariable="var.Libraries_Tomcat"
                SuppressCom="true"
                SuppressRootDirectory="false"
                SuppressRegistry="true" />
                
        <XmlPoke Namespaces="&lt;Namespace Prefix='xsl' 
Uri='http://www.w3.org/1999/XSL/Transform' /&gt;&lt;Namespace Prefix='wix' 
Uri='http://schemas.microsoft.com/wix/2006/wi' /&gt;"
                Query="/xsl:stylesheet/xsl:variable[@name='platform']" 
Value="x64" XmlInputPath="Tomcat.HeatTx.xsl" />

        <HeatDirectory
                NoLogo="true"
                SuppressAllWarnings="false"
                SuppressSpecificWarnings=""
                ToolPath="$(WixToolPath)"
                TreatWarningsAsErrors="false"
                TreatSpecificWarningsAsErrors=""
                VerboseOutput="true"
                AutogenerateGuids="true"
                GenerateGuidsNow="true"
                OutputFile="./Generated/Tomcat.x64.wxs"
                SuppressFragments="false"
                SuppressUniqueIds="false"
                Transforms="Tomcat.HeatTx.xsl"
                
Directory="../../../Libraries/Tomcat/apache-tomcat-7.0.39-windows-x64\apache-tomcat-7.0.39"
                ComponentGroupName="MyApp_Tomcat_ComponentGroup"
                DirectoryRefId="DWS"
                KeepEmptyDirectories="false"
                PreprocessorVariable="var.Libraries_Tomcat"
                SuppressCom="true"
                SuppressRootDirectory="false"
                SuppressRegistry="true" />      
  </Target>


-----Original Message-----
From: Pally Sandher [mailto:pally.sand...@iesve.com] 
Sent: January-27-15 10:19 AM
To: General discussion about the WiX toolset.
Subject: Re: [WiX-users] Adjusting result of heat.exe?

See http://wixtoolset.org/documentation/manual/v3/overview/heat.html
The -t parameter allows you apply an XSLT to post-process the generated XML.

Palbinder Sandher
Software Platform Engineer 
T:   +44 (0)141 945 8500
F:   +44 (0)141 945 8501
http://www.iesve.com 

Integrated Environmental Solutions Limited. Registered in Scotland No. SC151456 
Registered Office - Helix Building, West Of Scotland Science Park, Glasgow G20 
0SP Email Disclaimer 



-----Original Message-----
From: sky [mailto:volon...@gmail.com]
Sent: 27 January 2015 08:32
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Adjusting result of heat.exe?

Hi. Is there any way to get .wxs file formed like the following using heat.exe?

<?xml ...>
<Wix ...>
  <Fragment>
    <DirectoryRef Id="INSTALLFOLDER">
      <Directory Id="a">
        <Directory Id="b" />
        <Directory Id="c">
          <Directory Id="d" />
        </Directory>
      </Directory>
    </DirectoryRef>
  </Fragment>
  <Fragment>
    <ComponentGroup Id="CG">
      <Component Id="..." Guid="..." Directory="a">
        <File ... />
      </Component>
      <Component Id="..." Guid="..." Directory="b">
        <File ... />
      </Component>
      <Component Id="..." Guid="..." Directory="b">
        <File ... />
      </Component>
      <Component Id="..." Guid="..." Directory="c">
        <File ... />
      </Component>
      <Component Id="..." Guid="..." Directory="d">
        <File ... />
      </Component>
      <Component Id="..." Guid="..." Directory="d">
        <File ... />
      </Component>
      <Component Id="..." Guid="..." Directory="d">
        <File ... />
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>

I want to harvest files in ComponentGroup basis. I've tried some combinations 
of heat.exe options, but couldn't get the result like above.

Thanks.



--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Adjusting-result-of-heat-exe-tp7599018.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website, sponsored 
by Intel and developed in partnership with Slashdot Media, is your hub for all 
things parallel software development, from weekly thought leadership blogs to 
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website, sponsored 
by Intel and developed in partnership with Slashdot Media, is your hub for all 
things parallel software development, from weekly thought leadership blogs to 
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to