One of the fundamental constructs for XSL transformations and XML links, XPath is nonetheless one of the lesser lights of the XML universe. However, if you're serious about developing your XML skills, you need to know it inside out - and this tutorial has all you need to get started.
And that just about concludes this little tour of XPath. In this article, you learnt a little about the history, need and rationale for XPath, together with an in-depth look at the various components of an XPath location reference. You also found out how to use XPath operators to build complex expressions, and XPath functions to perform simple processing tasks.
I hope you found this tutorial useful and informative, and that the material discussed here offers you some assistance in navigating the treacherous rapids of XML and XSL. You should now pop open your favourite XML document and begin playing with XPath to better understand how it works - the more you experiment with it, the easier it will become and, before long, you'll be constructing location paths without thinking twice.
The XPath specification, at http://www.w3.org/TR/xpath.html
General examples of XPath usage, at http://www.zvon.org/HTMLonly/XPathTutorial/General/examples.html
A list of useful XSL and XPath resources, at http://www.stars.com/Authoring/Languages/XSL/
Till next time....stay healthy
Note: All examples in this article have been tested on Microsoft Internet Explorer 5.5 and Saxon 6.4.3. Examples are illustrative only, and are not meant for a production environment. YMMV!
This article copyright Melonfire 2001. All rights reserved.