Have you tried: <xsl:template match="wix:Directory[not(contains(*/@Source, '.pdb'))]" />
-----Original Message----- From: Naim Kingston [mailto:naim.kings...@ancamotion.com] Sent: 03 August 2012 01:55 To: General discussion for Windows Installer XML toolset. Subject: [WiX-users] heat and xslt transform to keep only pdb files I'm using heat to try and harvest a directory of all the pdb files. I know that there is an option for heat to look into the vcproj files to get them, but I may need to expand this in the future to deal with other file types as well, such as linker map files, and the like. What I've got so far is an xslt transform that filters out all whitespace and files except for the pdb files, but it also leaves behind empty directories: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"> <!-- strip all extraneous whitespace --> <xsl:strip-space elements="*"/> <!-- 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> <!-- Exclude all File elements that are not a .pdb file --> <xsl:template match="wix:Component[not(contains(wix:File/@Source, '.pdb'))]" /> <!-- Exclude all Directory elements that are svn folders --> <xsl:template match="wix:Directory[@Name='.svn']" /> </xsl:stylesheet> I've tried several different ways (found mainly from google, and messing around with xslt) of trying to recursively filter out the empty directories (and then their parent directories which will be empty, etc, etc), but I haven't been successful. I'm a beginner to xslt, and to be honest, I didn't think this would be so hard, and suspect it shouldn't be, I'm probably just not thinking in the right way. These are the things I've tried so far: <!-- Exclude all Directory elements that are not an ancestory of a .pdb file --> <xsl:template match="wix:Directory/wix:Component[not(contains(wix:File/@Source, '.pdb'))]" /> <xsl:template match="wix:Directory"> <xsl:if test="not(count(//wix:Component) = 0)"> <xsl:copy> <xsl:apply-templates select="@*|node()" /> </xsl:copy> </xsl:if> </xsl:template> <xsl:template match="/"> <xsl:apply-templates select="//wix:Component[not(wix:Component)]"/> </xsl:template> <xsl:template match="wix:File"> <xsl:apply-templates select="ancestor::wix:File[1]"/> </xsl:template> Not all at once of course, one by one. And I'm all out of ideas. I've taken a look at an XML book as well, with a section on XSLT, but that didn't help very much. The whole point of this is that when we build and create the msi of our product, to take all the pdb files (built in release, perhaps linker map files as well) and bundle them into another msi so we can install them alongside our product for when we need to do debugging on a particular machine. Only for development purposes of course, we would never distribute this to a customer! And I don't actually know if it's possible to install 2 separate projects to the same folder, or maybe I can set them up as separate features (main product and debug symbols), and have 2 msi files, one for each feature? Anyway, regardless of the crazy stuff I intend to do for debugging purposes, I figured this would be a good excuse to get a little familiar with xslt. Hopefully someone is able to make sense of what I'm trying to do :) ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users