integrate tree rewriting into batch transformation