【发布时间】:2015-02-06 00:48:25
【问题描述】:
我正在尝试为所有级别等于 <instrText xml:space="preserve"> 级别的 <fldChar fldCharType="end"/> 标记查找 xpath。
我试过/word/r/instrText/preceding::fldChar 但它给出了前面的所有<fldChar fldCharType="end"/> 标签。我只需要相同级别的<fldChar。请建议我整理一下。
<?xml version="1.0" encoding="UTF-8"?>
<word>
<r rsidRPr="00A35D44">
<rPr>
<rFonts ascii="Times New Roman" eastAsia="Times New Roman"/>
</rPr>
<fldChar fldCharType="begin"/>
</r>
<r rsidRPr="00A35D44">
<rPr>
<rFonts ascii="Times New Roman" eastAsia="Times New Roman"/>
</rPr>
<instrText xml:space="preserve"> XE “efficiency” </instrText>
</r>
<r rsidRPr="00A35D44">
<rPr>
<rFonts ascii="Times New Roman" eastAsia="Times New Roman"/>
</rPr>
<fldChar fldCharType="end"/>
</r>
<fldChar fldCharType="end"/>
<r rsidRPr="00A35D44">
<rPr>
<rFonts ascii="Times New Roman" eastAsia="Times New Roman"/>
<b val="0"/>
</rPr>
<t>,</t>
</r>
<r rsidRPr="00A35D44">
<rPr>
<rFonts eastAsia="Times New Roman" hAnsi="Arial Unicode MS"/>
</rPr>
<instrText xml:space="preserve"> and equity</instrText>
</r>
</word>
【问题讨论】:
-
还有一个
preceding-sibling轴,但我不确定这是否符合你对同级别的定义。 -
我也尝试了前兄弟选项,但我没有得到结果 Mr.Martin Honnen
-
您能告诉我们您要选择样本中的哪些元素吗?
-
-
//fldChar[@fldCharType="end"][some $it in //instrText[@xml:space = "preserve"] satisfies count(./ancestor::node()) eq count($it/ancestor::node())]是否提供您想要的元素?我试图通过提出 XPath 建议来理解您对“同一级别”的定义,您可能需要详细说明这种情况。