This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

XPATH - selection based on multiple attribute values  RSS feed

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Experts,

I'm stuck with trying to construct an Xpath expression. I have an xml document resembling the following:

<root>
<record id="1">
<field id="220" value="Red" />
<field id="221" value="Small" />
<field id="222" value="25" />
</record>
<record id="2">
<field id="220" value="Red" />
<field id="221" value="Large" />
<field id="222" value="50" />
</record>
</root>

I want to return the record where the value of the field with id=220 is "Red" AND where the value of the field with id="221" is "Large".

In other words, I want to find a parent node based on the attributes of 2 of its element children.

Can you help?

Nisha
 
Sheriff
Posts: 23692
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My guess:
 
Nisha Soorya
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That did work exactly the way I wanted. Sorry for being late to say THANK YOU. I was excited when it worked.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!