1 Reply Latest reply: Nov 27, 2012 1:15 AM by AlexAnd RSS

    Basic  XML Publisher Question: How to access tags in the higher levels?

    manu.mur
      Hi All,
      We have a basic question in XML Publisher.

      We have a xml hierarchy like below:

      <CD_CATALOG>
      <CATALOG>
      <CAT_NAME> CATALOG 1</CAT_NAME>
      <CD>
      <TITLE>TITLE1 </TITLE>
      <ARTIST>ARTIST1 </ARTIST>
      </CD>
      <CD>
      <TITLE> TITLE2</TITLE>
      <ARTIST>ARTIST2 </ARTIST>
      </CD>
      </CATALOG>
      <CATALOG>
      <CAT_NAME> CATALOG 2</CAT_NAME>
      <CD>
      <TITLE>TITLE3 </TITLE>
      <ARTIST>ARTIST3 </ARTIST>
      </CD>
      <CD>
      <TITLE> TITLE4</TITLE>
      <ARTIST>ARTIST4 </ARTIST>
      </CD>
      </CATALOG>
      </CD_CATALOG>

      We need to create a report like below:
      CATALOG_NAME     CD_TITLE     CD_ARTISTCATALOG 1     TITLE1     ARTIST1
      CATALOG 1     TITLE2     ARTIST2
      CATALOG 2     TITLE3     ARTIST3
      CATALOG 2     TITLE4     ARTIST4

      So we have to loop at the level of <CD> using for-each CD. But when we are inside this loop, we cannot access the value of CAT_NAME which is at a higher level.
      How can we solve this?

      Right now, we are using the work-around of set_variable and get_Variable. We are setting the value of CAT_NAME inside an outer loop, and using it inside the inner loop using get_variable.
      Is this the proper way to do this or are there better ways to do this? We are running into troubles when the data is inside tables.