<xsl:template match="bar/bar/bar/bar/bar">
if you know the name. If you don't know the name,
match="*[name(..)=name(current()) and name(../..)=name(current()) and name(../../..)=name(current()) and so on]"
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference