XPath ExpressionXPath defines a pattern or path expression to select nodes or node sets in an XML document. These patterns are used by XSLT to perform transformations. The path expressions look like very similar to the general expressions we used in traditional file system. XPath specifies seven types of nodes that can be output of the execution of the XPath expression.
We know that XPath uses a path expression to select node or a list of nodes from an XML document. A list of useful paths and expression to select any node/ list of nodes from an XML document:
XPath Expression ExampleLet's take an example to see the usage of XPath expression. Here, we use an xml file "employee.xml" and a stylesheet for that xml file named "employee.xsl". The XSL file uses the XPath expressions under select attribute of various XSL tags to fetchvalues of id, firstname, lastname, nickname andsalary of each employee node. Employee.xml Employee.xsl Output: Next TopicXPath Nodes |