 Hello and welcome to this video lecture on XPath. In this video lecture, I will be introducing the basics of XPath and how XPath expressions are used in accessibility for the transformation of XML documents into other documents. So these are the learning outcomes of today's video lecture. After the end of this video lecture, you will be able to write simple XPath expressions to be used in accessibility. These are the contents of today's video lecture. So what exactly is XPath? XPath stands for XML path. It is a non-XML language for identifying particular parts given in an XML document. Now, XSLT, which is the transformation, it uses XPath expressions, that is, expressions written in XPath to match and select particular elements in a particular given XML document for copying into other documents for further processing. It contains over 200 plus built-in functions and it represents numbers, strings or booleans. It is a W3C recommendation and the current XPath version is XPath 3.0. So what are nodes in XPath? An XML document is a tree, if you can remember, it is a tree and it is made up of nodes. So there is one root node and all the other nodes are parts of this root node. So XPath is a language for picking up these nodes and set of nodes, particular set of nodes as required out of this tree. So these are the types of nodes that we have. The root node is the root which holds all the other nodes, the element nodes, the text nodes, attribute nodes, and so on. The root node of the tree is not the same as the root element, which is part of the root node. The root element is part of the root node, whereas the root node holds the entire XML document. So this is an example given here. This is the root element. This is the parent element book. Now all the other elements which come in the book or our children of book are called as child elements or child nodes. Similarly, if we look at title node and author node, we can say that title node, author node, as well as year node and price nodes are child nodes or they are also called as sibling nodes. Say for example, bookstore. So we can say that bookstore node is the ancestor of title or author. And similarly, title or author are the descendants of bookstore because they are child nodes of the parent node. So these relations are seen in the nodes. Now how do we select the particular node for transformation? X path uses path expression for selection of nodes. The following path expressions are commonly used to select nodes. If we are writing a particular node name, for example, title, it selects all nodes with the name title or as the name specified in the double quotes. If I give a single slash, it selects all the document from the root node. If I mention doubles slash, it selects nodes in the document from the current node that match the selection no matter where they are. So the selection is made right from starting from the current node. If I give a single dot, it mentions it it selects the current node. If I give two single dots, it selects the parent of the current node. If I am mentioning at the rate symbol, it selects the attributes. So if you want to transform or select the value of the attribute you can always mention at the rate symbol. And if you are giving a straight line, it selects the several paths simultaneously. So if you want to select two or more elements or say for example, you want to select two or more attributes, you can select using the straight line. So these are this is the example of node selection. This is what we saw just now. If we write double slash title separated with a single line, double slash price, it selects all the title and the price elements in the document together. So what are predicates in XPAR? If you want to find a specific node or a node that contains a specific value, we use predicates. They are always embedded in square brackets. So if you want to select a particular specific node or a value, you always mention the predicate in the square bracket. So these are the predicates. If I want to select the first book element that is the child of the bookstore, I will write an expression starting with a slash bookstore slash book and the predicate will be one stating that I want to select the first book. Similarly, if I want to select the last book in the square bracket, I will mention last following with it with parenthesis. Similarly, if I want to select the pen ultimate or the second last, I will select I will write an expression ending with last predicate function or parenthesis minus one. If I want to select the first two book elements that are children of the bookstore element that is the first two book elements, I will select the less than third number of position. That means the first two books will be returned as per the need of the expression. Or if I want to select all the title elements having an attribute that have the language specified or even if I want to select all the titles having a specific language, I can mention it here in the attribute. So for say for example, I want to select all the title elements having a language attribute with the value English having being written in English. So I can mention this path expression starting with double slash title and in the predicate, I can mention the attribute starting with an at the rate symbol language is equals to in EN standing for English. So these are the predicates in XPath. So what are wild cards? If you want to select some unknown nodes using an XPath expression, we can use some wild card symbols. The asterisk single asterisk standing for matching any element node. If you want to match any element node, you can use a single star or an asterisk, an asterisk preceded with an at the rate symbol, it matches any attribute node and node followed with the parenthesis symbol matches any node of any kind. So these are the three wild cards which are most popularly used in XPath. So these are the examples used with wild cards. Now what are the operators that we use in the expressions? Now in addition to the basic arithmetic operators and the relational operators that we basically use in programming languages, XPath uses the following operators division symbol for sorry, div for division single equal to symbol for equals to or symbol for or a and d for and operation and mod for modulus operation. Similarly, we also use a single straight line to compute two or more node sets as given in the example here. So go through this complete XML document given at the left and write an XPath expression to select the title of the first book. Pause the video and write the correct XPath expression for finding or selecting the title of the first book. So if you have gone through the complete XML file and have found the XPath expression, the path you need to write to find the first book is slash bookstore slash book having the predicate one and slash title which will return the title of the first book and everyday Italian which is the title of the first book will be return or selected. So these are some XPath examples. If you want to select all the titles, we shall write an XPath having the expression bookstore slash book slash title. Similarly, if you want to select all the prices, we will mention bookstore slash book slash title slash price excuse me and having the predicate text. If you want to select all the prices, just the prices and not the elements just the prices above the value 10, we shall write an path like as follows bookstore slash book slash price greater than 10 and slash price. If I want the name or the title or the element, so I need to write the element here and that will return the list of the element having price greater than 10. So these are the references and acknowledgments that I would like to give and I have used for this video lecture. Thank you.