我正在尝试为级别等于<fldChar fldCharType="end"/>
级别的所有<instrText xml:space="preserve">
标记找到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>
答案 0 :(得分:2)
根据我们在评论中的交换,您正在寻找表达式//fldChar[@fldCharType="end"][some $it in //instrText[@xml:space = "preserve"] satisfies count(./ancestor::node()) eq count($it/ancestor::node())]
。或者更短//fldChar[@fldCharType="end"][some $it in //instrText[@xml:space = "preserve"] satisfies count(ancestor::node()) eq count($it/ancestor::node())]
。