How to get the value of one attribute based on the value of another in xml in content | Community
Skip to main content
jx62030937
October 15, 2018
Solved

How to get the value of one attribute based on the value of another in xml in content

  • October 15, 2018
  • 1 reply
  • 1456 views

Hi,

Sorry for the mouthful in the title. Please see example below:

<xml>

     <object id="1" val="value" />

     <object id="2" val="value2" />

     <object1>

          <id1>value</id1>

          <id2>value2</id2>

     </object1>

</xml>

Referring to the first two nodes, in bold; If I'm trying to get the value of the attribute "val" based on the value of the attribute "id", what would be the syntax here. The typical syntax is <%= targetData.xml.object1.id1 %> for example.

Much appreciate it!

Jim

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jonathon_wodnicki

Hi,

You have to look it up with the id attribute:

<%= targetData.xml.object.(@id == targetData.xml.object1.id1).val %>

Thanks,

-Jon

1 reply

Jonathon_wodnicki
Community Advisor
Jonathon_wodnickiCommunity AdvisorAccepted solution
Community Advisor
January 7, 2019

Hi,

You have to look it up with the id attribute:

<%= targetData.xml.object.(@id == targetData.xml.object1.id1).val %>

Thanks,

-Jon