How to systematically set “ReadOnly” attribute to files harvested using heat?
문제
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>
제휴하지 않습니다 StackOverflow