So that didn't quite work for a few reasons, but I think I've ironed them out. The important one is that you can't modify nodes while you're iterating through an XPath result. So instead you have to use the clunkier "get snapshot" interface that instead of providing an iterator makes you call snapshotItem(i). And for some reason getSnapshotLength() was always giving me 0 as well, so instead you iterate i up until you get null back.
But it's really not that hard. If you downloaded my script before you can just install it again now and it'll overwrite the older version. You should try fixing the site of your choice, too!