XPath
Consider this tree:
A
- B
--- B
- B (desired)
--- B
----- B ($current)
To get to the node desired, you can use the following XPath query:
$current/ancestor::B[parent::A]
Consider this tree:
A
- B
--- B
- B (desired)
--- B
----- B ($current)
To get to the node desired, you can use the following XPath query:
$current/ancestor::B[parent::A]