Basically you want an identity transform, with override rules.
The following transform
Y
applied to your input, produces the result:
Y
Add1
Add2
The first template is an identity transform, which copies the input document exactly.
The second template overrides text nodes with a value of X
that are children of a PrintDollarsAndCents
template. Note that it emits the value Y
instead of its actual content.