//item[@price > 2*@discount]
Finds <item> and check its attributes
<item>
./ancestor-or-self::[@class="box"]
Works like jQuery's $().closest('.box').
$().closest('.box')
//section[h1[@id='section-name']]
Finds a <section> that directly contains h1#section-name
<section>
h1#section-name
//section[//h1[@id='section-name']]
Finds a <section> that contains h1#section-name. (Same as above, but uses descendant-or-self instead of child)
//* # all elements count(//*) # count all elements (//h1)[1]/text() # text of the first h1 heading //li[span] # find a <li> with an <span> inside it # ...expands to //li[child::span] //ul/li/.. # use .. to select a parent