<XPath xmlns:n1=“example.net” >
(//. | //@* | //namespace::*) [ ancestor-or-self::n1:elem2 ]
</XPath>