Re: [xml] changing xpath context



Joe Eggleston wrote:

Which shows that //bar is searching from the document root rather than the
current "foo" node.

that's right. A single leading '/' means 'child of the root node', while
two subsequent '/' mean 'descendent of the root node'. Don't forget that
this notation is a shortcut. The canonical form for '/foo' would be
'/child::foo' and for '//foo' it would be '/descendant::foo'.
The abbreviated form for 'descendant::foo' would be './/foo'. Note the
leading '.', which you may (somewhat) compare to unix file system syntax.

http://www.w3.org/TR/xpath

has more explanation of this stuff...


Regards,
                Stefan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]