So I just finished implementing both these functions today - for libxml2 - only to find during subsequent testing that my new XPath extension functions wouldn't register correctly. Why? Because libxml2 already implements them natively! Haha... Lesson #1: RTFM!
I'll start in on the java version now for javaRosa, and will post a PR when ready.