Please read
http://openxmldeveloper.org/cfs-file.as ... lained.pdf which explains the structure of a pptx, and in particular where slide layout parts and slide master parts are attached.
You can also run your pptx through the PartsList sample, which will also show you this structure, and what Java objects docx4j/pptx4j uses to represent the parts.
You could then replace the contents of each part, with the contents of the corresponding part in the template, using .setJAXBEelement. That would probably be the simplest (assuming a 1:1 correspondence)
Alternatively, our MergePptx (not part of docx4j/pptx4j) could be used; you'd concatenate 0 slides from the template with the contents of the pptx whose appearance you wanted to change.