The XPath Data Model

XPath 1.0 views an XML document as a tree of nodes. This tree is very similar to a Document Object Model (DOM) tree, so if you’re familiar with the DOM, you should have some understanding of how to build basic XPath expressions. (To be precise, this is a conceptual tree; an XSLT processor or anything else that implements the XPath standard doesn’t have to build an actual tree.)

[2.0] XPath 2.0 views everything as a sequence. A sequence can contain all of the nodes we cover here as well as atomic values. Whenever we’re working with parsed data from an XML document, the sequences we’re using are most likely nodes from the document tree, so we won’t have to worry about atomic values. For now, just be aware that the underlying data model in XPath 2.0 is different; we’ll cover those differences in great detail later in this chapter.

Get XSLT, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.