(//. | //@* | //namespace::*) [ ancestor-or-self::bar:Something and (self::text() or (namespace-uri() != "") or (string(self::node()) = namespace-uri(parent::node()))) ]