Figured it out:
.//*[not(descendant::X or ancestor-or-self::X)][parent::*[descendant::X]]
solved XPath to select top-level elements not on the path to a given element
Figured it out:
.//*[not(descendant::X or ancestor-or-self::X)][parent::*[descendant::X]]
solved XPath to select top-level elements not on the path to a given element