使用 XSLT 对多个属性进行条件匹配

conditional match for multiple attributes using XSLT

下面是输入XML

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:ces:names:specification:ces:schema:all:4:0">
    <soapenv:Header/>
    <soapenv:Body>
        <ces:ShipNotice Version="4.0" xmlns:ces="urn:ces:names:specification:ces:schema:all:4:0">
            <ces:Header>
                <ces:From>
                </ces:From>
                <ces:To>
                </ces:To>
            </ces:Header>
            <ces:ShipNoticeBody>
                <ces:ShipNoticePartners>
                    <ces:Buyer>
                        <ces:PartnerInformation>
                            <ces:PartnerIdentifier Agency="AGIIS-EBID">8049915600000</ces:PartnerIdentifier>
                        </ces:PartnerInformation>
                    </ces:Buyer>
                    <ces:OtherPartner PartnerRole="ShipTo">
                        <ces:PartnerInformation>
                            <ces:PartnerIdentifier Agency="AGIIS-EBID">8049915600000</ces:PartnerIdentifier>
                        </ces:PartnerInformation>
                    </ces:OtherPartner>
                    <ces:OtherPartner PartnerRole="BillToParty">
                        <ces:PartnerInformation>
                            <ces:PartnerIdentifier Agency="AGIIS-EBID">1024122440000</ces:PartnerIdentifier>
                        </ces:PartnerInformation>
                    </ces:OtherPartner>
                </ces:ShipNoticePartners>
                <ces:ShipNoticeDetails>
                </ces:ShipNoticeDetails>
            </ces:ShipNoticeBody>
        </ces:ShipNotice>
    </soapenv:Body>
</soapenv:Envelope>

如果 Buyer and Shipto 和 Billtoparty 的值可以是 AGIIS-EBID 或 EAN,我需要测试传入请求。

我之前也问过类似的问题

在上一个线程中,我测试的值是相同的。

<xsl:when test="
 ($Buyer='AGIIS-EBID' and  $Shipto='AGIIS-EBID' and $Billto='AGIIS-EBID') 
 or ($Buyer='EAN' and  $Shipto='EAN' and $Billto='EAN') 
 or ($Buyer='GLN' and  $Shipto='GLN' and $Billto='GLN')">

我的问题是如何测试 Agency@Buyer, Agency@Shipto, Agency@billtoParty 的条件,如果值为 AGIIS-EBIDEAN

我的意思是在 soap 请求中总是 Buyer、Shipto、billtoparty 可以有不同的顺序,例如 Buyer=AGIIS-EBID,Shipto=EAN,billtoparty=AGIIS-EBID or Buyer=EAN,Shipto=EAN,billtoparty=AGIIS-EBID or Buyer=AGIIS-EBID,Shipto=EAN,billtoparty=EAN

我正想做这样的事情

<xsl:when test="($Buyer='AGIIS-EBID' and  $Shipto='AGIIS-EBID' and $Billto='AGIIS-EBID') or ($Buyer='AGIIS-EBID' and  $Shipto='EAN' and $Billto='AGIIS-EBID')($Buyer='AGIIS-EBID' and  $Shipto='AGIIS-EBID' and $Billto='EAN') or ($Buyer='EAN' and  $Shipto='EAN' and $Billto='EAN')">

任何人都可以建议不同的方法吗?

问题更新。

@michael.hor257k 对不起..三个代理对象(Buyer、ShipTo 和 BillToParty),你是对的,它可以是正数(AGIIS-EBID 或 EAN)。如果是正数,我需要接受消息,但是,如果它是负面的,我需要拒绝消息说@Agency 与买家、Shipto 和 Billparty 的 AGIIS 或 EAN 不匹配。

我面临的问题是 Agency 对象 (Buyer, ShipTo and BillToParty) 应该匹配 ( AGIIS-EBID or EAN),但我不知道它们以何种方式出现。

以下是分配值的不同方式。

例如:(Buyer='AGIIS-EBID'and Shipto='EAN'and Billtoparty='AGIIS-EBID') or (Buyer='EAN' and Shipto='EAN' and Billtoparty='AGIIS-EBID') or (Buyer='AGIIS-EBID' and Shipto='EAN' and Billtoparty='EAN')`等等....

我还想补充一件事我必须检查 Buyer 和 Shipto 和 BilltoParty

@Agency 的积极条件

怎么样:

<xsl:variable name="Buyer_ok" select=" $Buyer = 'EAN' or $Buyer = 'AGIIS-EBID' " />
<xsl:variable name="Shipto_ok" select=" $Shipto = 'EAN' or $Shipto = 'AGIIS-EBID' " />
<xsl:variable name="Billto_ok" select=" $Billto = 'EAN' or $Billto = 'AGIIS-EBID' " />
        :
        :
<xsl:when test=" $Buyer_ok and $Shipto_ok and $Billto_ok "> . . .</xsl:when>

My goal to test every time $Buyer= 'AGIIS-EBID' or 'EAN' and $Shipto= 'AGIIS-EBID' or 'EAN' and $Billto= 'AGIIS-EBID' or 'EAN'

好的,那你为什么不把它拼写成;

<xsl:when test="
($Buyer='AGIIS-EBID' or $Buyer='EAN') 
and 
($Shipto='AGIIS-EBID' or $Shipto='EAN')
and 
($Billto='AGIIS-EBID' or $Billto='EAN')">