Home » XPath Absolute Path

XPath Absolute Path

by Online Tutorials Library

XPath Absolute Path

There are two types of location paths used to specify the location of node in XML documents. These paths are absolute or relative path.

An absolute path starts with root node or with ‘/’.

/company/employee– It will select employee nodes within class root node.

/company/employee/firstname? It will select firstname of an employee node within class root node.


XPath Absolute Path Example

Let’s take an example locating the elements using absolute path. Create an XML document employee.xml and its stylesheet document employee.xsl which uses the XPath expressions.

Employee.xml

Employee.xsl

Output:

Xpath Absolute path 1

You may also like