This expression:
".//w:p[count(*/w:t) >= 0]"
selects all descendants of the context node (.
, whatever it is in the current state of processing) if they are elements with the qualified name w:p
and only if their children (most likely w:r
elements) have at least 0 w:t
elements.
That does not make a lot of sense of course, but this would:
".//w:p[count(*/w:t) >= 1]"
But actually, this would be sufficient:
".//w:p[descendant::w:t]"
The rationale behind it is to select w:p
elements only if they contain text (which is stored in w:t
elements, which in turn is stored in w:r
elements ("runs").
On the other hand,
".//w:p"
selects all w:p
elements that are descendants of the context node, regardless of whether they in turn contain a w:t
descendant or not.
EDIT
Doesn't both select the same number of nodes?
Yes, both amount to the same, but one of them is a sensible expression whereas the other is not.
does */w:t select only that are grandchildren or will it take into account the immediate children too?
This expression will only take into account w:t
elements that are grandchildren of w:p
. Besides, this (i.e. w:t
as an immediate child of w:p
) is not allowed in the OOXML Schema.