The ancestor-or-self axis selects the context node and all nodes that contain it.
ancestor-or-self
id("p1")/ancestor-or-self::*