XPath Node FunctionsA list of operators on nodes to be used with the XPath expression: Index | Operator | Description |
---|
1) | / | It is used to select node under a specific node. | 2) | // | It is used to select node from root node. | 3) | [...] | It is used to check node value. | 4) | | | It is used for union of two node sets. |
A list of functions on nodes to be used with the XPath expression: Index | Function | Description |
---|
1) | node() | It is used to select all kinds of nodes. | 2) | processing-instruction() | It is used to select nodes which are processing instruction. | 3) | text() | It is used to select a text node. | 4) | name() | It is used to provide the name of the node. | 5) | position() | It is used to provide the position of the node. | 6) | last() | It is used to select the last node relative to current node; | 7) | comment() | It is used to select nodes which are comments. |
XPath Node Function ExampleLet's take an example to create a table of <employee> element with their details, by iterating over each employee. It calculates the position of the student node then displays details of the employee with serial number. Employee.xml: Employee.xsl: Output:
|