2 Replies Latest reply on Nov 10, 2010 9:14 AM by azathoth_

    XML iteration trouble

    azathoth_

      Hello all

      In my orchestration I have a xml variable like this:

      <form>
          <routes>
              <route>
                  <elements>
                      <foo>xxx</foo>
                      <foo>yyy</foo>
                      <foo>zzz</foo>
                  </elements>

                  <elements>
                      <foo>ee</foo>
                      <foo>ii</foo>
                      <foo>kk</foo>
                      <foo>aa</foo>
                  </elements>
              </route>

              <route>
                  <elements>
                      <foo>xxx</foo>
                  </elements>
                  <elements>
                      <foo>ff</foo>
                      <foo>mmm</foo>
                  </elements>
              </route>
          </routes>
      </form>

       

       

      I use a setValue/decisionPoint combination to iterate through it, first of all I get the routes count with an xPath and start a counter like this:

       

      /process_data/@routesCount = count(/process_data/xmlVar/routes/route)
      /process_data/@routesCounter = /process_data/@routesCounter +1

       

       

      Then I go on to iterate inside that routes/route[1] node using the same method, I want to get the number of 'foo' elements inside route[1] so I have the setValue:

       

       

      /process_data/@fooCount = count(/process_data/xmlVar/routes/route[/process_data/@routesCounter]/elements/foo)

       

      but I'm getting the total foo count of the entire document (10) instead of 3

       

      I have done recording/playback several times, the @routesCount and @routesCounter index work fine, but I always get 10 for the @fooCount.

       

      When I execute the XPath query:

       

      count(/form/routes/route[1]/elements/foo)

       

      in Oxygen I get 3 for a result

       

      Somehow LC is not taking the @routesCounter index into consideration when querying the XML

      Have you tried to do this double-iteration stuff?


      Thanks for your help