I've documented an alternative way to accomplish what you want that may work better:
http://intellectualcramps.blogspot.com/2009/09/xslt-processor-extensions.html