Essential XML for Web Professionals by Dan Livingston Essential XML for Web Professionals by Dan Livingston
Chapter Navigation Map

Chapter 9
Beginning XSLT: XPath

XPath is a part of XSL. XSL is a way of formatting XML documents, whether for visual display or for transforming the XML into some other form of XML.

To format XML documents, one must be able to target certain points within an XML document and apply certain rules or transformations to those points. A new language was needed to crawl through an XML document and find those points, and that language is called XPath.

XPath sees the world as a set of nodes: root, element, attribute, text, namespace processing instruction, and comment nodes. XPath uses a combination of axes and node-test. Axes include:

For example, child::effects would locate a child element of the current node that was called "effects." There are also functions you can use to further define what kind of element you're looking for. These functions can look at the position of an element, its ID, its name, namespace, and other aspects. Here's a list of some of the node-set functions.


Prentice Hall PTR home | Essential Series home
© 2002 Prentice Hall PTR
13 12 11 10 9 8 7 6 5 4 3 2 1