Absolute position of each nodeset node without traversing entire document

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Iterating through an xPathNavigator nodeset using Movenext(), is there a way to get the absolute position of each nodeset node without having to traverse back to the root each time?
I am using xNode.Current.Select("./preceeding::*").Count but that traverses back to the root each time. Maybe something like the following[psuedo code]
while(xNode.MoveNext()
{
int pos = xNode.Current.Select(".preceeding::*[node() != lastNode]".Count;
lastNode=xNode;
}

View the full article
 
Back
Top