指定軸 (SQLXML 4.0)

適用於:SQL ServerAzure SQL 資料庫

  • 座標軸會指定位置步驟與內容節點所選取節點之間的樹狀結構關聯性。 支援下列座標軸: 子軸

    包含內容節點的子系。

    下列 XPath 運算式 (位置路徑) 會從目前內容節點中選取所有 <Customer> 子系:

    child::Customer  
    

    在下列 XPath 查詢中, child 是座標軸。 Customer 是節點測試。

  • parent

    包含內容節點的父代。

    下列 XPath 運算式會選取 Order> 子系的所有 <Customer> 父代:<

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

    這與指定 child::Customer相同。 在此 XPath 查詢中, childparent 是座標軸。 CustomerOrder 是節點測試。

  • attribute

    包含內容節點的屬性。

    下列 XPath 運算式會 選取內容節點的 CustomerID 屬性:

    attribute::CustomerID  
    
  • 自我

    包含內容節點本身。

    如果它是 Order> 節點,下列 XPath 運算式會選取目前的節點<:

    self::Order  
    

    在此 XPath 查詢中, self 是座標軸,而且 Order 是節點測試。