Using Xpath in Receiver Determination for greater than 500

Hi,
I am trying to use Xpath in the receiver Determination step and I want to check a field which is at item level and comes multiple times(0-unbounded) greater than 500.I tried with different options per SDN blogs,Xpath functions,but still I couldn't able to get what i am trying.I want to process the message when "quantity" is greater than 500,else I want to ignore the message with no errors.
I gave like this    /p1: /LIST/item[quantity>499]     EX
item loop is 0-unbounded and I need to check for every quantity.I selected the check box multi line as well.
I played around different options,but still did not get what I am looking for.
please suggest in this regard ,how I need to give the expression.
Thank you,
Sri

Hi,
For validating that the item field is occuring more than 500 times you need to choose the
2.The exact XPath would be in your case *(/p1: /LIST/itemquantity[499]EX)*
This means if the 500 th occurance of the item exists then the condition satisfies that is always true for 500 and above occurance of the item.
Please revert if the suggestion proves to be helpful.
cheers,
Abhishek.
Edited by: Abhishek  Paul on May 6, 2010 10:55 PM
Edited by: Abhishek  Paul on May 6, 2010 11:02 PM
Edited by: Abhishek  Paul on May 6, 2010 11:08 PM

Similar Messages

  • Conditions using xpath in Receiver determination

    How to write conditions using xpath in receiver determaination. Please provide few examples.
    Regards,
    Suresh.

    hi
    Defining Conditions
    You also have the option of specifying the conditions to be applied when forwarding a message to the receiver(s) in a receiver determination.
    Generally, a condition relates to the contents of a message; if a specified condition is fulfilled for a particular payload element (the corresponding element has a certain value, for example), then the message is forwarded to the specified receiver(s).
    ●     If you want to specify a new condition for forwarding the message to a receiver, in the table in the Display/Edit Receiver Determination editor in the Configured Receivers frame, choose Insert New Condition () and call the condition editor by using the input help ().
    ●     If you want to specify a new condition for forwarding the message to multiple receivers, in the table in the Display/Edit Receiver Determination editor in the Configured Receivers frame, choose Insert Line After Selection ( ) and call the condition editor  by using the input help (). 
    In the condition editor, you can select an element from the message payload and specify a value with which the value of this element is to be compared at runtime.
    check the link below
    http://help.sap.com/saphelp_nw04/helpdata/en/67/49767669963545a071a190b77a9a23/content.htm
    note:reward points if solution found helpfull.....
    regards
    chandrakanth.k

  • Reg:Xpath in receiver determination

    Hello,
    My message strcture looks like below.
    Record
    Level1
    item
    field1
    Level2
    item
    field2
    Level3
    item
    field3
    There can be multiple items for each level.
    Here goes my condition.
    I have to send the message to the receiver system "A" only when filed2 value is same across all items under level2 i.e. if there are three items under level2, then field2 should have the same value  across the items.
    Can you please let me know how do we impliment this in the reciver determination step using xpath?
    Regards,
    Rahul

    Rahul,
    Your scenario can be achieved using Enhanced Receiver Determination. Using Xpath in Receiver Determination might become complex for your condition.
    Refer below links for Enhanced Receiver Determination.
    http://help.sap.com/saphelp_nw04/helpdata/en/43/a5f2066340332de10000000a11466f/frameset.htm
    http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/3343
    Regards,
    Geetha

  • Dynamic receiver determination for synchron interface

    Hello everybody,
    I want to use dynamic receiver determination for a synchron scenario.
    The problem is, that the interface 'ReceiverDetermination' (http://sap.com/xi/XI/System SAP BASIS 7.00) is a asynchron interface.
    This leads to an error when activating the Interface-Mapping (synch source Interface -> asynch destination Interface ReceiverDetermination)
    Is there a way to use the dynamic receiver determination for synchron interface?
    Thanks a lot,
    Thomas

    Hi Thomas,
    I guess your scenario is not possible ASIS, since XI doesn't support 1:n for sync interfaces (and even if your mapping condition reduces it to 1:1, actually it is still 1:n, since your receiver list is unbounded).
    Theoretically, you could make it work with BPM, though.
    But I've never worked with a Receiver Determination Step reading from an enhanced receiver determination in ID (though there should be no problems).
    Use sync async bridge, then use receiver determination step to obtain the receiver from an enhanced Receiver Determination. Pay attention that this enhanced receiver determination is a dummy one, using a mapping from your async abstract interface to the ReceiverDetermination interface. Once your mapping has determined the receiver, the enhanced receiver determination will return that receiver to the Receiver Determination step in the BPM. Then use this receiver in the sync send step (in mode receiver from receiver list, not from context).
    The receiver determination of the actual sync send step may be a standard one, with the several receivers there (even if there are several there, at the moment of the sending, only one will be used).
    Maybe it will work, maybe not.
    Just try it.
    Regards,
    Henrique.

  • Receiver Determination for Integration Process - R/3

    Hi,
    While creating the receiver determination for the BAPI, how to specify the BAPI name in the Receiver (Partner) Service .
    I found an example in SDN Blog, however, it did not clear my doubt.
    /people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit
    Kindly, reply me.
    Regards,
    dinesh.

    >
    Dinesh Kumar wrote:
    > Hi,
    >
    > While creating the receiver determination for the BAPI, how to specify the BAPI name in the Receiver (Partner) Service .
    >
    > I found an example in SDN Blog, however, it did not clear my doubt.
    >
    > /people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit
    >
    > Kindly, reply me.
    >
    >
    > Regards,
    >
    > dinesh.
    did you import the BAPI?
    Your receiver system will be the SAP BS. when you use the f4 help option for the interface it will list the BAPI and u can select it

  • How can I type the symbol for greater than or equal to

    I wish to type the symbol for greater than or equal to in an equation but my keyboard does not have such a symbol

    Mathematical Operators - 2200-22FF
    :≥     ≥ 8805 GREATER-THAN OR EQUAL TO
    :http://www.sql-und-xml.de/unicode-database/mathematical-operators.html
    If this is for HTML use ≥ to create ≥
    you can bring up CharMap (charmap.exe)
    go down 11 windows (of 10 rows each) and it is on bottom row
    You should be able to type as Alt+8805 on the Numeric keypad (not number row)
    or on laptop with NumLock off as Fn+Alt+8805
    but that is not working for me and I verified that hex(x2265) and decimal (8805)
    values are equivalent.

  • Enhanced Receiver Determination for synchronous interface.

    Hello!
    Was anyone faced with the Enhanced Receiver Determination? When I try to create
    the definition of the Interface Mapping, I get the error:
    "Interface modi are different. Source interface Message Interface MI_My_sync_iface | urn:my is synchronous. Target interface Message Interface ReceiverDetermination | http://sap.com/xi/XI/System is asynchronous"
    Thank you.

    Hi ,
    U can go through below limks  :
    Illustration of Enhanced Receiver Determination - SP16
    SAP NetWeaver Process Integration: Enhanced Receiver Determination for Synchronous Scenarios
    Enhanced Receiver Determination in SAP XI - Exchange Infrastructure - Wiki
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/enhanced%2breceiver%2bdetermination%2bin%2bsap%2bxi
    Thanks

  • HT4847 iOS8 uses more space on iCloud for backup than before without changing anything other than upgrading to iOS8... why?

    iOS8 uses more space on iCloud for backup than before without changing anything other than upgrading to iOS8... why?

    Hello westbrkk,
    this is an user-to-user forum, so unfortunately we won't be able to tell you why.

  • XPATH in receiver determination

    Hi,
    We need to dynamically determine the receiver service based on the payload.
    In the extended service editor we have succesfully used a simple XPATH expression to point out a specific field of the payload (just like using af context object) containing the service name.
    However, in most cases the service name is a substring of a field of the payload and furthermore a constant is to be added to give the full service name. We have tried to solve this problem using the XPATH functions 'concat', 'string' and 'substring'. But as soon as we add just the simplest function to the XPATH expression, the receiver determination fails (unable to process the XPATH).
    We have tested the XPATH with the actual message using XML Spy, and it works well.
    The XPATH expression is: "concat('SAPR3_', substring(string(/p1:receipt/p1:identity), 2, 5))"
    Any hints?
    Regards
    Lars

    Hi Lars,
    I just noticed, that you are talking about extended Service Editor - not a Condition - so my answer above is obviously rubbish.
    What remains true is that the XPath you use has to result in a node, than the nodes string is taken as a service.
    So I am afraid there is no easy solution for your problem...
    If you do not have too many receivers and this list is rather static, you could of course use conditions in the receiver determination - something like:
    receiver service = SAPR3_b if /.../ = abc
    but this is of course not really applicable if the list of possible receivers gets too long.
    Another possibility would be to use the substring as a receiver within the configuration. So take it from the payload in the receiver determination and use this 'service' for interface determination and receiver agreement.
    Than, within the receiver agreement you can exchange this name by the 'real' name in the header mapping (which is performed as the very last step in the pipeline). Since you have a receiver agreement per receiver anyway, you would not have to create additional configuration objects. The downfall is of course, that to 'read' the configuration (or the message monitoring) one has to know about this mapping trick...

  • Enhanced Receiver determination - for Integration Process

    Hi,
    Just wanted to confirm that if it is possible to have more than one Receivers, with Enhanced Receiver Determination and one of the Receiver happens to be Integration Process. I know with Enhanced Receiver Determinations you can find more than one Receivers at Run time, however the key question is, if in addition to normal Receiver Systems (like SAP R/3 or Web Services etc), if we can also kickoff Integration Process within Enhanced Receiver Determination.
    Thanking in advance.

    as said by Udo Martens
    Assumedly the different receivers are using different Inbound Interfaces (a BP is using an Abstract Interface). Therefore you would need for each different receiver a own Interface Determination referring a own mapping.
    refer this wiki  http://wiki.sdn.sap.com/wiki/pages/pointstab/viewpageversion.action?pageId=131760630&version=5 to Know how to  configure Enhanced receiver determination  and Interface determination for each receiver .
    In your case one of the receiver will be Integration process

  • Receiver determination for Split Message - Bulk message handling

    All,
    I have a scenario where MATMAS message is split to multiple receivers via multi mapping 1:n; the split is based on plant specific data, all works fine the mapping splits the message perfectly.
    The problem I have is in configuring the receiver determiniation. I have put conditions based on plant specific data the message should be distributed to the appropriate receiver. At runtime the MATMAS message received is treated as a bulk message and it produces mutiple sub-documents however in my case if the MATMAS has 3 plant specific data the data is send to all the 3 receivers instead of sending just one message per plant to the appropriate receiver.
    Its IDOC to File scenario on XI 3.0, SP20.
    Receiver Determination:
    /MATMAS05/IDOC/E1MARAM/E1MARCM/WERKS = 'xxxx' -> send to XXXX_receiver
    /MATMAS05/IDOC/E1MARAM/E1MARCM/WERKS = 'yyyy' -> send to YYYY_receiver
    Though the receiver determiniation splits the message by plant it could be that a material is maintained for both xxxx and yyyy plants and in this case both should receive the message but the contents would be different. The problem I have is both messages are delivered to both receivers.
    I appreciate those who have taken the time to read the thread and thank you all in advance supporting with advices.
    / Saj

    Please find attached the source xml before transormation used for the xpath that I have indicated in my original message. From the below message E1MARCM-BESKZ differs on each plant and also has a corresponding warehouse view E1MLGNM where for example LHMG1 value differs for each warehouse.
      <?xml version="1.0" encoding="UTF-8" ?>
    - <MATMAS05>
    - <IDOC BEGIN="1">
    - <E1MARAM SEGMENT="1">
      <MSGFN>005</MSGFN>
      <MATNR>000000000001002201</MATNR>
      <MTART>ZFGS</MTART>
      <MATKL>1111003</MATKL>
    - <E1MAKTM SEGMENT="1">
      <MSGFN>005</MSGFN>
      <SPRAS>E</SPRAS>
      <MAKTX>AA Ni-MH Rechargeable Batteries</MAKTX>
      </E1MAKTM>
    - <E1MARCM SEGMENT="1">
      <WERKS>4911</WERKS>
      <BESKZ>F</BESKZ>
      </E1MARCM>
    - <E1MARCM SEGMENT="1">
      <WERKS>4912</WERKS>
      <BESKZ>X</BESKZ>
      </E1MARCM>
    - <E1MARCM SEGMENT="1">
      <WERKS>5020</WERKS>
      <BESKZ>E</BESKZ>
      </E1MARCM>
    - <E1MARMM SEGMENT="1">
      <MEINH>CS</MEINH>
      </E1MARMM>
    - <E1MLGNM SEGMENT="1">
      <LGNUM>020</LGNUM>
      <LHMG1>2020.000</LHMG1>
      <LETY1>E2</LETY1>
      </E1MLGNM>
    - <E1MLGNM SEGMENT="1">
      <LGNUM>023</LGNUM>
      <LHMG1>2323.000</LHMG1>
      <LETY1>E2</LETY1>
      </E1MLGNM>
    - <E1MLGNM SEGMENT="1">
      <LGNUM>024</LGNUM>
      <LHMG1>2424.000</LHMG1>
      <LETY1>E2</LETY1>
      </E1MLGNM>
    - <E1MVKEM SEGMENT="1">
      <VKORG>4900</VKORG>
      <PRAT1>X</PRAT1>
      </E1MVKEM>
    - <E1MVKEM SEGMENT="1">
      <VKORG>5000</VKORG>
      <PRAT1>/</PRAT1>
      </E1MVKEM>
      </E1MARAM>
      </IDOC>
      </MATMAS05>
    so in this example above:
    Receiver 4911 (WERKS) should receive:
    F + 2020 (BESKZ + LHMG1)
    Receiver 4912 (WERKS) should receive:
    F + 2323 (BESKZ + LHMG1)
    Receiver 5020 (WERKS) should receive:
    F + 2424 (BESKZ + LHMG1)
    The problem is all these 3 messages are delivered to all the 3 plants thus making it 9 messages delivered in total as against 3.
    / Saj

  • Idoc structure not displying in XPATH at Receiver Determination..!!! Urgent

    Hi All,
    Doing Idoc to File Scenerio,
    In the receiver determination, I need to select the XPATH from the Idoc structure and by based on the GLN number which is coming in one of the segment, I need to pass to different receivers.
    Problem here is Iam not able to see the Idoc structure in the  XPATH to provide the condition.
    But when doing File to Idoc scenarios, Iam able to see the File structure.
    Any idea why IDoc structure is not displaying over here??
    Its a bit urgent for me..
    Waiting for your replys.
    Thanks&Regards
    Seema.

    Hi,
    This will help you now
    Hi,
    If you get the following msg while selecting the BS in Receiver Determination and if you are unable to view the Structure of the Source
    "Message interface does not exist in any software components installed on this business system"
    1) Open ID-----Double click on Business system that which u are using in the scenario
    2) Check whether you are able to see the SWC in the Othere attributes TAB
    3) If it is not there means goto SLD----Open the Technical System of R/3 by choosing Web as ABAp type
    4) Click on Installed Products TAB
    5) Click on Add New product and add your Product of the SWC whcih you are using for developement and Save it
    6) Then goto Business systems TAB in the same Technical systems window and click on the Business System appears in the window.
    7) Click on Installed products and Check the check box of your Product and then finally save that.
    Now you should be able to see the SWC in the Othere attributes TAB in ID
    Regards
    Seshagiri

  • Customizing XPATH in Receiver Determination

    Hello,
    I am using this blog to write conditions /people/shabarish.vijayakumar/blog/2006/06/07/customise-your-xpath-expressions-in-receiver-determination and accordingly call the receiver (either Receiver_1 or Receiver_2), never to call both the receivers simultaneously
    I have a sample source message like:
    <?xml version="1.0" encoding="UTF-8"?>
    <ConsumerDetails>
       <UserId>91200024:123456</UserId> To check if UserId starts with 91200024: or not
       <Date>20111301161459</Date> To check if length of Date is 14 or not
       <Billing>RC</Billing> To check if Billing has value RC/ SB or not
       <Type>SE</Type> To check if Type has value SE/ CWE or not
    </ConsumerDetails>
    Accordingly wrote the below conditions:
    Receiver_1 (Conditions working fine):
    UserId (MiddleOperator --> ContainsPattern) --> 91200024:*
    /ConsumerDetails[(string-length(Date)) = "14"] --> EX
    /ConsumerDetails[(Billing = "RC") or (Billing = "SB")] --> EX
    /ConsumerDetails[(Type = "SE") or (Type = "CWE")] --> EX
    Receiver_2 (Conditions not working; except 1st condition):
    /ConsumerDetails[not(starts-with(UserId,'91200024:'))] --> EX
    /ConsumerDetails[(string-length(Date)) != "14"] --> EX
    /ConsumerDetails[(Billing != "RC") or (Billing != "SB")] --> EX
    /ConsumerDetails[(Type != "SE") or (Type != "CWE")] --> EX
    Only Conditions for Receiver_1 are working fine; those for Receiver_2 are not. Can anybody please provide correct conditions to be written in the Condition Editor?
    ~Thanks.

    Hello,
    Have you tried using the condition as mentioned below:
    /ConsumerDetails[not((string-length(Date)) = "14")] --> EX
    /ConsumerDetails[not((Billing = "RC")) or not( (Billing = "SB"))] --> EX
    /ConsumerDetails[not((Type = "SE")) or not((Type = "CWE"))] --> EX
    i.e. use not() instead of '!' ??
    -Rahul

  • XPath in receiver determination: Check content of elements that exist 0..n

    Hi all,
    I have a simple requirement in a receiver determination. In the structure of the XML message, there is a node "STATUS" with an element STATUS_CODE. This STATUS node can appear 0 or  9999 times.
    I want to check if there is ANY STATUS with STATUS_CODE = "0", and if so, the message should be sent to a certain receiver. How to to that?
    Will that be the solution: (//STATUS/STATUS_CODE = 0)?
    Thanks,
    CHRIS

    > So it seems to me that the operator != can't be used to check a 1...n element? What might be the reason for this?
    I am not sure how != works, it is not documented well.
    I suppose NE means: does not exist.
    So if any node STATUS_CODE with value 1 exists, then the result is false.
    If you want an existence check if this, you should apply this:
    //STATUS [STATUS_CODE != "1"]  EX
    See also:
    http://help.sap.com/saphelp_nwpi71/helpdata/EN/ab/13bf7191e73a4fb3560e767a2525fd/frameset.htm
    (scroll to the bottom)
    /people/shabarish.vijayakumar/blog/2006/06/07/customise-your-xpath-expressions-in-receiver-determination

  • Multi Mapping using condition & Dynamic Receiver determination – Used XSLT Mapping

    Dear Experts,
         I am struggling to identify an error on the Technical Routing. Firstly according to my scenario, I receive an XML file with multiple PO's and I have to split the file to 2 different target messages. and also according to the source payload I have to send the file to 2 different receivers. first receiver is ABAP Proxy to the back end system and the 2nd one is to a file location. I have used XSLT to split the message into 2 target message type and I have used a XSLT mapping for receiver determination. Does any one have any idea of what I am doing wrong.
    Note: some time I will only be able to fill in on target message.
    I have attached my XSLT message split mapping with this post, please let me know if you have further question.
    Your help is more appreciated.
    Advance Thanks,
    Pradeep
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
      <xsl:variable name="vFlag"/>
      <xsl:variable name="vPONUM" select="POTRACKING/Lines[1]/PONumber"/>
      <xsl:template match="/">
        <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
          <ns0:Message1>
            <ns1:MT_Tracking xmlns:ns1="http://www.findel-education.co.uk/axapta">
              <xsl:for-each select="POTRACKING/Lines">
                <sap:call-external class="ZCL_VNAP_OBJECTS" method="CHECK_PO_EXIST">
                  <sap:callvalue param="IP_EBELN" select="string(PONumber)"/>
                  <sap:callvariable name="vFlag" param="EP_BOLEAN" type="string"/>
                </sap:call-external>
                <xsl:if test="$vFlag = 0">
                  <Lines>
                    <DDate>
                      <xsl:value-of select="DespatchDate"/>
                    </DDate>
                    <PONumber>
                      <xsl:value-of select="PONumber"/>
                    </PONumber>
                    <POLine>
                      <xsl:value-of select="POLine"/>
                    </POLine>
                    <QTY>
                      <xsl:value-of select="Quantity"/>
                    </QTY>
                    <VendorMaterial>
                      <xsl:value-of select="VendorMaterialNumber"/>
                    </VendorMaterial>
                    <AccountRef>
                      <xsl:value-of select="AccountReference"/>
                    </AccountRef>
                    <ConsignNumber>
                      <xsl:value-of select="ConsignmentNumber"/>
                    </ConsignNumber>
                    <CarrierURL>
                      <xsl:value-of select="CarrierURL"/>
                    </CarrierURL>
                    <ConsignURL>
                      <xsl:value-of select="ConsignmentURL"/>
                    </ConsignURL>
                  </Lines>
                </xsl:if>
              </xsl:for-each>
            </ns1:MT_Tracking>
          </ns0:Message1>
          <ns0:Message2>
            <ns2:MT_Tracking xmlns:ns2="http://www.findel-education.co.uk/ecc/ax/po/ftp">
              <xsl:for-each select="POTRACKING/Lines">
                <sap:call-external class="ZCL_VNAP_OBJECTS" method="CHECK_PO_EXIST">
                  <sap:callvalue param="IP_EBELN" select="string(PONumber)"/>
                  <sap:callvariable name="vFlag" param="EP_BOLEAN" type="string"/>
                </sap:call-external>
                <xsl:if test="$vFlag = 1">
                  <Lines>
                    <DDate>
                      <xsl:value-of select="DespatchDate"/>
                    </DDate>
                    <PONumber>
                      <xsl:value-of select="PONumber"/>
                    </PONumber>
                    <POLine>
                      <xsl:value-of select="POLine"/>
                    </POLine>
                    <QTY>
                      <xsl:value-of select="Quantity"/>
                    </QTY>
                    <VendorMaterial>
                      <xsl:value-of select="VendorMaterialNumber"/>
                    </VendorMaterial>
                    <AccountRef>
                      <xsl:value-of select="AccountReference"/>
                    </AccountRef>
                    <ConsignNumber>
                      <xsl:value-of select="ConsignmentNumber"/>
                    </ConsignNumber>
                    <CarrierURL>
                      <xsl:value-of select="CarrierURL"/>
                    </CarrierURL>
                    <ConsignURL>
                      <xsl:value-of select="ConsignmentURL"/>
                    </ConsignURL>
                  </Lines>
                </xsl:if>
              </xsl:for-each>
            </ns2:MT_Tracking>
          </ns0:Message2>
        </ns0:Messages>
      </xsl:template>
    </xsl:stylesheet>

    Hi Hareesh,
    Please find my determination in the XSLT below, I am using enhanced receiver determination.
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:p1="http://sap.com/xi/XI/System" xmlns:ns="urn:sap-com:document:sap:idoc:messages" version="1.0">
      <xsl:variable name="vFlag"/>
      <xsl:variable name="vAX" select="0"/>
      <xsl:variable name="vSAP" select="0"/>
      <xsl:variable name="vBoth" select="0"/>
      <!--  <xsl:variable name="vPONUM" select="POTRACKING/Lines[1]/PONumber"/>-->
      <xsl:template match="/">
        <xsl:for-each select="POTRACKING/Lines">
          <sap:call-external class="ZCL_VNAP_OBJECTS" method="CHECK_PO_EXIST">
            <sap:callvalue param="IP_EBELN" select="string(PONumber)"/>
            <sap:callvariable name="vFlag" param="EP_BOLEAN" type="string"/>
          </sap:call-external>
          <xsl:choose>
            <xsl:when test="$vFlag = 0">
              <!--          <p1:Receivers>
                <Receiver>
                  <Service>
                    <xsl:text>BS_AXAPTA_TST</xsl:text>
                  </Service>
                </Receiver>
              </p1:Receivers>-->
              <xsl:variable name="vAX" select="$vAX + 1"/>
            </xsl:when>
            <xsl:when test="$vFlag = 1">
              <!--          <p1:Receivers>
                <Receiver>
                  <Service>
                    <xsl:text>BS_ECQCLNT300</xsl:text>
                  </Service>
                </Receiver>
              </p1:Receivers>-->
              <xsl:variable name="vSAP" select="$vSAP + 1"/>
            </xsl:when>
          </xsl:choose>
        </xsl:for-each>
        <xsl:if test="$vSAP &gt; 0">
          <xsl:if test="$vAX &gt; 0">
            <xsl:variable name="vBoth" select="$vBoth + 1"/>
            <xsl:variable name="vSAP" select="0"/>
            <xsl:variable name="vAX" select="0"/>
          </xsl:if>
        </xsl:if>
        <xsl:if test="$vBoth &gt; 0">
          <p1:Receivers>
            <Receiver>
              <Service>
                <xsl:text>BS_AXAPTA_TST</xsl:text>
              </Service>
            </Receiver>
            <Receiver>
              <Service>
                <xsl:text>BS_ECQCLNT300</xsl:text>
              </Service>
            </Receiver>
          </p1:Receivers>
        </xsl:if>
        <xsl:if test="$vAX &gt; 0">
          <p1:Receivers>
            <Receiver>
              <Service>
                <xsl:text>BS_AXAPTA_TST</xsl:text>
              </Service>
            </Receiver>
          </p1:Receivers>
        </xsl:if>
        <xsl:if test="$vSAP &gt; 0">
          <p1:Receivers>
            <Receiver>
              <Service>
                <xsl:text>BS_ECQCLNT300</xsl:text>
              </Service>
            </Receiver>
          </p1:Receivers>
        </xsl:if>
      </xsl:template>
    </xsl:transform>

Maybe you are looking for