I've been failing at solving the range transform issue for quite a while. I think now we need to do something a little bit bigger to make it work correctly and I have outlined that as an API proposal in the wiki.
https://cwiki.apache.org/confluence/display/TS/Transform+Plugin+Content+Length+Control