• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 318
  • Last Modified:

Xpath to find attribute id from album node

Hi Experts,

Please help me in writting xpath query to find id attrbute of the Album node

<Album name="Burj Gallery" sno="1" id="tcm:601-632210">

where attribute "isCurrent" value is "True" from node <Albums> as below

<Albums name="2011 Media Gallery" isCurrent="True">

There are many <Album> node in <Albums> node

so I wanted value of attribute id from Album node where sno="1"

I mean id of first album from Albums node where Albums  has attribute isCurrent="True"

Please help me writing xpath

Many Thanks
ImageGallery.xml
0
tia_kamakshi
Asked:
tia_kamakshi
2 Solutions
 
Geert BormansCommented:
//Albums[@isCurrent = 'True']/Album[@sno = '1']/@id
0
 
zc2Commented:
If I understood your question correctly, you need an XPath expression like this?

//Albums[@isCurrent="True"]/Album[@sno="1"]/@id
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now