![]() Siblings are at the same level as the current node and share it's parent. Represents the following siblings of the context node. Represents all nodes that come after the current node. Represents the current node and it's descendants. Descendants include the node's children upto the leaf node(no more children). Represents the descendants of the current node. Represents the children of the current node. Represents the attributes of the current node. Represents the current node and it's ancestors. Represents the ancestors of the current node which include the parents up to the root node. Axes are named so because they refer to axis on which elements are lying relative to an element.įollowing is the list of various Axis values. If location path starts with the node that we've selected then it is a relative path.įollowing are few examples locating the elements using relative path.įirstname − select firstname related to student nodes.Īs location path defines the location of a node using absolute or relative path, axes are used to identify elements by their relationship like parent, child, sibling, etc. Location path specifies the location of node in XML document. In this example, we've created a sample XML document students.xml and its stylesheet document students.xsl which uses the XPath expressions.įollowing is the sample XML used. class/student/firstname − select firstname of a student node within class root node. class/student − select student nodes within class root node. Following are few of the example locating the elements using absolute path. If location path starts with root node or with '/' then it is an absolute path. In this chapter, we'll see the XPath expression in details covering common types of Nodes, XPath defines and handles. In this example, we've created a sample XML document, students.xml and its stylesheet document students.xsl which uses the XPath expressions under select attribute of various XSL tags to get the values of roll no, firstname, lastname, nickname and marks of each student node. Selects all student elements no matter where they are in the document ![]() Selects the parent of the current attributesĮxample − Selects all nodes with the name "student"Įxample − Selects all student elements that are children of class Selection starts from the current node that match the selection Select all nodes with the given name "nodename" XPath uses a path expression to select node or a list of nodes from an XML document.įollowing is the list of useful paths and expression to select any node/ list of nodes from an XML document. XPath specification specifies seven types of nodes which can be the output of execution of the XPath expression. These patterns are used by XSLT to perform transformations or by XPointer for addressing purpose.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |