What is the difference/relation between position and index?

I’m really confused on the difference between an index and a position. Can someone give a good example of how they relate to a document structure and why do we need both an index and a position?

Index is the amount of sibling nodes that come before a node in its parent, position is the actual document-wide token offset of a node.

1 Like