Hy Michael, but all items/nodes are part of the document. I can ask for the parent on each item, and I get it. All items gave me the same object, because all are childs of the same node. So, why i get the wrong position? And why position() says 0 and not 1?
Is there a workaround for this problem? Sven ----- Original Message ----- From: "McDonough, Michael " <[EMAIL PROTECTED]> To: "Sven Rottenbiller" <[EMAIL PROTECTED]> Sent: Tuesday, January 13, 2004 2:53 PM Subject: RE: [dom4j-user] XPath with position() > I'm not certain, but I'll take a stab at it.... > > When you selectNodes() you are returned a list with (in your example) 3 > "items". Iterating to the first such item node and asking for _its_ > position you get 0 because it is now the relative-root; while invoking > getUniquePath() returns the full XPath to that node with "[1]" because it is > in that absolute path only 1 of 3 "items". > > > > _____ > > From: Sven Rottenbiller [mailto:[EMAIL PROTECTED] > Sent: Tue 1/13/2004 6:11 > To: [EMAIL PROTECTED] > Subject: [dom4j-user] XPath with position() > > > > Hallo list, > > i have a xpath-problem with position(). > I have a document like this: > > <root> > <item>1</item> > <item>2</item> > <item>3</item> > </root> > > I get a list of nodes from the document with selectNodes("/root/item"). Now > I iterate over the list and do some more xpath on every single node, and > here is the problem. > > The following xpath says always 0 for the position. Why? > node.valueOf("position()") returns 0 > > But when i get the unique path from the node with node.getUniquePath() there > > is the right position displayed. > e.g.: node.getUniquePath() returns /root/item[1] > > What I have to change? > > Sven > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Perforce Software. > Perforce is the Fast Software Configuration Management System offering > advanced branching capabilities and atomic changes on 50+ platforms. > Free Eval! http://www.perforce.com/perforce/loadprog.html > <http://www.perforce.com/perforce/loadprog.html> > _______________________________________________ > dom4j-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/dom4j-user > <https://lists.sourceforge.net/lists/listinfo/dom4j-user> > > ------------------------------------------------------- This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user