Is XProc a suitable language?

The first question is of course: does XProc have enough functionality on board to, theoretically, do this? The answer to that is, fortunately, yes:

So, from a functional point of view, nothing stands in your way.