XPath Reference

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - XPath Reference

XPath Reference

XML Path Language (XPath) is a general-purpose query notation for addressing and filtering the elements and text of XML documents. XPath expressions can address parts of an XML document; can manipulate strings, numbers, and Booleans; and can match a set of nodes in the document.

MSXML versions 4.0 and later support XPath within Extensible Stylesheet Language Transformations (XSLT), and through the DOM extensions, selectNodes and selectSingleNode. Starting with version 4.0, MSXML implements XPath as described in the XML Path Language (XPath) Version 1.0 Recommendation by the Worldwide Web Consortium (W3C). For information about the parser's conformance, see Supported XSLT Features.

XPath models an XML document as a tree of different type nodes. XPath expressions 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 basic objects.

  • node set
  • Boolean
  • number
  • string

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

XPath collections are 1-based.

This section covers the following:

See Also

Introduction to XPath Syntax | Introduction to the XPath Tree Model | Basic Syntax of XPath Expressions | Differences between XPath Expressions and XSLT Patterns | Context and Navigation in XPath | Working with Lists of Items Using XPath | Use XPath Axes to Navigate through XML Data | Filtering XML Data Using XPath Predicates | Using Functions in XPath Expressions | Construct Complex XPath Searches

Other Resources Other Resources

XML Path Language (XPath) Version 1.0 (W3C Recommendation 16 November 1999)