Querying in the following... <div xmlns="http://www.w3.org/1999/xhtml" id="test"> <span id="A"></span> <div> <span id="B"> <span id="C"></span> </span> </div> <span id="D"></span> </div> Query "preceding::xhtml:span" from span#D Result: span#A span#B span#C Expected: span#A span#B span#C ***SUCCESS***