Wie setze ich systematisch das Attribut "readonly" auf Dateien ein, die mithilfe von Wärme geerntet wurden?

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

  •  27-10-2019
  •  | 
  •  

Frage

Ich ernte ein Verzeichnis mit Wärme. Ich konnte jedoch keine Option finden, um die "Readonly" -attribute für alle Dateien mit Wärme zu setzen.

Hat jemand eine Art, es in Hitze zu tun?

War es hilfreich?

Lösung

Wenden Sie eine XSLT -Transformation auf das durch Wärme erzeugte Fragment an und fügen Sie hinzu ReadOnly="yes" an jede File Element. Dieses XSLT macht das Ding:

<?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>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top