1<XPath xmlns:ietf="http://www.ietf.org" >
2    (//.|//@*|//namespace::*)
3    [
4	self::ietf:e1
5	    or
6	(parent::ietf:e1 and not(self::text() or self::e2))
7	    or
8	count(id("E3")|ancestor-or-self::node()) = count(ancestor-or-self::node())
9    ]
10</XPath>