需要删除多个条件的计划值
Need to remove the plan value for multiple condition
我需要删除出现相同多值的计划选项
test.xml
<p base="OptionDesc"></p>
输入 XML 值具有:
<PlanMaps>
<PlanMap>
<PlanCode>10049</PlanCode>
<Strategy>F</Strategy>
<OptionDesc>Option 2424809</OptionDesc>
</PlanMap>
<PlanMap>
<PlanCode>10049</PlanCode>
<Strategy>F</Strategy>
<OptionDesc>Option 2424796</OptionDesc>
</PlanMap>
<PlanMap>
<PlanCode>10049</PlanCode>
<Strategy>F</Strategy>
<OptionDesc>Option 2414596</OptionDesc>
</PlanMap>
<PlanMap>
<PlanCode>30019</PlanCode>
<Strategy>V</Strategy>
<OptionDesc>Option 2414600</OptionDesc>
</PlanMap>
</PlanMaps>
我试过的XSL:
<xsl:template match="PlanMaps">
<xsl:apply-templates select="document('../../../../test.xml')"/>
</xsl:template>
<xsl:template match="p[@base='OptionDesc'][parent::entry/@outputclass='plans']">
<p base="OptionDesc">
<xsl:text>(</xsl:text>
<xsl:value-of select="PlanMaps/PlanMap/OptionDesc"/>
<xsl:text>)</xsl:text>
</p>
</xsl:template>
当 Strategy
值为“F”且 PlanCode
值 (10049) 多次出现(两次或多次)相同时,结果预期为空,如下所示
<p base="OptionDesc"></p>
<p base="OptionDesc">(Option 2414600)</p>
这里我需要的是XSL,没有提到XSL中plancode的值。
看来您只需要处理主要输入:
<xsl:template match="PlanMaps">
<xsl:for-each-group select="PlanMap" group-by="concat(PlanCode, '|', Strategy = 'F')">
<p base="OptionDesc">
<xsl:value-of select="concat('(', OptionDesc, ')')[not(current-group()[2] and current-group()/Strategy = 'F')]"/>
</p>
</xsl:for-each-group>
</xsl:template>
我需要删除出现相同多值的计划选项
test.xml
<p base="OptionDesc"></p>
输入 XML 值具有:
<PlanMaps>
<PlanMap>
<PlanCode>10049</PlanCode>
<Strategy>F</Strategy>
<OptionDesc>Option 2424809</OptionDesc>
</PlanMap>
<PlanMap>
<PlanCode>10049</PlanCode>
<Strategy>F</Strategy>
<OptionDesc>Option 2424796</OptionDesc>
</PlanMap>
<PlanMap>
<PlanCode>10049</PlanCode>
<Strategy>F</Strategy>
<OptionDesc>Option 2414596</OptionDesc>
</PlanMap>
<PlanMap>
<PlanCode>30019</PlanCode>
<Strategy>V</Strategy>
<OptionDesc>Option 2414600</OptionDesc>
</PlanMap>
</PlanMaps>
我试过的XSL:
<xsl:template match="PlanMaps">
<xsl:apply-templates select="document('../../../../test.xml')"/>
</xsl:template>
<xsl:template match="p[@base='OptionDesc'][parent::entry/@outputclass='plans']">
<p base="OptionDesc">
<xsl:text>(</xsl:text>
<xsl:value-of select="PlanMaps/PlanMap/OptionDesc"/>
<xsl:text>)</xsl:text>
</p>
</xsl:template>
当 Strategy
值为“F”且 PlanCode
值 (10049) 多次出现(两次或多次)相同时,结果预期为空,如下所示
<p base="OptionDesc"></p>
<p base="OptionDesc">(Option 2414600)</p>
这里我需要的是XSL,没有提到XSL中plancode的值。
看来您只需要处理主要输入:
<xsl:template match="PlanMaps">
<xsl:for-each-group select="PlanMap" group-by="concat(PlanCode, '|', Strategy = 'F')">
<p base="OptionDesc">
<xsl:value-of select="concat('(', OptionDesc, ')')[not(current-group()[2] and current-group()/Strategy = 'F')]"/>
</p>
</xsl:for-each-group>
</xsl:template>