Perform XML replacements up front.