If you’re doing Firefox extension development you may be surprised by the lack of the XPath replace function. I definitely was. After looking through the list of supported Firefox XPath functions I found that the translate function did the trick. Here’s a list of supported Firefox Xpath functions for future reference:
https://developer.mozilla.org/en/XPath/Functions