xslt 选择:如果至少有一个后代没有特定条件

xslt selection: if there is at least one descendant without a certain criteria

我尝试 select 没有斜体文本的段落 (xslt 2.0):

<p>Some <hi rend="italic">italic text</hi></p>
<p>Some <hi rend="bold">bold text</hi> and some <hi rend="italic">italic Text</hi></p>
<p>Some <hi rend="bold">bold text</hi></p>

我只想拥有p[3]。我尝试了这个并且有效:

  <xsl:template match="p">
     <xsl:if test="p[not(child::hi[@rend='italic'])]"> ... do something </if>
  </xsl:template>

但我真正的问题是将此更深一层:我只想要那些 至少 一段没有斜体文本的文本:

<text>
    <p>Some Text</p>
    <p>Some <hi rend="bold">text</hi> and some <hi rend="italic">italic</hi> text</p>
</text>
<text>
    <p>Some <hi rend="bold">text</hi></p>
    <p>Some other text</p>
</text>
<text>
    <p>Some <hi rend="italic">text</hi></p>
    <p>Some <hi rend="italic">text</hi></p>
</text>

我如何 select 前两篇文章而不是第三篇?

第一部分你只想要

<xsl:template match="p[not(hi[@rend = 'italic'])]">...</xsl:template>

第二部分

<xsl:template match="text[p[not(hi[@rend = 'italic'])]]">...</xsl:template>