<libroxml  version="3.0.2" />
contact: tristan.lelong@libroxml.net
xpath handling

Relative xpath

starting point from any given noden1/n2/n3

Absolute xpath

starting point form root even if current node is different/n0/n1/n2/n3

Special Nodes

access all nodes*
access only element nodesnode()
access only text nodestext()
access only comment nodescomment()
access only processing-instruction nodesprocessing-instruction()

Conditions

Attribute string value/n0[=value]
Attribute int value/n0[@a=value]
Attribute int value/n0[@a!=value]
Attribute int value/n0[@a<value]
Attribute int value/n0[@a>value]
Attribute int value/n0[@a<=value]
Attribute int value/n0[@a>=value]
Node position/n0[first()]
Node position/n0[first()+2]
Node position/n0[last()]
Node position/n0[last()-3]
Node position/n0[position() = 0]
Node position/n0[position() != 0]
Node position/n0[position() > 1]
Node position/n0[position() < 2]
Node position/n0[position() >= 1]
Node position/n0[position() <= 2]
Node position/n0[position() <= 2]/n1
Node position/n0[2]
Node with namespace//*[namespace-uri() = 'http://test.com']
Other xpath/n0[n1/@attr]

Shorten xpath

Children/n0/n1/n2
Attributes/n0/n1/@a
Descendent or self::node()/n0//n3
Parent/n0/n1/../n1/n2
Self/n0/n1/./n2
Node in namespaces/test::n0

Full xpath

Nodes/n0/n1/child::a
Attributes/n0/n1/attribute::a
Descendent or self/n0/descendant-or-self::n5
Parent/child::n0/child::n1/parent::/n1
Self/child::n0/child::n1/self::
Precedingpreceding::n1
Followingfollowing::n1
Ancestorancestor::n2
Ancestor-or-selfancestor-or-self::n2
Namespacenamespace::test