Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Based on a specific XML Node value, find the Value from other Nodes

Avatar

Level 2

Hello,

I need to loop trough an xml file and look for a certain fieldname(otherAddresses). There are about 6 fields named otherAddresses and each of them has a field named "PublishingTypeID". Now, depending on the value of PublishingTypeID, I have to select that specific OtherAddresses field and get the value from it's Childfields.

So, for example. If otherAddresses.publishingTypeID has a value of 2, I have to get the value of otherAddresses.lastName from that specific otherAddresses field.

The image below will probably clear up any confusion.

Could anyone help me loop through this?

1706723_pastedImage_0.png

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi @srinit86581866 

You can do it with xPath. Try this:

//otherAddresses[@publishingTypeID="02"]/@lastName

 

Jean

View solution in original post

1 Reply

Avatar

Correct answer by
Level 3

Hi @srinit86581866 

You can do it with xPath. Try this:

//otherAddresses[@publishingTypeID="02"]/@lastName

 

Jean