XPath expression to select nodes between a defined sequence of preceding and succeeding nodes
I've got the following structured XML file:
<w:document>
开发者_Go百科 <w:body>
<w:p>
<w:r>
<w:t/>
</w:r>
</w:p>
<w:p>
<w:r>
<w:t/>
</w:r>
</w:p>
<w:p>
<w:r>
<w:instrText/>
</w:r>
</w:p>
<w:p>
<w:r>
<w:t/>
</w:r>
</w:p>
<w:p>
<w:r>
<w:instrText/>
</w:r>
</w:p>
<w:p>
<w:r>
<w:t/>
</w:r>
</w:p>
</w:body>
</w:document>
and I'm trying desperately to find an XPath expression to select all <w:t>
nodes that are between two <w:instrText>
nodes. <w:t>
nodes basically appear freely all around the XML document, but I'm only interested in those between two <w:instrText>
nodes.
Any help is greately appreciated.
I'm trying desperately to find an XPath expression to select all
<w:t>
nodes that are between two<w:instrText>
nodes
/w:document/w:body/w:p/w:r/w:instrText/following::w:t
[count(.|/w:document/w:body/w:p/w:r/w:instrText/preceding::w:t) =
count(/w:document/w:body/w:p/w:r/w:instrText/preceding::w:t)]
Node set intersection expression
Is it not as simple as: //x/t
?
精彩评论