0
votes

WIX Installer: Utilisation de XSLT avec HEAT.EXE Comment modifier la valeur de l'ID parent après avoir trouvé un match parent / enfant?

J'ai la source suivante: xxx pré>

et je veux modifier installdir vers TargetDir: p> xxx pré>

mais seulement si le composant ID = "acuthin.exe". J'ai essayé ce qui suit: p> xxx pré>

mais il a changé l'identifiant du composant au lieu de DIRECTALIDEF: P>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="INSTALLDIR">
            <Component Id="acuthin.exe" Guid="{F48C7EB0-6192-4F92-8FCB-8DC8517572B5}">
                <File Id="acuthin.exe" KeyPath="yes" Source="$(var.HARVESTDIR)\acuthin.exe" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="Groupacuthin.exeAutoUpdate">
            <ComponentRef Id="acuthin.exe" />
        </ComponentGroup>
    </Fragment>
</Wix>


0 commentaires

3 Réponses :


0
votes

Ce que vous voulez modifier est l'attribut ID de DirectoryRef, mais votre modèle sélectionne réellement un composant d'un enfant de DirectoryRef.

Changez votre modèle à: P>

<xsl:template match="wix:DirectoryRef[@Id='INSTALLDIR' and wix:Component/@Id='acuthin.exe']">
    <xsl:copy>
      <xsl:attribute name="Id">TARGETDIR</xsl:attribute>
      <xsl:apply-templates select="node()"/>
    </xsl:copy>
</xsl:template>


0 commentaires

0
votes

Veuillez essayer ce code:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    exclude-result-prefixes="xs"
    version="2.0">

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

    <xsl:template match="DirectoryRef">
        <DirectoryRef>
            <xsl:apply-templates select="@* except @Id"/>
            <xsl:if test="(@Id='INSTALLDIR') and /Wix/Fragment/ComponentGroup/ComponentRef[@Id='acuthin.exe']">
                <xsl:attribute name="Id" select="'TARGETDIR'"/>
            </xsl:if>
            <xsl:apply-templates/>
        </DirectoryRef>
    </xsl:template>


0 commentaires

0
votes

Votre @ match = "WIX: DIAMPERRF [@ ID = 'installdir'] / WIX: composant [@ @ id = 'acuthin.exe']" au lieu d'utiliser @ Match = "WIX: DIAMPERRF [@ ID = 'installdir" et WIX: composant/@id=acuthin.exe'] "


0 commentaires