To determine the ending point of this context, we can select the
parent node if it encloses the results section, otherwise we should
specify another anchor which identifies the ending point of the
context or have a common ancestor with the first anchor which encloses
the section.
We must determine the ending point of the context. To do so, we can select the parent node if it encloses the results section; if it does not, we must specify another anchor which identifies the ending point of the context.
Your sentence goes off the track (or at least it gets unclear) with "or have a common ancestor...". "Have" might be in the wrong number. It might need to be "has". Is the subject "we" or is the subject "another anchor"?
In light of your reply in the comments:
...specify another anchor. This anchor must identify the ending point of the context, or it must have a common ancestor with the first anchor that encloses the section.