There's a Firebug extension called FirePath, which enhances Firebug's features related to XPaths. Also there was a new feature implemented into Firebug lately, which allows to copy the minimal XPath.
Both of them create paths based on elements with IDs, though, so I created an enhancement request for Firebug to allow what you're asking for. And I also commented on an existing feature request for FirePath, which targets this.