次の XML の抜粋があります。完全な XML は OVF 定義です。
<?xml version="1.0" encoding="UTF-8"?>
<Envelope xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" x xml:lang="en-US">
<Item>
<rasd:Caption ovf:msgid="network.eth0.caption"/>
<rasd:Connection>eth0</rasd:Connection>
<rasd:Description ovf:msgid="network.eth0.description"/>
<rasd:ElementName>eth0</rasd:ElementName>
<rasd:InstanceID>13</rasd:InstanceID>
<rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType>
<rasd:ResourceType>10</rasd:ResourceType>
</Item>
<Item>
<rasd:Caption ovf:msgid="network.eth1.caption"/>
<rasd:Connection>eth1</rasd:Connection>
<rasd:Description ovf:msgid="network.eth1.description"/>
<rasd:ElementName>eth1</rasd:ElementName>
<rasd:InstanceID>14</rasd:InstanceID>
<rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType>
<rasd:ResourceType>10</rasd:ResourceType>
</Item>
<Item>
<rasd:Caption ovf:msgid="network.eth2.caption"/>
<rasd:Connection>eth2</rasd:Connection>
<rasd:Description ovf:msgid="network.eth2.description"/>
<rasd:ElementName>eth2</rasd:ElementName>
<rasd:InstanceID>15</rasd:InstanceID>
<rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType>
<rasd:ResourceType>10</rasd:ResourceType>
</Item>
<Item>
<rasd:Caption ovf:msgid="network.eth3.caption"/>
<rasd:Connection>eth3</rasd:Connection>
<rasd:Description ovf:msgid="network.eth3.description"/>
<rasd:ElementName>eth3</rasd:ElementName>
<rasd:InstanceID>16</rasd:InstanceID>
<rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType>
<rasd:ResourceType>10</rasd:ResourceType>
</Item>
</Envelope>
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
行の前に行を挿入しようとして<rasd:Connection>eth*</rasd:Connection>
いますが、すべてではありません。これまでのところ、次の XSL を取得して動作しますが、問題は、無効にする各インターフェイスをハードコーディングする必要があることです。
<xsl:template match="rasd:Connection[text()='eth0']">
<xsl:if test="$disableEths='true'">
<xsl:element name="rasd:AutomaticAllocation">false</xsl:element>
<xsl:copy-of select="."/>
</xsl:if>
</xsl:template>
<xsl:template match="rasd:Connection[text()='eth1']">
<xsl:if test="$disableEths='true'">
<xsl:element name="rasd:AutomaticAllocation">false</xsl:element>
<xsl:copy-of select="."/>
</xsl:if>
</xsl:template>
<xsl:template match="rasd:Connection[text()='eth2']">
<xsl:if test="$disableEths='true'">
<xsl:element name="rasd:AutomaticAllocation">false</xsl:element>
<xsl:copy-of select="."/>
</xsl:if>
</xsl:template>
無効にしたい値の区切られたリストを含むパラメーターをユーザーに渡す方法はありますか?パラメーターが入力されていない場合は、それらのいずれも無効にしないでください。問題がある場合は、プロセッサとして xsltproc を使用します。