如果子节点包含parameter的值,则删除整个父节点



使用SAP CPI作为工具,以下属性在iFlow中可用:
${属性。测试代码}:

输入

<root>
<row1>
<value1>value1</value1>
<value2>value2</value2>
</row1>
<row2>
<value3>value3</value3>
<value4>value4</value4>
</row2>
</root>

输出:

<root>
<row1>
<value1>value1</value1>
<value2>value2</value2>
</row1>
<row2>
<value3>value3</value3>
<value4>test</value4>
</row2>
</root>

XSLT:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="$code"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="value4/text()[.='$code']"></xsl:template>
</xsl:stylesheet>

XSLT代码只能在不使用参数的情况下工作。(例如替换'$code'与测试将工作,但我必须使动态..)
尝试以下链接:
https://answers.sap.com/questions/341836/hci-xslt-get-property-value.html
https://answers.sap.com/questions/641167/cpi-xslt---use-of-headerproperty-in-xslt.html

试着去掉$code…的引号

<xsl:template match="value4/text()[.=$code]"/>

最新更新