Microsoft XML SDK 2.6 - XSLT Developer's Guide

XPath

XPath is a language used to create expressions that can address parts of an XML document, manipulate strings, numbers, and Booleans, and can match a set of nodes in the document. XPath is used by both XSLT and XPointer, and models an XML Document as a tree of nodes of different types, including element, attribute and text. XPath expressions can identify these nodes in the XML document, based on their type, name, and values, as well as the relationship of a node to other nodes in the document. An XPath expression yields one of the following four basic objects:

For instance, the query "find 'author' elements that have a 'period' attribute with the value 'classical', and that are contained in the 'authors' element at the document root" can be expressed as an XPath expression of the form "/authors/author[@period='classical']".

These simple expressions are a core part of XSLT transformations, which associate the expression results with templates to create a new XML document. Expressions using the XPath syntax can also be performed directly against the XML Document Object Model (DOM).

An important kind of XPath expression is a location path: an expression that selects a set of nodes relative to the context node. The result of evaluating location path is a node-set containing the selected nodes.

The MSXML Parser implements XPath as described in the XML Path Language (XPath) Version 1.0 W3C Recommendation, November 16 1999, found at http://www.w3.org/TR/xpath.

This section contains the following topics:

See Also

XPath Syntax | Getting Started with XSLT | Authoring Match Patterns