How to systematically set “ReadOnly” attribute to files harvested using heat?

StackOverflow https://stackoverflow.com/questions/8847172

  •  16-04-2021
  •  | 
  •  

문제

I am harvesting a directory using heat, however, I couldnt find an option to set the "ReadOnly" attributes for all files harvest using heat.

Does anyone have know any way of doing it in heat?

도움이 되었습니까?

해결책

Apply an XSLT transform to the fragment generated by heat and add ReadOnly="yes" to every File element. This XSLT does the thing:

<?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">

    <xsl:template match="wix:File">
        <xsl:copy>
            <xsl:apply-templates select="@*" />
            <xsl:attribute name="ReadOnly">
                <xsl:text>yes</xsl:text>
            </xsl:attribute>
            <xsl:apply-templates select="*" />
        </xsl:copy>
    </xsl:template>

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

    <xsl:template match="@* | text()">
        <xsl:copy />
    </xsl:template>

    <xsl:template match="/">
        <xsl:apply-templates />
    </xsl:template>

</xsl:stylesheet>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top