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

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

  •  27-10-2019
  •  | 
  •  

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