熱を使用して収穫されたファイルに「Readonly」属性を体系的に設定する方法は?

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

  •  27-10-2019
  •  | 
  •  

質問

私は熱を使用してディレクトリを収穫していますが、熱を使用してすべてのファイルの収穫の「読み取り」属性を設定するオプションを見つけることができませんでした。

誰もが熱の中でそれをする方法を知っていますか?

役に立ちましたか?

解決

熱によって生成されたフラグメントにXSLT変換を適用し、追加します ReadOnly="yes" すべてに File エレメント。このXSLTは何かをします:

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