On Thu, Apr 18, 2002 at 02:09:01PM -0400, Ken Egervari wrote: > I know that there is a workaround (which is obvious), but I just > wanted to report it. position() is supposed to return the position > of the node within the current node list. So i'd expect 1,2,3,4...N. > It's just strange why it would behave otherwise. As for doing it > this way? I'm just playing around and noticed it. this isn't > production code at all.
This should've occured to me before sending the first reply, but, eh. Memory doesn't work so well so soon after waking up. It actually is reporting the correct position, if your XML is indendted. For example: <root> <application name="a" /> <application name="b" /> </root> has two text nodes in it at positions 1 and 3. So position() correctly reports the application nodes as being at 2 and 4. The only workaround for that is to take all the whitespace out of your XML: <root><application name="a" /><application name="b" /></root> Matt -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php