1
我有一个有效载荷如下我需要使用XSLT 1.0
<order>
<ordernumber>1-123
</ordernumber>
<orderline>
<linenumber>root
</linenumber>
<parentnumber>
</parentnumber>
<type>order
</type>
<actioncode>Existing
</actioncode>
</orderline>
<orderline>
<linenumber>x1
</linenumber>
<parentnumber>root
</parentnumber>
<type>Bundle
</type>
<actioncode>Existing
</actioncode>
</orderline>
<orderline>
<linenumber>xsub1
</linenumber>
<parentnumber>x1
</parentnumber>
<type>Bundle
</type>
<actioncode>Existing
</actioncode>
</orderline>
<orderline>
<linenumber>xsub2
</linenumber>
<parentnumber>x1
</parentnumber>
<type>Bundle
</type>
<actioncode>ADD
</actioncode>
</orderline>
<orderline>
<linenumber>xsub3
</linenumber>
<parentnumber>x1
</parentnumber>
<type>Bundle
</type>
<actioncode>Existing
</actioncode>
</orderline>
</order>
我想保持修剪有效载荷只有orderline = ADD
和下面
<order>
<ordernumber>1-123
</ordernumber>
<orderline>
<linenumber>x1
</linenumber>
<parentnumber>root
</parentnumber>
<type>Bundle
</type>
<actioncode>Existing
</actioncode>
</orderline>
<orderline>
<linenumber>xsub2
</linenumber>
<parentnumber>x1
</parentnumber>
<type>Bundle
</type>
<actioncode>ADD
</actioncode>
</orderline>
</order>
我尝试使用身份其父订单功能,但无法弄清楚逻辑.... 可以请你帮我 在此先感谢
这是我所尝试过的,埠牛逼,我无法弄清楚如何获得Xsub2的父项目,表示actioncode = 'ADD'
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/order/orderline[actioncode !='ADD']"/>
</xsl:stylesheet>
感谢michael.hor257k: - ) –