2016-07-05 83 views
2

我嘗試使用xslt文件過濾掉熱量收集文件時的pdb文件。但是,pdb文件仍然存在。我錯過了什麼?下面是該文件:xslt不會過濾掉pdb文件

<?xml version="1.0" encoding="utf-8"?> 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"         
xmlns:wi="http://schemas.microsoft.com/wix/2006/wi"> 
<xsl:output method="xml" indent="yes"/> 

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

<xsl:key name="pdf-search1"  match="wi:Component[contains(wi:File/@Source='$(var.StageDirXFire)', '.pdf')]" use="@Id"/> 

<xsl:template match="wi:Component[key('pdf-search1', @Id)]"/> 
<xsl:template match="wi:ComponentRef[key('pdf-search1', @Id)]"/> 

</xsl:stylesheet> 

回答

4

試試這個XSLT

<?xml version="1.0" encoding="ISO-8859-1"?> 
<xsl:stylesheet version="1.0" 
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
       xmlns:wix="http://schemas.microsoft.com/wix/2006/wi" 
       xmlns="http://schemas.microsoft.com/wix/2006/wi" 
       exclude-result-prefixes="xsl wix"> 

    <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" /> 

    <xsl:strip-space elements="*"/> 

    <xsl:key name="PdbToRemove" 
      match="wix:Component[contains(wix:File/@Source, '.pdb')]" 
      use="@Id" /> 

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

    <xsl:template match="*[self::wix:Component or self::wix:ComponentRef] 
         [key('PdbToRemove', @Id)]" /> 
</xsl:stylesheet> 

我真的不知道了很多關於XSLT,但我只是碰巧都做,你需要一個完全一樣的東西我安裝程序項目。在搜索了一段時間之後,我最終得到了這個xslt(以及其他一些我刪除的內容)。