Copy operations before iterating through them.

In the previous commit I was experimenting with cloning the directive
tree and consuming the tree while generating the initial document,
forgetting that I need the tree when I regenerate the document. I then
reverted to creating copies of lists of operations and child directives
before iterating through them by shifting the first one off the list. At
least that's what I intended, but I neglected to to revert to using a
copy of the list of operations.
Convert to string before recording value length.

Regeneration was off. When a value directive evaluated to an integer the
character count was off since an integer has no `length` property. Now
converting the value directives value to `String` before recording its
length in the instance map.