【发布时间】:2022-01-08 02:43:35
【问题描述】:
我有以下 HTML。
区块 1:
<div>
<p>
<strong>1:11</strong>
</p>
<p>
this is a content with <strong>strong content</strong> this is some extra data.
</p>
</div>
第 2 块:
<div>
<p>
this is extra content
</p>
</div>
第 3 块:
<div>
<p>
<strong>1:11</strong>
</p>
<p>
this is content with this is some extra data.
</p>
</div>
我想要一个 XSLT,它只检索第一个 p 节点,该节点没有任何 strong 作为直接子节点。
我想要的输出是
对于块 1 - 这是具有 强内容 的内容,这是一些额外的数据。 对于块 2,这工作正常 - 这是额外的内容 对于第 3 块,这工作正常 - 这是满足于这是一些额外的数据。
我尝试了以下 XSLT descendant::p[not(./strong)][1]。这不适用于块 1。我哪里出错了?
【问题讨论】:
标签: xslt-2.0