An Idea can change your life.....

Wednesday, November 04, 2009

xquery xpath expressions

XQuery uses XPath  expressions to locate nodes in a document and to navigate from one location to another within a single document or across documents. Navigation paths defined using XPath consist of a sequence of steps separated by /. A single step comprises an axis, a node test, and zero or more step qualifiers.

The axis specifies the direction of movement, relative to the context node. Supported axes in SQL Server 2005 are child, descendant, parent, attribute, self and descendant-or-self.

child : the children of the context node

descendant : all descendants (children, childrens children, ...)

parent : the parent (empty if at the root)

ancestor : all ancestors from the parent to the root

following-sibling : siblings to the right

preceding-sibling : siblings to the left

following : all following nodes in the document, excluding descendants

preceding : all preceding nodes in the document, excluding ancestors

attribute : the attributes of the context node

namespace : namespace declarations in the context node

self : the context node itself

descendant-or-self :  the union of descendant and self

ancestor-or-self : the union of ancestor and self

No comments: