2

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?

RKM
  • 3,151
  • 9
  • 37
  • 50

1 Answers1

4

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>
Alexey Ivanov
  • 11,541
  • 4
  • 39
  • 68
  • For an XML dummy: How do you apply this transform? – harper Jan 13 '12 at 17:22
  • @harper You'll have to use one of the tranformers, for example [Xalan](http://xml.apache.org/xalan-j/) or [Saxon](http://saxon.sourceforge.net/). Both of these are Java applications. Since this step would be a build process, one can use [Ant](http://ant.apache.org/)'s [XSLT task](http://ant.apache.org/manual/Tasks/style.html). There are other tools. – Alexey Ivanov Jan 13 '12 at 19:41
  • Here is a simple C# Form app to transform XML http://www.daniweb.com/software-development/csharp/threads/308973/xml-transformer – J Pollack Jun 12 '14 at 14:05
  • 2
    Update: -t parameter of heat.exe can be used to apply the transform file. – 51k Apr 19 '16 at 07:34