XPath pattern
From http://www.w3.org/TR/xslt
section 5
Here are some examples of patterns:
para
matches anypara
element*
matches any elementchapter|appendix
matches anychapter
element and anyappendix
elementolist/item
matches anyitem
element with anolist
parentappendix//para
matches anypara
element with anappendix
ancestor element/
matches the root nodetext()
matches any text nodeprocessing-instruction()
matches any processing instructionnode()
matches any node other than an attribute node and the root nodeid("W11")
matches the element with unique IDW11
para[1]
matches anypara
element that is the firstpara
child element of its parent*[position()=1 and self::para]
matches anypara
element that is the first child element of its parentpara[last()=1]
matches anypara
element that is the onlypara
child element of its parentitems/item[position()>1]
matches anyitem
element that has aitems
parent and that is not the firstitem
child of its parentitem[position() mod 2 = 1]
would be true for anyitem
element that is an odd-numbereditem
child of its parent.div[@class="appendix"]//p
matches anyp
element with adiv
ancestor element that has aclass
attribute with valueappendix
@class
matches anyclass
attribute (not any element that has aclass
attribute)@*
matches any attribute