Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Specifying an Axis

SQL Server 2000

The axis specifies the tree relationship between the nodes selected by the location step and the context node. These axes are supported:

  • child

    Contains the child of the context node.

    This XPath expression (location path) selects from the current context node all the <Customer> children:

    child::Customer
    

    In this XPath query, child is the axis. Customer is the node test.

  • parent

    Contains the parent of the context node.

    This XPath expression selects all the <Customer> parents of the <Order> children:

    child::Customer/child::Order[parent::Customer/@customerID="ALFKI"]
    

    This is same as specifying Child::Customer. In this XPath query, child and parent are the axes. Customer and Order are the node tests.

  • attribute

    Contains the attribute of the context node.

    This XPath expression selects CustomerID attribute of the context node:

    attribute::CustomerID 
    
  • self

    Contains the context node itself.

    This XPath expression selects the current node if it is the <Order> node:

    self::Order
    

    In this XPath query, self is the axis, and Order is the node test.

Show:
© 2015 Microsoft