;;/child::doc;;Get the root node ;;/doc;;Abbreviated syntax for getting the root node ;;/child::doc/child::foo;;Get all elements that are children of the root node ;;/doc/foo;;Abbreviated syntax for getting all elements that are children of the root node ;;//foo;;Get all nodes ;;/doc/foo/bar;;Get all nodes that are children of nodes, and grandchildren of the nodes ;;/doc/foo/*;;Get all nodes that are children of nodes and grandchildren of the node ;;/doc/aaa/descendant::*;;Get all descendants of nodes that are children of the node ;;//foo/descendant::*;;Get all descendants of all nodes ;;//aaa/descendant::bar;;Get all nodes that have as an ancestor ;;//bar/parent::*;;Get parents of all nodes ;;/doc/foo/bar/ancestor::*;;Get all elements in the path, excluding nodes ;;/doc/foo/bar/*/ancestor::*;;Get all elements in the path, including nodes ;;//bar/ancestor::*;;Get all ancestors of nodes ;;/doc/foo[1]/following-sibling::*;;All following siblings of the first node ;;//bar[2]/following-sibling::*;;All following siblings of the second node ;;/doc/aaa/preceeding-sibling::*;;All siblings preceeding the tag ;;//*;;Return all nodes (apart from attribute nodes) ;;//node();;Also returns all nodes (apart from attribute nodes) ;;/descendant::*;;Select all descendants of the root node, so select all nodes ;;//bar;;Get all nodes ;;//foo/bar;;Get nodes that are children of all nodes ;;/*/*/*/bar;;Get all nodes that have 3 ancestors ;;//bar/attribute::name;;Get "name=" attributes for all nodes ;;//bar/attribute::node();;Get all attributes for all nodes ;;//attribute::name;;Get all "name=" attributes ;;//@name;;Abbreviated syntax for getting all "name=" attributes ;;//bar[@name];;Get all nodes that have a "name=" attribute ;;//bar[@closed];;Get all nodes that have a "closed=" attribute ;;//bar[@*];;Get all nodes that have attributes ;;//foo[not(@*)];;Get all nodes that don't have attributes ;;//bar[@name="Grogan's"];;Get all nodes with a name="Grogan's" attribute ;;//bar[./@name="Grogan's"];;Synonymous with the above: Get all nodes with a name="Grogan's" attribute ;;/doc/foo/bar[.='pub 5'];;Get all nodes that are children of nodes and grandparents of the node, with a text value of "pub 5" ;;/doc/foo[./bar='pub 5'];;Get all nodes that are children of the node and have a child node with a text value of "pub 5" ;;//bar[3];;Get the third node from the complete set of all nodes ;;//foo/bar[2];;Get the second node from those that are children of all nodes ;;//bar[last()];;Get the last node from the set of all nodes ;;//foo[2]/bar[3];;Get the third node from those that are children of the second node ;;//foo[1]/bar[last()];;Get the last node from those that are children of the first node ;;//bar[parent::*/@location = 'Drumcondra'];;Get all nodes whose parent has a location attribute of "Drumcondra" ;;//bar[position()>3][2];;First get the fourth and higher nodes, then select the second from that set (ie get the 5th one) ;;//bar[contains(@name,'ogan')][parent::*/@location = 'Town'];;Get the nodes that have a "name=" attribute that contains "ogan", and whose parent node has a "location=" attribute of "Town" ;;//bar[contains(@name,'ogan') & (parent::*/@location = 'Town')];;Synonymous with the previous query ;;//bar[2][parent::*/@location = 'Drumcondra'];;Get the second tag, and only include it if its parent's "location=" attribute is "Drumcondra" ;;//bar[starts-with(@owner,'Jo')];;Get all nodes whose "owner=" attribute starts with "Jo" ;;//bar[starts-with(@owner,'J')];;Get all nodes whose "owner=" attribute starts with "J" ;;//bar[starts-with(.,'pub');;Get all nodes whose text value starts with "pub" ;;//bar[contains(@name,'ogan')];;Get all nodes whose "name=" attribute contains "ogan" ;;//bar[contains(@name,'ogan')][2];;Get the second node whose "name=" attribute contains "ogan" ;;//bar[2][contains(@name,'ogan')];;Get the second tag, and only include it if its "name=" attribute contains "ogan" ;;//bar[2][contains(@name,'agan')];;Get the second tag, and only include it if its "name=" attribute contains "agan" ;;"//bar[2][contains(@name,'ogan')];;This query has an erroneous quote at the start, so returns no nodes ;;//bar[./[@name];;This query has an extra [ so returns no nodes