find common parent using Xpath

I was wondering if there was any way to access common parent node using Xpath.<outer><main><a><b> sometext</b></a><c><d> sometext2</d></c></main></outer> I have the tex…


xml - Matching a node based on a sibling's value with XPath

Having a XML document like this:<?xml version="1.0" encoding="UTF-8"?><records type="array"><record><name>svn</name><record-type>A</record-type><ttl type="integer">86400</ttl>…


xml - XPath:Get nodes where child node contains an attribute

Suppose I have the following XML:<book category="CLASSICS"><title lang="it">Purgatorio</title><author>Dante Alighieri</author><year>1308</year><price>30.00</price></book><book category…


XPath:select all following siblings until another sibling

Here is an excerpt of my xml:<node/><node/><node id="1">content</node><node/><node/><node/><node id="2">content</node><node/><node/> I am positioned in the node[@id='1']. I need an Xpath to…


What does::(double colon) mean in Ruby?

This question already has an answer here: What is Ruby's double-colon `::`? 9 answers What does:: mean in Ruby? E.g. Foo::Bar.…


xslt and xpath: match preceding comments

given this xml:<root><list><!-- foo's comment--><item name="foo"/><item name="bar"/><!-- another foo's comment--><item name="another foo"/>…


java.lang.IllegalStateException: missing behavior definition for the preceding method call getMessage(“title”)

I'm using EasyMock(version 2.4) and TestNG for writing UnitTest. I have a following scenario and I cannot change the way class hierarchy is defined. I'm testing ClassB which is extending ClassA. Class…



XPath to find nearest ancestor element that contains an element that has an attribute with a certain value

ancestor::foo[bar[@attr="val"]] I thought this would work, but it's not. I need to find the nearest foo element going up in the tree that has a bar child element, which in turn has an attr attribute o…


How to select following sibling/xml tag using xpath

I have an HTML file(from Newegg) and their HTML is organized like below. All of the data in their specifications table is 'desc' while the titles of each section are in 'name.' Below are two example…


Combining the use of preceding and following sibling in the same xpath query

I have a quite simple problem but i can't seem to resolve it. Let's say i have the following code:<a><b property="p1">zyx</b><b>wvu</b><b>tsr</b><b property="p2">qpo</b><b>qc…




xpath sibling following element xslt first example descendant parent self