如何在 XPath 中的所有路径元素上指定条件?

How to specify a condition on all path elements in XPath?

这是我的 XML:

<a>
  <a>
    <a stop="">
      <a>
        <b/>
      </a>
    </a>
  </a>
</a>

我需要 select 元素 <b> 如果它的路径没有 <a>@stop。它应该是这样的(假设我已经在树中的某个 <a> 停留):

a//[not(@stop)]b

select element <b> if the path to it doesn't have <a> with @stop

我会这样理解:

//b[not(ancestor::a/@stop)]