I have been beating this to death all day and about ready to simply kill a few kittens; is there any way to alter links?
There was a hook_link_alter in D6 but this is gone in D7. There is a hook_url_outbound_alter but this can only alter the link $options which are handled by the url() command such as fragment and query; but it can't touch things like attributes.
The only thing i have come across would be page_alter; but that would be a nightmare to handle there.
i tried simply modifying url() to allow $options passed by reference so that when it calls the hook_url_outbound_alter those changes would be passed back to l(); but no such luck.
certainly this must be a pretty important hook; so i'd assume it must be there but called something odd such it has managed to elude me.