Come impostare sistematicamente l'attributo "lettura" sui file raccolti usando il calore?

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

  •  27-10-2019
  •  | 
  •  

Domanda

Sto raccogliendo una directory usando il calore, tuttavia, non sono riuscito a trovare un'opzione per impostare gli attributi "lettura" per tutti i file raccolti usando il calore.

Qualcuno sa un modo di farlo in calore?

È stato utile?

Soluzione

Applicare una trasformazione XSLT al frammento generato dal calore e aggiungi ReadOnly="yes" a ogni File elemento. Questa XSLT fa la cosa:

<?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>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top